Переглянути джерело

init commit of sms local sender

init commit of sms local sender
zhiqiang.yu 7 місяців тому
батько
коміт
1f7fba6e6f

+ 1 - 0
.gitignore

@@ -108,3 +108,4 @@ _UpgradeReport_Files/
 Backup*/
 UpgradeLog*.XML
 
+/.vs

+ 25 - 0
smsdemo.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35818.85 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "smsdemo", "smsdemo\smsdemo.csproj", "{EB6B0113-7FE5-4270-87BE-B825A8A62F4A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{EB6B0113-7FE5-4270-87BE-B825A8A62F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EB6B0113-7FE5-4270-87BE-B825A8A62F4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EB6B0113-7FE5-4270-87BE-B825A8A62F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EB6B0113-7FE5-4270-87BE-B825A8A62F4A}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {255D6189-2C7E-48DE-9AC8-1A31CF10F2C4}
+	EndGlobalSection
+EndGlobal

+ 351 - 0
smsdemo/Form1.Designer.cs

@@ -0,0 +1,351 @@
+namespace smsdemo
+{
+    partial class Form1
+    {
+        /// <summary>
+        ///  Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        ///  Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        ///  Required method for Designer support - do not modify
+        ///  the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            components = new System.ComponentModel.Container();
+            groupBox1 = new GroupBox();
+            textBox2 = new TextBox();
+            textBox1 = new TextBox();
+            groupBox2 = new GroupBox();
+            button2 = new Button();
+            button1 = new Button();
+            textBox3 = new TextBox();
+            groupBox3 = new GroupBox();
+            groupBox4 = new GroupBox();
+            checkBox2 = new CheckBox();
+            checkBox1 = new CheckBox();
+            pictureBox4 = new PictureBox();
+            pictureBox3 = new PictureBox();
+            pictureBox2 = new PictureBox();
+            pictureBox1 = new PictureBox();
+            button6 = new Button();
+            label2 = new Label();
+            label1 = new Label();
+            textBox5 = new TextBox();
+            textBox4 = new TextBox();
+            button5 = new Button();
+            button4 = new Button();
+            button3 = new Button();
+            timer1 = new System.Windows.Forms.Timer(components);
+            groupBox1.SuspendLayout();
+            groupBox2.SuspendLayout();
+            groupBox3.SuspendLayout();
+            groupBox4.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)pictureBox4).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox3).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
+            SuspendLayout();
+            // 
+            // groupBox1
+            // 
+            groupBox1.Controls.Add(textBox2);
+            groupBox1.Controls.Add(textBox1);
+            groupBox1.Location = new Point(21, 21);
+            groupBox1.Name = "groupBox1";
+            groupBox1.Size = new Size(300, 186);
+            groupBox1.TabIndex = 0;
+            groupBox1.TabStop = false;
+            groupBox1.Text = "输入";
+            // 
+            // textBox2
+            // 
+            textBox2.Location = new Point(6, 107);
+            textBox2.Name = "textBox2";
+            textBox2.Size = new Size(144, 30);
+            textBox2.TabIndex = 1;
+            textBox2.Text = "1234";
+            // 
+            // textBox1
+            // 
+            textBox1.Location = new Point(6, 45);
+            textBox1.Name = "textBox1";
+            textBox1.Size = new Size(288, 30);
+            textBox1.TabIndex = 0;
+            textBox1.Text = "13040679332";
+            // 
+            // groupBox2
+            // 
+            groupBox2.Controls.Add(button2);
+            groupBox2.Controls.Add(button1);
+            groupBox2.Location = new Point(21, 213);
+            groupBox2.Name = "groupBox2";
+            groupBox2.Size = new Size(300, 114);
+            groupBox2.TabIndex = 1;
+            groupBox2.TabStop = false;
+            groupBox2.Text = "操作";
+            // 
+            // button2
+            // 
+            button2.Location = new Point(158, 29);
+            button2.Name = "button2";
+            button2.Size = new Size(136, 79);
+            button2.TabIndex = 1;
+            button2.Text = "发送";
+            button2.UseVisualStyleBackColor = true;
+            button2.Click += button2_Click;
+            // 
+            // button1
+            // 
+            button1.Location = new Point(6, 29);
+            button1.Name = "button1";
+            button1.Size = new Size(146, 79);
+            button1.TabIndex = 0;
+            button1.Text = "清空";
+            button1.UseVisualStyleBackColor = true;
+            button1.Click += button1_Click;
+            // 
+            // textBox3
+            // 
+            textBox3.Location = new Point(6, 32);
+            textBox3.Multiline = true;
+            textBox3.Name = "textBox3";
+            textBox3.Size = new Size(442, 255);
+            textBox3.TabIndex = 2;
+            // 
+            // groupBox3
+            // 
+            groupBox3.Controls.Add(textBox3);
+            groupBox3.Location = new Point(338, 34);
+            groupBox3.Name = "groupBox3";
+            groupBox3.Size = new Size(465, 293);
+            groupBox3.TabIndex = 3;
+            groupBox3.TabStop = false;
+            groupBox3.Text = "运行信息";
+            // 
+            // groupBox4
+            // 
+            groupBox4.Controls.Add(checkBox2);
+            groupBox4.Controls.Add(checkBox1);
+            groupBox4.Controls.Add(pictureBox4);
+            groupBox4.Controls.Add(pictureBox3);
+            groupBox4.Controls.Add(pictureBox2);
+            groupBox4.Controls.Add(pictureBox1);
+            groupBox4.Controls.Add(button6);
+            groupBox4.Controls.Add(label2);
+            groupBox4.Controls.Add(label1);
+            groupBox4.Controls.Add(textBox5);
+            groupBox4.Controls.Add(textBox4);
+            groupBox4.Controls.Add(button5);
+            groupBox4.Controls.Add(button4);
+            groupBox4.Controls.Add(button3);
+            groupBox4.Location = new Point(21, 333);
+            groupBox4.Name = "groupBox4";
+            groupBox4.Size = new Size(782, 274);
+            groupBox4.TabIndex = 4;
+            groupBox4.TabStop = false;
+            groupBox4.Text = "控制";
+            // 
+            // checkBox2
+            // 
+            checkBox2.AutoSize = true;
+            checkBox2.Checked = true;
+            checkBox2.CheckState = CheckState.Checked;
+            checkBox2.Location = new Point(304, 164);
+            checkBox2.Name = "checkBox2";
+            checkBox2.Size = new Size(126, 28);
+            checkBox2.TabIndex = 13;
+            checkBox2.Text = "服务化运行";
+            checkBox2.UseVisualStyleBackColor = true;
+            // 
+            // checkBox1
+            // 
+            checkBox1.AutoSize = true;
+            checkBox1.Checked = true;
+            checkBox1.CheckState = CheckState.Checked;
+            checkBox1.Location = new Point(303, 210);
+            checkBox1.Name = "checkBox1";
+            checkBox1.Size = new Size(142, 28);
+            checkBox1.TabIndex = 12;
+            checkBox1.Text = "使用adb点击";
+            checkBox1.UseVisualStyleBackColor = true;
+            // 
+            // pictureBox4
+            // 
+            pictureBox4.Location = new Point(664, 164);
+            pictureBox4.Name = "pictureBox4";
+            pictureBox4.Size = new Size(101, 87);
+            pictureBox4.TabIndex = 11;
+            pictureBox4.TabStop = false;
+            // 
+            // pictureBox3
+            // 
+            pictureBox3.Location = new Point(511, 164);
+            pictureBox3.Name = "pictureBox3";
+            pictureBox3.Size = new Size(101, 87);
+            pictureBox3.TabIndex = 10;
+            pictureBox3.TabStop = false;
+            // 
+            // pictureBox2
+            // 
+            pictureBox2.Location = new Point(664, 48);
+            pictureBox2.Name = "pictureBox2";
+            pictureBox2.Size = new Size(101, 87);
+            pictureBox2.TabIndex = 9;
+            pictureBox2.TabStop = false;
+            // 
+            // pictureBox1
+            // 
+            pictureBox1.Location = new Point(511, 48);
+            pictureBox1.Name = "pictureBox1";
+            pictureBox1.Size = new Size(101, 87);
+            pictureBox1.TabIndex = 8;
+            pictureBox1.TabStop = false;
+            // 
+            // button6
+            // 
+            button6.Location = new Point(158, 151);
+            button6.Name = "button6";
+            button6.Size = new Size(127, 87);
+            button6.TabIndex = 7;
+            button6.Text = "统计";
+            button6.UseVisualStyleBackColor = true;
+            button6.Click += button6_Click;
+            // 
+            // label2
+            // 
+            label2.AutoSize = true;
+            label2.Location = new Point(303, 105);
+            label2.Name = "label2";
+            label2.Size = new Size(20, 24);
+            label2.TabIndex = 6;
+            label2.Text = "y";
+            // 
+            // label1
+            // 
+            label1.AutoSize = true;
+            label1.Location = new Point(304, 51);
+            label1.Name = "label1";
+            label1.Size = new Size(19, 24);
+            label1.TabIndex = 5;
+            label1.Text = "x";
+            // 
+            // textBox5
+            // 
+            textBox5.Location = new Point(329, 105);
+            textBox5.Name = "textBox5";
+            textBox5.Size = new Size(116, 30);
+            textBox5.TabIndex = 4;
+            // 
+            // textBox4
+            // 
+            textBox4.Location = new Point(329, 51);
+            textBox4.Name = "textBox4";
+            textBox4.Size = new Size(116, 30);
+            textBox4.TabIndex = 3;
+            textBox4.TextChanged += textBox4_TextChanged;
+            // 
+            // button5
+            // 
+            button5.Location = new Point(158, 48);
+            button5.Name = "button5";
+            button5.Size = new Size(127, 87);
+            button5.TabIndex = 2;
+            button5.Text = "坐标校准";
+            button5.UseVisualStyleBackColor = true;
+            button5.Click += button5_Click;
+            // 
+            // button4
+            // 
+            button4.Location = new Point(25, 151);
+            button4.Name = "button4";
+            button4.Size = new Size(127, 87);
+            button4.TabIndex = 1;
+            button4.Text = "自检";
+            button4.UseVisualStyleBackColor = true;
+            button4.Click += button4_Click;
+            // 
+            // button3
+            // 
+            button3.Location = new Point(23, 48);
+            button3.Name = "button3";
+            button3.Size = new Size(127, 87);
+            button3.TabIndex = 0;
+            button3.Text = "初始化";
+            button3.UseVisualStyleBackColor = true;
+            button3.Click += button3_Click;
+            // 
+            // timer1
+            // 
+            timer1.Interval = 30000;
+            timer1.Tick += timer1_Tick;
+            // 
+            // Form1
+            // 
+            AutoScaleDimensions = new SizeF(11F, 24F);
+            AutoScaleMode = AutoScaleMode.Font;
+            ClientSize = new Size(816, 620);
+            Controls.Add(groupBox4);
+            Controls.Add(groupBox3);
+            Controls.Add(groupBox2);
+            Controls.Add(groupBox1);
+            Name = "Form1";
+            Text = "Form1";
+            groupBox1.ResumeLayout(false);
+            groupBox1.PerformLayout();
+            groupBox2.ResumeLayout(false);
+            groupBox3.ResumeLayout(false);
+            groupBox3.PerformLayout();
+            groupBox4.ResumeLayout(false);
+            groupBox4.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)pictureBox4).EndInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox3).EndInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
+            ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
+            ResumeLayout(false);
+        }
+
+        #endregion
+
+        private GroupBox groupBox1;
+        private TextBox textBox2;
+        private TextBox textBox1;
+        private GroupBox groupBox2;
+        private Button button2;
+        private Button button1;
+        private TextBox textBox3;
+        private GroupBox groupBox3;
+        private GroupBox groupBox4;
+        private Button button4;
+        private Button button3;
+        private System.Windows.Forms.Timer timer1;
+        private Button button5;
+        private TextBox textBox5;
+        private TextBox textBox4;
+        private Label label2;
+        private Label label1;
+        private Button button6;
+        private PictureBox pictureBox1;
+        private CheckBox checkBox1;
+        private PictureBox pictureBox4;
+        private PictureBox pictureBox3;
+        private PictureBox pictureBox2;
+        private CheckBox checkBox2;
+    }
+}

+ 318 - 0
smsdemo/Form1.cs

@@ -0,0 +1,318 @@
+using RabbitMQ.Client;
+using System.Diagnostics;
+using System.Threading.Channels;
+using RabbitMQ.Client.Events;
+using Newtonsoft.Json;
+using System.Text;
+namespace smsdemo
+{
+    public partial class Form1 : Form
+    {
+        private int clickX = 0; // 点击的X坐标
+        private int clickY = 0; // 点击的Y坐标
+        private int sendCount = 0; // 发送的短信数量
+        private bool isServiceRun = false; // 是否服务化运行
+        private bool isADBTap = false; // 是否adb点击
+
+        private static IConnection connection;
+        private static IChannel channel;
+        private static AsyncEventingBasicConsumer consumer;
+        private static string queueName = "queue_sms_local_send";
+        private static string hostName = "100.64.0.25:5672";
+        public Form1()
+        {
+            InitializeComponent();
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.net_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox1.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.adb_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox2.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.error_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox3.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.send_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox4.Image = image;
+            }
+            Connect();
+        }
+        static void Connect()
+        {
+            try
+            {
+                var factory = new ConnectionFactory { HostName = hostName , VirtualHost="/",UserName= "admin", Password= "admin" };
+
+                factory.Uri = new Uri("amqp://admin:admin@100.64.0.25:5672/");
+                connection = factory.CreateConnectionAsync().Result;
+                channel = connection.CreateChannelAsync().Result;
+                channel.QueueDeclareAsync(queue: queueName, durable: false, exclusive: false, autoDelete: false, arguments: null);
+                consumer = new AsyncEventingBasicConsumer(channel);
+                channel.QueueBindAsync(queue: "queue_sms_local_send", exchange: "exchange_sms_local_send", routingKey: "sms", arguments: null).Wait();
+                consumer.ReceivedAsync += async (model, ea) =>
+                {
+                    var body = ea.Body.ToArray();
+                    var message = Encoding.UTF8.GetString(body);
+                    try
+                    {
+                        dynamic json = JsonConvert.DeserializeObject(message)!;
+                        Console.WriteLine($"Received JSON: {json}");
+                        string? mobile = json.mobile;
+                        string? code = json.code;
+
+                        if (mobile != null && code != null)
+                        {
+                            Console.WriteLine($"Received mobile: {mobile}, code: {code}");
+                        }
+                        else
+                        {
+                            Console.WriteLine("JSON does not contain 'mobile' or 'code' fields.");
+                        }
+                    }
+                    catch (JsonException ex)
+                    {
+                        Console.WriteLine($"Error deserializing JSON: {ex.Message}");
+                    }
+                    await Task.CompletedTask; // Ensure all code paths return a Task
+                };
+
+
+                channel.BasicConsumeAsync(queue: queueName, autoAck: true, consumer: consumer);
+
+                connection.ConnectionShutdownAsync += async (sender, args) =>
+                {
+                    Console.WriteLine("Connection shut down. Reconnecting...");
+                    await Task.Run(() => Reconnect());
+                };
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine($"Connection error: {ex.Message}. Reconnecting in 5 seconds...");
+                System.Threading.Thread.Sleep(5000);
+                Reconnect();
+            }
+        }
+
+        static void Reconnect()
+        {
+            while (true)
+            {
+                try
+                {
+                    Disconnect();
+                    Connect();
+                    Console.WriteLine("Reconnected successfully.");
+                    break;
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine($"Reconnection failed: {ex.Message}. Retrying in 5 seconds...");
+                    System.Threading.Thread.Sleep(5000);
+                }
+            }
+        }
+
+        static void Disconnect()
+        {
+            if (channel != null && channel.IsOpen)
+            {
+                channel.AbortAsync();
+            }
+            if (connection != null && connection.IsOpen)
+            {
+                connection.Dispose();
+            }
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            textBox1.Text = "";
+            textBox2.Text = "";
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            var phone = textBox1.Text;
+            var text = textBox2.Text;
+            if (string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(text))
+            {
+                MessageBox.Show("Please enter a phone number and message text.");
+                return;
+            }
+            try
+            {
+                // 创建一个 ProcessStartInfo 对象,用于配置要启动的进程
+                ProcessStartInfo psi = new ProcessStartInfo
+                {
+                    //adb shell am start -a android.intent.action.SENDTO -d sms:目标手机号码 --es sms_body "短信内容" --ez exit_on_sent true
+                    FileName = "adb.exe",  // 要启动的程序,这里是命令行解释器
+                    Arguments = " shell am start -a android.intent.action.SENDTO -d sms:" + phone + " --es sms_body \"" + text + "\" --ez exit_on_sent true",  // 传递给 cmd.exe 的参数,/c 表示执行完命令后关闭命令行窗口,dir 是要执行的命令,这里以列出目录内容为例
+                    UseShellExecute = false,  // 不使用系统外壳程序启动进程
+                    RedirectStandardOutput = true,  // 重定向标准输出流,以便获取命令执行结果
+                    CreateNoWindow = true  // 不创建新的命令行窗口
+                };
+
+                // 创建一个 Process 对象并启动进程
+                using (Process process = new Process { StartInfo = psi })
+                {
+                    process.Start();
+
+                    // 读取命令执行的结果
+                    string output = process.StandardOutput.ReadToEnd();
+
+                    // 等待进程执行完毕
+                    process.WaitForExit();
+
+                    // 在文本框中显示命令执行结果
+                    textBox3.Text += output;
+                }
+                Thread.Sleep(2000);
+                ProcessStartInfo psisend = new ProcessStartInfo
+                {
+                    //adb shell am start -a android.intent.action.SENDTO -d sms:目标手机号码 --es sms_body "短信内容" --ez exit_on_sent true
+                    FileName = "adb.exe",  // 要启动的程序,这里是命令行解释器
+                    Arguments = "shell input tap 1010 1414",  // 传递给 cmd.exe 的参数,/c 表示执行完命令后关闭命令行窗口,dir 是要执行的命令,这里以列出目录内容为例
+                    UseShellExecute = false,  // 不使用系统外壳程序启动进程
+                    RedirectStandardOutput = true,  // 重定向标准输出流,以便获取命令执行结果
+                    CreateNoWindow = true  // 不创建新的命令行窗口
+                };
+
+                // 创建一个 Process 对象并启动进程
+                using (Process process = new Process { StartInfo = psisend })
+                {
+                    process.Start();
+
+                    // 读取命令执行的结果
+                    string output = process.StandardOutput.ReadToEnd();
+
+                    // 等待进程执行完毕
+                    process.WaitForExit();
+
+                    // 在文本框中显示命令执行结果
+                    textBox3.Text += output;
+                }
+                sendCount++;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show($"执行命令时发生错误: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
+            }
+        }
+
+        private void timer1_Tick(object sender, EventArgs e)
+        {
+            //检查adb连接
+            //30s 检查一次
+            ProcessStartInfo psi = new ProcessStartInfo
+            {
+                FileName = "adb.exe",
+                Arguments = "devices",
+                UseShellExecute = false,
+                RedirectStandardOutput = true,
+                CreateNoWindow = true
+            };
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            //初始化adb
+        }
+
+        private void button4_Click(object sender, EventArgs e)
+        {
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.net_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox1.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.adb_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox2.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.error_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox3.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.send_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox4.Image = image;
+            }
+            //自检
+            Reconnect();
+            Thread.Sleep(2000);
+            //网络
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.net_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox1.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.adb_1))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox2.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.error_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox3.Image = image;
+            }
+            using (MemoryStream ms = new MemoryStream(Properties.Resources.send_0))
+            {
+                Image image = Image.FromStream(ms);
+
+                // 假设 PictureBox 控件名为 pictureBox1
+                pictureBox4.Image = image;
+            }
+            //adb
+
+        }
+
+        private void button5_Click(object sender, EventArgs e)
+        {
+            //校准屏幕点击
+        }
+
+        private void textBox4_TextChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        private void button6_Click(object sender, EventArgs e)
+        {
+            //统计
+            MessageBox.Show("共发送短信:"+ sendCount);
+        }
+    }
+}

+ 123 - 0
smsdemo/Form1.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!--
+    Microsoft ResX Schema
+
+    Version 2.0
+
+    The primary goals of this format is to allow a simple XML format
+    that is mostly human readable. The generation and parsing of the
+    various data types are done through the TypeConverter classes
+    associated with the data types.
+
+    Example:
+
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+
+    There are any number of "resheader" rows that contain simple
+    name/value pairs.
+
+    Each data row contains a name, and value. The row also contains a
+    type or mimetype. Type corresponds to a .NET class that support
+    text/value conversion through the TypeConverter architecture.
+    Classes that don't support this are serialized and stored with the
+    mimetype set.
+
+    The mimetype is used for serialized objects, and tells the
+    ResXResourceReader how to depersist the object. This is currently not
+    extensible. For a given mimetype the value must be set accordingly:
+
+    Note - application/x-microsoft.net.object.binary.base64 is the format
+    that the ResXResourceWriter will generate, however the reader can
+    read any of the formats listed below.
+
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 17 - 0
smsdemo/Program.cs

@@ -0,0 +1,17 @@
+namespace smsdemo
+{
+    internal static class Program
+    {
+        /// <summary>
+        ///  The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            // To customize application configuration such as set high DPI settings or default font,
+            // see https://aka.ms/applicationconfiguration.
+            ApplicationConfiguration.Initialize();
+            Application.Run(new Form1());
+        }
+    }
+}

+ 143 - 0
smsdemo/Properties/Resources.Designer.cs

@@ -0,0 +1,143 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace smsdemo.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   返回此类使用的缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("smsdemo.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] adb_0 {
+            get {
+                object obj = ResourceManager.GetObject("adb-0", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] adb_1 {
+            get {
+                object obj = ResourceManager.GetObject("adb-1", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] error_0 {
+            get {
+                object obj = ResourceManager.GetObject("error-0", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] error_1 {
+            get {
+                object obj = ResourceManager.GetObject("error-1", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] net_0 {
+            get {
+                object obj = ResourceManager.GetObject("net-0", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] net_1 {
+            get {
+                object obj = ResourceManager.GetObject("net-1", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] send_0 {
+            get {
+                object obj = ResourceManager.GetObject("send-0", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] send_1 {
+            get {
+                object obj = ResourceManager.GetObject("send-1", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+    }
+}

+ 145 - 0
smsdemo/Properties/Resources.resx

@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="adb-0" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\adb-0.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="adb-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\adb-1.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="error-0" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\error-0.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="error-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\error-1.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="net-0" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\net-0.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="net-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\net-1.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="send-0" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\send-0.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="send-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\send-1.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+</root>

BIN
smsdemo/Resources/adb-0.png


BIN
smsdemo/Resources/adb-1.png


BIN
smsdemo/Resources/error-0.png


BIN
smsdemo/Resources/error-1.png


BIN
smsdemo/Resources/net-0.png


BIN
smsdemo/Resources/net-1.png


BIN
smsdemo/Resources/send-0.png


BIN
smsdemo/Resources/send-1.png


BIN
smsdemo/adb-0.png


BIN
smsdemo/adb-1.png


BIN
smsdemo/error-0.png


BIN
smsdemo/error-1.png


BIN
smsdemo/net-0.png


BIN
smsdemo/net-1.png


BIN
smsdemo/send-0.png


BIN
smsdemo/send-1.png


+ 31 - 0
smsdemo/smsdemo.csproj

@@ -0,0 +1,31 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0-windows</TargetFramework>
+    <Nullable>enable</Nullable>
+    <UseWindowsForms>true</UseWindowsForms>
+    <ImplicitUsings>enable</ImplicitUsings>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
+    <PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Properties\Resources.Designer.cs">
+      <DesignTime>True</DesignTime>
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Update="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+  </ItemGroup>
+
+</Project>