| @@ -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 | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -0,0 +1,20 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Windows.Forms; | |||
| namespace StuMgmServer | |||
| { | |||
| static class Program | |||
| { | |||
| /// <summary> | |||
| /// 应用程序的主入口点。 | |||
| /// </summary> | |||
| [STAThread] | |||
| static void Main() | |||
| { | |||
| Application.EnableVisualStyles(); | |||
| Application.SetCompatibleTextRenderingDefault(false); | |||
| Application.Run(new Server()); | |||
| } | |||
| } | |||
| } | |||
| @@ -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")] | |||
| @@ -0,0 +1,63 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本:4.0.30319.42000 | |||
| // | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace StuMgmServer.Properties { | |||
| using System; | |||
| /// <summary> | |||
| /// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
| /// </summary> | |||
| // 此类是由 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() { | |||
| } | |||
| /// <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("StuMgmServer.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; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,117 @@ | |||
| <?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.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: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" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| </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" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| </root> | |||
| @@ -0,0 +1,26 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本:4.0.30319.42000 | |||
| // | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| 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; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version='1.0' encoding='utf-8'?> | |||
| <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> | |||
| <Profiles> | |||
| <Profile Name="(Default)" /> | |||
| </Profiles> | |||
| <Settings /> | |||
| </SettingsFile> | |||
| @@ -0,0 +1,191 @@ | |||
| namespace StuMgmServer | |||
| { | |||
| partial class Server | |||
| { | |||
| /// <summary> | |||
| /// 必需的设计器变量。 | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// 清理所有正在使用的资源。 | |||
| /// </summary> | |||
| /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> | |||
| protected override void Dispose(bool disposing) | |||
| { | |||
| if (disposing && (components != null)) | |||
| { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region Windows 窗体设计器生成的代码 | |||
| /// <summary> | |||
| /// 设计器支持所需的方法 - 不要 | |||
| /// 使用代码编辑器修改此方法的内容。 | |||
| /// </summary> | |||
| 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; | |||
| } | |||
| } | |||
| @@ -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(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,126 @@ | |||
| <?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||
| <value>17, 17</value> | |||
| </metadata> | |||
| <metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||
| <value>159, 17</value> | |||
| </metadata> | |||
| </root> | |||
| @@ -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> CourseStatus; | |||
| } | |||
| #endregion | |||
| #region 学生单题详细信息 | |||
| public class HistoryInfo | |||
| { | |||
| DateTime Time; | |||
| string Describe; | |||
| } | |||
| public class DetailInfo | |||
| { | |||
| public short CourseId; | |||
| public short JobId; | |||
| List<HistoryInfo> Describes; | |||
| } | |||
| #endregion | |||
| class Server | |||
| { | |||
| //List<CourseInfo> 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>(); | |||
| 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<CourseInfo> 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); | |||
| //} | |||
| } | |||
| } | |||
| @@ -0,0 +1,86 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}</ProjectGuid> | |||
| <OutputType>WinExe</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>StuMgmServer</RootNamespace> | |||
| <AssemblyName>StuMgmServer</AssemblyName> | |||
| <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Deployment" /> | |||
| <Reference Include="System.Drawing" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xml" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Server.cs"> | |||
| <SubType>Form</SubType> | |||
| </Compile> | |||
| <Compile Include="Server.Designer.cs"> | |||
| <DependentUpon>Server.cs</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Program.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <Compile Include="StuMgmSer.cs" /> | |||
| <Compile Include="TcpConn.cs" /> | |||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||
| <Generator>ResXFileCodeGenerator</Generator> | |||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
| <SubType>Designer</SubType> | |||
| </EmbeddedResource> | |||
| <Compile Include="Properties\Resources.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Resources.resx</DependentUpon> | |||
| <DesignTime>True</DesignTime> | |||
| </Compile> | |||
| <EmbeddedResource Include="Server.resx"> | |||
| <DependentUpon>Server.cs</DependentUpon> | |||
| </EmbeddedResource> | |||
| <None Include="app.config" /> | |||
| <None Include="Properties\Settings.settings"> | |||
| <Generator>SettingsSingleFileGenerator</Generator> | |||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
| </None> | |||
| <Compile Include="Properties\Settings.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Settings.settings</DependentUpon> | |||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @@ -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; | |||
| /// <summary> | |||
| /// 判断服务器开关 | |||
| /// </summary> | |||
| 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<byte> listDataRecv = new List<byte> { }; // 定义截取列表 | |||
| return reEdPoint + " " + len.ToString(); | |||
| } | |||
| catch // 客户端断开连接 | |||
| { | |||
| return reEdPoint; | |||
| } | |||
| finally | |||
| { | |||
| if (socketClient != null) | |||
| socketClient.Close(); | |||
| } | |||
| } | |||
| #endregion | |||
| } | |||
| } | |||
| @@ -0,0 +1,3 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <configuration> | |||
| <startup><supportedRuntime version="v2.0.50727"/></startup></configuration> | |||