From 2fa6565e6db6bfa020f09a08158de4068e313733 Mon Sep 17 00:00:00 2001 From: Somuns Date: Sun, 10 Jan 2021 18:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=E7=B1=BB=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StuMgmLib/MyNameSpace/DataAnalyze.cs | 19 +++++++ .../MyNameSpace}/TcpConn.cs | 6 +-- .../StuMgmLib/Properties/AssemblyInfo.cs | 36 +++++++++++++ StuMgmServer/StuMgmLib/StuMgmLib.csproj | 51 +++++++++++++++++++ StuMgmServer/StuMgmServer.sln | 6 +++ .../Properties/Resources.Designer.cs | 4 +- .../Properties/Settings.Designer.cs | 2 +- StuMgmServer/StuMgmServer/Server.Designer.cs | 35 ++++++------- StuMgmServer/StuMgmServer/Server.cs | 15 +++--- StuMgmServer/StuMgmServer/StuMgmServer.csproj | 9 +++- 10 files changed, 151 insertions(+), 32 deletions(-) create mode 100644 StuMgmServer/StuMgmLib/MyNameSpace/DataAnalyze.cs rename StuMgmServer/{StuMgmServer => StuMgmLib/MyNameSpace}/TcpConn.cs (96%) create mode 100644 StuMgmServer/StuMgmLib/Properties/AssemblyInfo.cs create mode 100644 StuMgmServer/StuMgmLib/StuMgmLib.csproj diff --git a/StuMgmServer/StuMgmLib/MyNameSpace/DataAnalyze.cs b/StuMgmServer/StuMgmLib/MyNameSpace/DataAnalyze.cs new file mode 100644 index 0000000..6a5d101 --- /dev/null +++ b/StuMgmServer/StuMgmLib/MyNameSpace/DataAnalyze.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StuMgmLib.MyNameSpace +{ + public class DataAnalyze + { + public void Analyze(byte[] data) + { + + } + + private void mysqlUse() + { + // mysql Query + } + } +} diff --git a/StuMgmServer/StuMgmServer/TcpConn.cs b/StuMgmServer/StuMgmLib/MyNameSpace/TcpConn.cs similarity index 96% rename from StuMgmServer/StuMgmServer/TcpConn.cs rename to StuMgmServer/StuMgmLib/MyNameSpace/TcpConn.cs index 8be32ec..c3e39ab 100644 --- a/StuMgmServer/StuMgmServer/TcpConn.cs +++ b/StuMgmServer/StuMgmLib/MyNameSpace/TcpConn.cs @@ -2,12 +2,10 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; -using System.Threading; -using System.Windows.Forms; -namespace StuMgmServer +namespace StuMgmLib.MyNameSpace { - class TcpConn + public class TcpConn { private IPEndPoint IPP = null; private Socket socket = null; diff --git a/StuMgmServer/StuMgmLib/Properties/AssemblyInfo.cs b/StuMgmServer/StuMgmLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ea1cb5 --- /dev/null +++ b/StuMgmServer/StuMgmLib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("StuMgmLib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("StuMgmLib")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("5a1ece4d-8a5f-4502-b80b-47fd1cb2d8d7")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StuMgmServer/StuMgmLib/StuMgmLib.csproj b/StuMgmServer/StuMgmLib/StuMgmLib.csproj new file mode 100644 index 0000000..ce1eb55 --- /dev/null +++ b/StuMgmServer/StuMgmLib/StuMgmLib.csproj @@ -0,0 +1,51 @@ + + + + + Debug + AnyCPU + {725C2786-699E-424F-8F3E-FB5BB4E5A3A5} + Library + Properties + StuMgmLib + StuMgmLib + v2.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StuMgmServer/StuMgmServer.sln b/StuMgmServer/StuMgmServer.sln index 2057fc7..70a6d25 100644 --- a/StuMgmServer/StuMgmServer.sln +++ b/StuMgmServer/StuMgmServer.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmServer", "StuMgmServer\StuMgmServer.csproj", "{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmLib", "StuMgmLib\StuMgmLib.csproj", "{725C2786-699E-424F-8F3E-FB5BB4E5A3A5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {8FAF69C1-FEBA-49F5-A247-8FF7A5798673}.Debug|Any CPU.Build.0 = Debug|Any CPU {8FAF69C1-FEBA-49F5-A247-8FF7A5798673}.Release|Any CPU.ActiveCfg = Release|Any CPU {8FAF69C1-FEBA-49F5-A247-8FF7A5798673}.Release|Any CPU.Build.0 = Release|Any CPU + {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs b/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs index 41aa7be..be9d6d4 100644 --- a/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs +++ b/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace StuMgmServer.Properties { +namespace StuMgmLib.Properties { using System; @@ -39,7 +39,7 @@ namespace StuMgmServer.Properties { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StuMgmServer.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StuMgmLib.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs b/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs index 63de5fc..9b8e969 100644 --- a/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs +++ b/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace StuMgmServer.Properties { +namespace StuMgmLib.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/StuMgmServer/StuMgmServer/Server.Designer.cs b/StuMgmServer/StuMgmServer/Server.Designer.cs index db1b641..ea89c5c 100644 --- a/StuMgmServer/StuMgmServer/Server.Designer.cs +++ b/StuMgmServer/StuMgmServer/Server.Designer.cs @@ -30,6 +30,7 @@ { this.components = new System.ComponentModel.Container(); this.tlpAll = new System.Windows.Forms.TableLayoutPanel(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.txtPort = new System.Windows.Forms.TextBox(); this.lblSwiSta = new System.Windows.Forms.Label(); @@ -37,7 +38,6 @@ this.lblPort = new System.Windows.Forms.Label(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.tmr = new System.Windows.Forms.Timer(this.components); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.tlpAll.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -54,10 +54,20 @@ this.tlpAll.Name = "tlpAll"; this.tlpAll.RowCount = 1; this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 413F)); this.tlpAll.Size = new System.Drawing.Size(1075, 413); this.tlpAll.TabIndex = 0; // + // richTextBox1 + // + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Font = new System.Drawing.Font("Calibri", 10.8F); + this.richTextBox1.Location = new System.Drawing.Point(295, 3); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(777, 407); + this.richTextBox1.TabIndex = 2; + this.richTextBox1.Text = ""; + // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 2; @@ -80,9 +90,9 @@ // this.txtPort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.txtPort.Font = new System.Drawing.Font("Calibri", 10.8F); - this.txtPort.Location = new System.Drawing.Point(133, 10); + this.txtPort.Location = new System.Drawing.Point(134, 10); this.txtPort.Name = "txtPort"; - this.txtPort.Size = new System.Drawing.Size(150, 29); + this.txtPort.Size = new System.Drawing.Size(149, 29); this.txtPort.TabIndex = 3; this.txtPort.Text = "502"; this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; @@ -102,9 +112,9 @@ // this.btnSerSwitch.Dock = System.Windows.Forms.DockStyle.Fill; this.btnSerSwitch.Font = new System.Drawing.Font("Calibri", 10.8F); - this.btnSerSwitch.Location = new System.Drawing.Point(133, 53); + this.btnSerSwitch.Location = new System.Drawing.Point(134, 53); this.btnSerSwitch.Name = "btnSerSwitch"; - this.btnSerSwitch.Size = new System.Drawing.Size(150, 44); + this.btnSerSwitch.Size = new System.Drawing.Size(149, 44); this.btnSerSwitch.TabIndex = 2; this.btnSerSwitch.Text = "开启服务器"; this.btnSerSwitch.UseVisualStyleBackColor = true; @@ -133,19 +143,9 @@ // tmr // this.tmr.Enabled = true; - this.tmr.Interval = 1000; + this.tmr.Interval = 500; this.tmr.Tick += new System.EventHandler(this.tmr_Tick); // - // richTextBox1 - // - this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBox1.Font = new System.Drawing.Font("Calibri", 10.8F); - this.richTextBox1.Location = new System.Drawing.Point(295, 3); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(777, 407); - this.richTextBox1.TabIndex = 2; - this.richTextBox1.Text = ""; - // // Server // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); @@ -156,6 +156,7 @@ this.MainMenuStrip = this.menuStrip1; this.Name = "Server"; this.Text = "Server"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Server_FormClosed); this.tlpAll.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); diff --git a/StuMgmServer/StuMgmServer/Server.cs b/StuMgmServer/StuMgmServer/Server.cs index dc6f65d..5ce076f 100644 --- a/StuMgmServer/StuMgmServer/Server.cs +++ b/StuMgmServer/StuMgmServer/Server.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Threading; using System.Windows.Forms; +using StuMgmLib.MyNameSpace; namespace StuMgmServer { @@ -19,6 +15,10 @@ namespace StuMgmServer { InitializeComponent(); } + private void Server_FormClosed(object sender, FormClosedEventArgs e) + { + System.Environment.Exit(0); + } /// /// 委托更新界面 /// @@ -35,6 +35,7 @@ namespace StuMgmServer } } + private void btnSerSwitch_Click(object sender, EventArgs e) { bool sFlag = tcpConn.SocketExist; @@ -70,10 +71,12 @@ namespace StuMgmServer if (tcpConn.SocketExist) btnSerSwitch.Text = "关闭服务器"; else - btnSerSwitch.Text = "打开服务器"; + btnSerSwitch.Text = "开启服务器"; } + + } } diff --git a/StuMgmServer/StuMgmServer/StuMgmServer.csproj b/StuMgmServer/StuMgmServer/StuMgmServer.csproj index 8d2f07d..f9db7cd 100644 --- a/StuMgmServer/StuMgmServer/StuMgmServer.csproj +++ b/StuMgmServer/StuMgmServer/StuMgmServer.csproj @@ -7,7 +7,7 @@ {8FAF69C1-FEBA-49F5-A247-8FF7A5798673} WinExe Properties - StuMgmServer + StuMgmLib StuMgmServer v2.0 512 @@ -50,7 +50,6 @@ - ResXFileCodeGenerator Resources.Designer.cs @@ -75,6 +74,12 @@ True + + + {725c2786-699e-424f-8f3e-fb5bb4e5a3a5} + StuMgmLib + +