瀏覽代碼

分离类库

Server
Somuns 4 年之前
父節點
當前提交
2fa6565e6d
共有 10 個檔案被更改,包括 151 行新增32 行删除
  1. +19
    -0
      StuMgmServer/StuMgmLib/MyNameSpace/DataAnalyze.cs
  2. +2
    -4
      StuMgmServer/StuMgmLib/MyNameSpace/TcpConn.cs
  3. +36
    -0
      StuMgmServer/StuMgmLib/Properties/AssemblyInfo.cs
  4. +51
    -0
      StuMgmServer/StuMgmLib/StuMgmLib.csproj
  5. +6
    -0
      StuMgmServer/StuMgmServer.sln
  6. +2
    -2
      StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs
  7. +1
    -1
      StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs
  8. +18
    -17
      StuMgmServer/StuMgmServer/Server.Designer.cs
  9. +9
    -6
      StuMgmServer/StuMgmServer/Server.cs
  10. +7
    -2
      StuMgmServer/StuMgmServer/StuMgmServer.csproj

+ 19
- 0
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
}
}
}

StuMgmServer/StuMgmServer/TcpConn.cs → StuMgmServer/StuMgmLib/MyNameSpace/TcpConn.cs 查看文件

@@ -2,12 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Net.Sockets; 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 IPEndPoint IPP = null;
private Socket socket = null; private Socket socket = null;

+ 36
- 0
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")]

+ 51
- 0
StuMgmServer/StuMgmLib/StuMgmLib.csproj 查看文件

@@ -0,0 +1,51 @@
<?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>{725C2786-699E-424F-8F3E-FB5BB4E5A3A5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StuMgmLib</RootNamespace>
<AssemblyName>StuMgmLib</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyNameSpace\DataAnalyze.cs" />
<Compile Include="MyNameSpace\TcpConn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<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>

+ 6
- 0
StuMgmServer/StuMgmServer.sln 查看文件

@@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmServer", "StuMgmServer\StuMgmServer.csproj", "{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmServer", "StuMgmServer\StuMgmServer.csproj", "{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmLib", "StuMgmLib\StuMgmLib.csproj", "{725C2786-699E-424F-8F3E-FB5BB4E5A3A5}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE


+ 2
- 2
StuMgmServer/StuMgmServer/Properties/Resources.Designer.cs 查看文件

@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------


namespace StuMgmServer.Properties {
namespace StuMgmLib.Properties {
using System; using System;
@@ -39,7 +39,7 @@ namespace StuMgmServer.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { 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; resourceMan = temp;
} }
return resourceMan; return resourceMan;


+ 1
- 1
StuMgmServer/StuMgmServer/Properties/Settings.Designer.cs 查看文件

@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------


namespace StuMgmServer.Properties {
namespace StuMgmLib.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]


+ 18
- 17
StuMgmServer/StuMgmServer/Server.Designer.cs 查看文件

@@ -30,6 +30,7 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.tlpAll = new System.Windows.Forms.TableLayoutPanel(); this.tlpAll = new System.Windows.Forms.TableLayoutPanel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.txtPort = new System.Windows.Forms.TextBox(); this.txtPort = new System.Windows.Forms.TextBox();
this.lblSwiSta = new System.Windows.Forms.Label(); this.lblSwiSta = new System.Windows.Forms.Label();
@@ -37,7 +38,6 @@
this.lblPort = new System.Windows.Forms.Label(); this.lblPort = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.tmr = new System.Windows.Forms.Timer(this.components); this.tmr = new System.Windows.Forms.Timer(this.components);
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.tlpAll.SuspendLayout(); this.tlpAll.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@@ -54,10 +54,20 @@
this.tlpAll.Name = "tlpAll"; this.tlpAll.Name = "tlpAll";
this.tlpAll.RowCount = 1; 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.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.Size = new System.Drawing.Size(1075, 413);
this.tlpAll.TabIndex = 0; 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 // tableLayoutPanel1
// //
this.tableLayoutPanel1.ColumnCount = 2; 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.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.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.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.TabIndex = 3;
this.txtPort.Text = "502"; this.txtPort.Text = "502";
this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -102,9 +112,9 @@
// //
this.btnSerSwitch.Dock = System.Windows.Forms.DockStyle.Fill; this.btnSerSwitch.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnSerSwitch.Font = new System.Drawing.Font("Calibri", 10.8F); 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.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.TabIndex = 2;
this.btnSerSwitch.Text = "开启服务器"; this.btnSerSwitch.Text = "开启服务器";
this.btnSerSwitch.UseVisualStyleBackColor = true; this.btnSerSwitch.UseVisualStyleBackColor = true;
@@ -133,19 +143,9 @@
// tmr // tmr
// //
this.tmr.Enabled = true; this.tmr.Enabled = true;
this.tmr.Interval = 1000;
this.tmr.Interval = 500;
this.tmr.Tick += new System.EventHandler(this.tmr_Tick); 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 // Server
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -156,6 +156,7 @@
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "Server"; this.Name = "Server";
this.Text = "Server"; this.Text = "Server";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Server_FormClosed);
this.tlpAll.ResumeLayout(false); this.tlpAll.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();


+ 9
- 6
StuMgmServer/StuMgmServer/Server.cs 查看文件

@@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using StuMgmLib.MyNameSpace;


namespace StuMgmServer namespace StuMgmServer
{ {
@@ -19,6 +15,10 @@ namespace StuMgmServer
{ {
InitializeComponent(); InitializeComponent();
} }
private void Server_FormClosed(object sender, FormClosedEventArgs e)
{
System.Environment.Exit(0);
}
/// <summary> /// <summary>
/// 委托更新界面 /// 委托更新界面
/// </summary> /// </summary>
@@ -35,6 +35,7 @@ namespace StuMgmServer
} }
} }



private void btnSerSwitch_Click(object sender, EventArgs e) private void btnSerSwitch_Click(object sender, EventArgs e)
{ {
bool sFlag = tcpConn.SocketExist; bool sFlag = tcpConn.SocketExist;
@@ -70,10 +71,12 @@ namespace StuMgmServer
if (tcpConn.SocketExist) if (tcpConn.SocketExist)
btnSerSwitch.Text = "关闭服务器"; btnSerSwitch.Text = "关闭服务器";
else else
btnSerSwitch.Text = "开服务器";
btnSerSwitch.Text = "开服务器";
} }








} }
} }

+ 7
- 2
StuMgmServer/StuMgmServer/StuMgmServer.csproj 查看文件

@@ -7,7 +7,7 @@
<ProjectGuid>{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}</ProjectGuid> <ProjectGuid>{8FAF69C1-FEBA-49F5-A247-8FF7A5798673}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StuMgmServer</RootNamespace>
<RootNamespace>StuMgmLib</RootNamespace>
<AssemblyName>StuMgmServer</AssemblyName> <AssemblyName>StuMgmServer</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -50,7 +50,6 @@
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StuMgmSer.cs" /> <Compile Include="StuMgmSer.cs" />
<Compile Include="TcpConn.cs" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -75,6 +74,12 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StuMgmLib\StuMgmLib.csproj">
<Project>{725c2786-699e-424f-8f3e-fb5bb4e5a3a5}</Project>
<Name>StuMgmLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.


Loading…
取消
儲存