diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7964536
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,189 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+x64/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Roslyn cache directories
+*.ide/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+#NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding addin-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+## TODO: Comment the next line if you want to checkin your
+## web deploy settings but do note that will include unencrypted
+## passwords
+#*.pubxml
+
+# NuGet Packages Directory
+packages/*
+## TODO: If the tool you use requires repositories.config
+## uncomment the next line
+#!packages/repositories.config
+
+# Enable "build/" folder in the NuGet Packages folder since
+# NuGet packages use it for MSBuild targets.
+# This line needs to be after the ignore of the build folder
+# (and the packages folder if the line above has been uncommented)
+!packages/build/
+
+# Windows Azure Build Output
+csx/
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# LightSwitch generated files
+GeneratedArtifacts/
+_Pvt_Extensions/
+ModelManifest.xml
\ No newline at end of file
diff --git a/MgmSys/MgmSys.sln b/MgmSys/MgmSys.sln
new file mode 100644
index 0000000..abb2cab
--- /dev/null
+++ b/MgmSys/MgmSys.sln
@@ -0,0 +1,44 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.40629.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgmSysApp", "MgmSysApp\MgmSysApp.csproj", "{8924FC9E-8A06-4971-A717-20B5371C3F9C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStuMgmSysLib", "MyStuMgmSysLib\MyStuMgmSysLib.csproj", "{3AA339B4-AD71-4674-8BBE-FDD69F963AE8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Win32 = Debug|Win32
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Debug|Win32.ActiveCfg = Debug|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {8924FC9E-8A06-4971-A717-20B5371C3F9C}.Release|Win32.ActiveCfg = Release|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Debug|Win32.ActiveCfg = Debug|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {3AA339B4-AD71-4674-8BBE-FDD69F963AE8}.Release|Win32.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/StuMgmServer/StuMgmServer.sln b/StuMgmServer/StuMgmServer.sln
new file mode 100644
index 0000000..2057fc7
--- /dev/null
+++ b/StuMgmServer/StuMgmServer.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+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
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8FAF69C1-FEBA-49F5-A247-8FF7A5798673}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {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
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/StuMgmServer/StuMgmServer/Program.cs b/StuMgmServer/StuMgmServer/Program.cs
new file mode 100644
index 0000000..e30760c
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Program.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace StuMgmServer
+{
+ static class Program
+ {
+ ///
+ /// 应用程序的主入口点。
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Server());
+ }
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/Properties/AssemblyInfo.cs b/StuMgmServer/StuMgmServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..32a5a8b
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的常规信息通过以下
+// 特性集控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("StuMgmServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("StuMgmServer")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 使此程序集中的类型
+// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
+// 则将该类型上的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("cbf3a81f-7eff-4135-9b1f-63410d9b3a96")]
+
+// 程序集的版本信息由下面四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs b/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..41aa7be
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace StuMgmServer.Properties {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [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("StuMgmServer.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 使用此强类型资源类,为所有资源查找
+ /// 重写当前线程的 CurrentUICulture 属性。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/Properties/Resources.resx b/StuMgmServer/StuMgmServer/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs b/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..63de5fc
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace StuMgmServer.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/Properties/Settings.settings b/StuMgmServer/StuMgmServer/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/StuMgmServer/StuMgmServer/Server.Designer.cs b/StuMgmServer/StuMgmServer/Server.Designer.cs
new file mode 100644
index 0000000..e7d47c6
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Server.Designer.cs
@@ -0,0 +1,191 @@
+namespace StuMgmServer
+{
+ partial class Server
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows 窗体设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.tlpAll = new System.Windows.Forms.TableLayoutPanel();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.txtPort = new System.Windows.Forms.TextBox();
+ this.lblSwiSta = new System.Windows.Forms.Label();
+ this.btnSerSwitch = new System.Windows.Forms.Button();
+ this.lblPort = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
+ this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.tmr = new System.Windows.Forms.Timer(this.components);
+ this.tlpAll.SuspendLayout();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tlpAll
+ //
+ this.tlpAll.ColumnCount = 4;
+ this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
+ this.tlpAll.Controls.Add(this.tableLayoutPanel1, 0, 0);
+ this.tlpAll.Controls.Add(this.button1, 1, 0);
+ this.tlpAll.Controls.Add(this.richTextBox1, 2, 0);
+ this.tlpAll.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tlpAll.Location = new System.Drawing.Point(0, 24);
+ this.tlpAll.Name = "tlpAll";
+ this.tlpAll.RowCount = 2;
+ this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tlpAll.Size = new System.Drawing.Size(1114, 486);
+ this.tlpAll.TabIndex = 0;
+ //
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.ColumnCount = 2;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.Controls.Add(this.txtPort, 1, 0);
+ this.tableLayoutPanel1.Controls.Add(this.lblSwiSta, 0, 1);
+ this.tableLayoutPanel1.Controls.Add(this.btnSerSwitch, 1, 1);
+ this.tableLayoutPanel1.Controls.Add(this.lblPort, 0, 0);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 2;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(272, 100);
+ this.tableLayoutPanel1.TabIndex = 0;
+ //
+ // txtPort
+ //
+ 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(139, 10);
+ this.txtPort.Name = "txtPort";
+ this.txtPort.Size = new System.Drawing.Size(130, 29);
+ this.txtPort.TabIndex = 3;
+ this.txtPort.Text = "502";
+ this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ //
+ // lblSwiSta
+ //
+ this.lblSwiSta.Anchor = System.Windows.Forms.AnchorStyles.None;
+ this.lblSwiSta.AutoSize = true;
+ this.lblSwiSta.Font = new System.Drawing.Font("Calibri", 10.8F);
+ this.lblSwiSta.Location = new System.Drawing.Point(13, 63);
+ this.lblSwiSta.Name = "lblSwiSta";
+ this.lblSwiSta.Size = new System.Drawing.Size(110, 23);
+ this.lblSwiSta.TabIndex = 1;
+ this.lblSwiSta.Text = "服务器状态";
+ //
+ // btnSerSwitch
+ //
+ 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(139, 53);
+ this.btnSerSwitch.Name = "btnSerSwitch";
+ this.btnSerSwitch.Size = new System.Drawing.Size(130, 44);
+ this.btnSerSwitch.TabIndex = 2;
+ this.btnSerSwitch.Text = "开启服务器";
+ this.btnSerSwitch.UseVisualStyleBackColor = true;
+ this.btnSerSwitch.Click += new System.EventHandler(this.btnSerSwitch_Click);
+ //
+ // lblPort
+ //
+ this.lblPort.Anchor = System.Windows.Forms.AnchorStyles.None;
+ this.lblPort.AutoSize = true;
+ this.lblPort.Font = new System.Drawing.Font("Calibri", 10.8F);
+ this.lblPort.Location = new System.Drawing.Point(23, 13);
+ this.lblPort.Name = "lblPort";
+ this.lblPort.Size = new System.Drawing.Size(90, 23);
+ this.lblPort.TabIndex = 0;
+ this.lblPort.Text = "本地端口";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(281, 3);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(207, 100);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "button1";
+ this.button1.UseVisualStyleBackColor = true;
+ //
+ // richTextBox1
+ //
+ this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.richTextBox1.Location = new System.Drawing.Point(559, 3);
+ this.richTextBox1.Name = "richTextBox1";
+ this.richTextBox1.Size = new System.Drawing.Size(272, 237);
+ this.richTextBox1.TabIndex = 1;
+ this.richTextBox1.Text = "";
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1114, 24);
+ this.menuStrip1.TabIndex = 1;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // tmr
+ //
+ this.tmr.Enabled = true;
+ //
+ // Server
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1114, 510);
+ this.Controls.Add(this.tlpAll);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "Server";
+ this.Text = "Server";
+ this.tlpAll.ResumeLayout(false);
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TableLayoutPanel tlpAll;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.Label lblSwiSta;
+ private System.Windows.Forms.RichTextBox richTextBox1;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.Button btnSerSwitch;
+ private System.Windows.Forms.Label lblPort;
+ private System.Windows.Forms.TextBox txtPort;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Timer tmr;
+ }
+}
+
diff --git a/StuMgmServer/StuMgmServer/Server.cs b/StuMgmServer/StuMgmServer/Server.cs
new file mode 100644
index 0000000..c1fbfbd
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Server.cs
@@ -0,0 +1,67 @@
+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;
+
+namespace StuMgmServer
+{
+ public partial class Server : Form
+ {
+ TcpConn tcpConn = new TcpConn();
+ Thread tAccept = null;
+
+ private delegate void SetTextCallbakc();
+ public Server()
+ {
+ InitializeComponent();
+ //CheckForIllegalCrossThreadCalls = false;
+ }
+
+ //具体要调用的方面
+ private void callbakc()
+ {
+ richTextBox1.Text += tcpConn.acceptConnection() + " Connected \n";
+ richTextBox1.Text += tcpConn.acpMsg() + " Disconnected \n";
+ }
+
+ private void btnSerSwitch_Click(object sender, EventArgs e)
+ {
+ bool sFlag = tcpConn.SocketExist;
+ try
+ {
+ if (sFlag == true)
+ tcpConn.CloseServer();
+ else if (sFlag != true)
+ {
+ tcpConn.OpenServer(Convert.ToInt16(txtPort.Text));
+
+ //test();
+ tAccept = new Thread(newTest);
+ tAccept.Start();
+
+ }
+ }
+ catch (Exception ep)
+ {
+ MessageBox.Show(ep.Message);
+ }
+ }
+ private void newTest()
+ {
+ SetTextCallbakc stcb = new SetTextCallbakc(callbakc);
+ while (true)
+ {
+ Invoke(stcb);
+ //callbakc();
+ }
+ }
+
+
+
+
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/Server.resx b/StuMgmServer/StuMgmServer/Server.resx
new file mode 100644
index 0000000..f769c72
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/Server.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 159, 17
+
+
\ No newline at end of file
diff --git a/StuMgmServer/StuMgmServer/StuMgmSer.cs b/StuMgmServer/StuMgmServer/StuMgmSer.cs
new file mode 100644
index 0000000..286b0b6
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/StuMgmSer.cs
@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+//using System.Linq;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+//using System.Threading.Tasks;
+
+namespace ConsoleApplication1
+{
+
+ #region 题目信息
+ public class CourseInfo
+ {
+ public short Id;
+ public short Pid;
+ public int Time;
+ public string Name;
+ public string Content;
+ }
+ #endregion
+
+ #region 学生题目信息一览
+ [Serializable]
+ public enum CourseStatusEnum
+ {
+ undo, // 未开始
+ doing, // 进行中
+ waiting, // 等待验收
+ failed, // 验收失败
+ preSharing, // 准备分享
+ pass // 验收通过
+ }
+ [Serializable]
+ public class CourseStatus
+ {
+ public short CourseId;
+ public CourseStatusEnum Status;
+ }
+ [Serializable]
+ public class UserInfo
+ {
+ public short JobId;
+ public string Name;
+ public List CourseStatus;
+ }
+ #endregion
+
+ #region 学生单题详细信息
+ public class HistoryInfo
+ {
+ DateTime Time;
+ string Describe;
+ }
+ public class DetailInfo
+ {
+ public short CourseId;
+ public short JobId;
+ List Describes;
+ }
+ #endregion
+
+
+
+ class Server
+ {
+ //List GetCourseInfo();
+ //UserInfo GetUserInfo(short jobId);
+ //DetailInfo GetDetailInfo(short jobId, short courseId);
+
+ public byte[] GetUser(short jobId)
+ {
+ UserInfo info = new UserInfo();
+ info.JobId = 111;
+ info.Name = "aaaa";
+ info.CourseStatus = new List();
+ CourseStatus aa = new CourseStatus();
+ aa.CourseId = 222;
+ aa.Status = CourseStatusEnum.undo; // 做题状态
+ info.CourseStatus.Add(aa);
+
+
+
+ MemoryStream ms = new MemoryStream();
+ BinaryFormatter iFormatter = new BinaryFormatter();
+ iFormatter.Serialize(ms, info);
+ byte[] buff = ms.GetBuffer();
+ return buff;
+ }
+
+ public UserInfo Prase(byte[] bt)
+ {
+ MemoryStream ms = new MemoryStream(bt);
+ BinaryFormatter iFormatter = new BinaryFormatter();
+ UserInfo obj = (UserInfo)iFormatter.Deserialize(ms);
+ return obj;
+ }
+
+
+
+ }
+
+
+ class StudentInfo
+ {
+ //List GetCourseInfo();
+ //UserInfo GetUserInfo(short jobId);
+ //DetailInfo GetDetailInfo(short jobId, short courseId);
+ }
+
+
+ class Program
+ {
+ //static void Main(string[] args)
+ //{
+ // Server s = new Server();
+ // byte[] buf = s.GetUser(0);
+ // UserInfo aa = s.Prase(buf);
+ //}
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/StuMgmServer.csproj b/StuMgmServer/StuMgmServer/StuMgmServer.csproj
new file mode 100644
index 0000000..8d2f07d
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/StuMgmServer.csproj
@@ -0,0 +1,86 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {8FAF69C1-FEBA-49F5-A247-8FF7A5798673}
+ WinExe
+ Properties
+ StuMgmServer
+ StuMgmServer
+ v2.0
+ 512
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Server.cs
+
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ Server.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
\ No newline at end of file
diff --git a/StuMgmServer/StuMgmServer/TcpConn.cs b/StuMgmServer/StuMgmServer/TcpConn.cs
new file mode 100644
index 0000000..c08814c
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/TcpConn.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace StuMgmServer
+{
+ class TcpConn
+ {
+ private IPEndPoint IPP = null;
+ private Socket socket = null;
+ private Socket socketClient = null;
+ //private Thread tAccept = null;
+
+ #region 连接状态字段
+ private bool my_connect = false;
+ public bool Connect
+ {
+ get { return my_connect; }
+ set { my_connect = value; }
+ }
+ #endregion
+
+ private bool my_SocketExist = false;
+ ///
+ /// 判断服务器开关
+ ///
+ public bool SocketExist
+ {
+ get { return my_SocketExist; }
+ private set { my_SocketExist = value; }
+ }
+
+ #region 开启服务器
+ public void OpenServer(int port)
+ {
+ IPP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port);
+ socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ socket.Bind(IPP);
+ socket.Listen(0);
+ SocketExist = true;
+ }
+ #endregion
+
+ #region 关闭服务器
+ public void CloseServer()
+ {
+ if (socketClient != null)
+ socketClient.Close();
+ if (socket != null)
+ socket.Close();
+ SocketExist = false;
+ }
+ #endregion
+
+ #region 接收客户端连接
+ public EndPoint acceptConnection()
+ {
+ try
+ {
+ socketClient = socket.Accept(); // 阻塞等待客户端连接
+ return socketClient.RemoteEndPoint;
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+ #endregion
+
+ #region 接收数据
+ public string acpMsg()
+ {
+ byte[] arrDataRecv = new byte[1024]; // 定义接收数组
+ string reEdPoint = socketClient.RemoteEndPoint.ToString();
+ try
+ {
+ int len = socketClient.Receive(arrDataRecv);
+ List listDataRecv = new List { }; // 定义截取列表
+ return reEdPoint + " " + len.ToString();
+ }
+ catch // 客户端断开连接
+ {
+ return reEdPoint;
+ }
+ finally
+ {
+ if (socketClient != null)
+ socketClient.Close();
+ }
+ }
+ #endregion
+
+
+
+
+
+
+ }
+}
diff --git a/StuMgmServer/StuMgmServer/app.config b/StuMgmServer/StuMgmServer/app.config
new file mode 100644
index 0000000..2fa6e95
--- /dev/null
+++ b/StuMgmServer/StuMgmServer/app.config
@@ -0,0 +1,3 @@
+
+
+