| @@ -0,0 +1,39 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.IO; | |||||
| using System.Runtime.Serialization.Formatters.Binary; | |||||
| using System.Text; | |||||
| using System.Data; | |||||
| namespace StuMgmLib.MyNameSpace | |||||
| { | |||||
| public class BinaryED // 序列化与反序列化 | |||||
| { | |||||
| /// <summary> | |||||
| /// 序列化 | |||||
| /// </summary> | |||||
| public static byte[] Serialize<T>(T c) | |||||
| { | |||||
| MemoryStream ms = new MemoryStream(); | |||||
| BinaryFormatter iFormatter = new BinaryFormatter(); | |||||
| iFormatter.Serialize(ms, c); | |||||
| byte[] buf = ms.GetBuffer(); | |||||
| return buf; | |||||
| } | |||||
| /// <summary> | |||||
| /// 反序列化 | |||||
| /// </summary> | |||||
| public static T Deserialize<T>(byte[] buf) | |||||
| { | |||||
| MemoryStream ms = new MemoryStream(buf); | |||||
| BinaryFormatter iFormatter = new BinaryFormatter(); | |||||
| var obj = (T)iFormatter.Deserialize(ms); | |||||
| return obj; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -7,30 +7,77 @@ using System.Windows.Forms; | |||||
| namespace StuMgmLib.MyNameSpace | namespace StuMgmLib.MyNameSpace | ||||
| { | { | ||||
| /// <summary> | |||||
| /// 数据操作 | |||||
| /// </summary> | |||||
| public class DataAnalyze | public class DataAnalyze | ||||
| { | { | ||||
| const string conStr = "data source=localhost; initial catalog=xinje; user id=root; pwd=980505"; | |||||
| public static void GetFunc(byte[] dataRecv) | |||||
| private enum verifyCode : short | |||||
| { | { | ||||
| short account = 01941; | |||||
| string psw = "980505"; | |||||
| bool res = LoginVerify(account, psw); | |||||
| res = !res; | |||||
| error = -1, | |||||
| notFound = -2, | |||||
| admin = 1, | |||||
| teacher = 2, | |||||
| student = 3, | |||||
| } | |||||
| private const string conStr = "data source=localhost; initial catalog=xinje; user id=root; pwd=980505;charset = utf8"; | |||||
| /* Recv: ___________________________________________________________________ | |||||
| * | Account | Password | (SqlOperate) | | |||||
| * |___short_____string______string________________________________________| | |||||
| * Analyze: | |||||
| * Account Permission (SqlOperate) | |||||
| * | |||||
| * Send: ____________________________________________________________________ | |||||
| * | Permission | DataSet | | |||||
| * |___short________DS_______________________________________________________________| | |||||
| */ | |||||
| // 对buf数据处理,判断身份验证还是数据库操作 | |||||
| //switch () | |||||
| //{ | |||||
| // case :break; | |||||
| // case :break; | |||||
| // case :break; | |||||
| // default:break; | |||||
| //} | |||||
| /// <summary> | |||||
| /// 解析ClientSend | |||||
| /// </summary> | |||||
| public static Info.ServerSend ClientSendAnalyze(Info.ClientSend cs) | |||||
| { | |||||
| Info.ServerSend ss = new Info.ServerSend(); | |||||
| ss.permission = LoginVerify(cs.account, cs.password); // 验证身份 | |||||
| if (ss.permission < 0) // 小于0,则权限有误 | |||||
| { | |||||
| ss.ds = null; | |||||
| return ss; | |||||
| } | |||||
| // if(operationCode != 0) | |||||
| // 写数据表操作 | |||||
| // To do sth here ........ | |||||
| string[] tbName; | |||||
| bool stuFlag = false; | |||||
| switch (ss.permission) | |||||
| { | |||||
| case (short)verifyCode.admin: | |||||
| tbName = new string[] { "user_info", "course_info", "user" }; | |||||
| break; | |||||
| case (short)verifyCode.teacher: | |||||
| tbName = new string[] { "user_info", "course_info" }; | |||||
| break; | |||||
| case (short)verifyCode.student: | |||||
| tbName = new string[] { "user_info", "course_info" }; | |||||
| stuFlag = true; break; | |||||
| default: | |||||
| tbName = null; | |||||
| break; | |||||
| } | |||||
| ss.ds = getDataSet(tbName, stuFlag, cs.account); | |||||
| return ss; | |||||
| } | } | ||||
| public static bool LoginVerify(short account, string psw) | |||||
| /// <summary> | |||||
| /// 登录验证,若失败,则返回错误码;若身份验证成功,则返回用户权限; | |||||
| /// </summary> | |||||
| private static short LoginVerify(short account, string psw) | |||||
| { | { | ||||
| short notFound = -1; | |||||
| short error = -2; | |||||
| string qStu = "select * from user where account = " + account + " and password = '" + psw + "'"; | string qStu = "select * from user where account = " + account + " and password = '" + psw + "'"; | ||||
| MySqlConnection con = new MySqlConnection(conStr); | MySqlConnection con = new MySqlConnection(conStr); | ||||
| try | try | ||||
| @@ -39,17 +86,17 @@ namespace StuMgmLib.MyNameSpace | |||||
| MySqlCommand mCmd = new MySqlCommand(qStu, con); | MySqlCommand mCmd = new MySqlCommand(qStu, con); | ||||
| MySqlDataReader mReader = mCmd.ExecuteReader(); | MySqlDataReader mReader = mCmd.ExecuteReader(); | ||||
| if (mReader.HasRows) | if (mReader.HasRows) | ||||
| return true; | |||||
| { | |||||
| mReader.Read(); | |||||
| return mReader.GetInt16("permission"); | |||||
| } | |||||
| else | else | ||||
| return false; | |||||
| //DataTable dt = new DataTable(); | |||||
| //dt.Load(mReader); | |||||
| //Random r = new Random(); | |||||
| return notFound; | |||||
| } | } | ||||
| catch (MySqlException mySqlEx) | catch (MySqlException mySqlEx) | ||||
| { | { | ||||
| MessageBox.Show(mySqlEx.Message); | MessageBox.Show(mySqlEx.Message); | ||||
| return false; | |||||
| return error; | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| @@ -57,32 +104,40 @@ namespace StuMgmLib.MyNameSpace | |||||
| } | } | ||||
| } | } | ||||
| private static DataTable mysqlUse() | |||||
| /// <summary> | |||||
| /// 改 | |||||
| /// </summary> | |||||
| private static void mySqlModify() | |||||
| { | { | ||||
| // mysql Query | |||||
| string key = ""; | |||||
| string para = ""; | |||||
| string qStu = "select * from staffs where "; // 验证登录信息 | |||||
| switch (key) | |||||
| { | |||||
| case "Id": | |||||
| qStu += " Id =" + Convert.ToString(para); | |||||
| break; | |||||
| case "All": | |||||
| qStu = "select * from staffs "; break; | |||||
| default: | |||||
| qStu += key + "= '" + Convert.ToString(para) + "'"; | |||||
| break; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 查 将各表填入dataset | |||||
| /// </summary> | |||||
| private static DataSet getDataSet(string[] tbName, bool stuFlag, int account) | |||||
| { | |||||
| string str = "select * from "; | |||||
| MySqlConnection con = new MySqlConnection(conStr); | MySqlConnection con = new MySqlConnection(conStr); | ||||
| try | try | ||||
| { | { | ||||
| con.Open(); | con.Open(); | ||||
| MySqlCommand mCmd = new MySqlCommand(qStu, con); | |||||
| MySqlDataReader mReader = mCmd.ExecuteReader(); | |||||
| DataTable dt = new DataTable(); | |||||
| dt.Load(mReader); | |||||
| return dt; | |||||
| DataSet ds = new DataSet(); | |||||
| for (int index = 0; index < tbName.Length; index++) | |||||
| { | |||||
| string newStr = str + tbName[index]; | |||||
| if ((stuFlag == true) && (tbName[index] == "user_info")) | |||||
| { | |||||
| newStr += "where job_id = " + account.ToString(); | |||||
| } | |||||
| MySqlCommand mCmd = new MySqlCommand(newStr, con); | |||||
| MySqlDataReader mReader = mCmd.ExecuteReader(); | |||||
| DataTable dt = new DataTable(); | |||||
| dt.Load(mReader); | |||||
| dt.TableName = tbName[index]; | |||||
| ds.Tables.Add(dt); | |||||
| } | |||||
| return ds; | |||||
| } | } | ||||
| catch (MySqlException mySqlEx) | catch (MySqlException mySqlEx) | ||||
| { | { | ||||
| @@ -95,5 +150,8 @@ namespace StuMgmLib.MyNameSpace | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,13 +1,26 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.IO; | |||||
| //using System.Linq; | |||||
| using System.Runtime.Serialization.Formatters.Binary; | |||||
| using System.Text; | |||||
| //using System.Threading.Tasks; | |||||
| using System.Data; | |||||
| namespace StuMgmLib | |||||
| namespace StuMgmLib.MyNameSpace | |||||
| { | { | ||||
| public class Info | |||||
| { | |||||
| [Serializable] | |||||
| public class ClientSend | |||||
| { | |||||
| public short account { get; set; } | |||||
| public string password { get; set; } | |||||
| public string sqlStr { get; set; } | |||||
| } | |||||
| [Serializable] | |||||
| public class ServerSend | |||||
| { | |||||
| public short permission { get; set; } | |||||
| public DataSet ds { get; set; } | |||||
| } | |||||
| } | |||||
| #region 题目信息 | #region 题目信息 | ||||
| [Serializable] | [Serializable] | ||||
| @@ -48,17 +61,17 @@ namespace StuMgmLib | |||||
| #endregion | #endregion | ||||
| #region 学生单题详细信息 | #region 学生单题详细信息 | ||||
| public class HistoryInfo | |||||
| { | |||||
| DateTime Time; | |||||
| string Describe; | |||||
| } | |||||
| public class DetailInfo | |||||
| { | |||||
| public short CourseId; | |||||
| public short JobId; | |||||
| List<HistoryInfo> Describes; | |||||
| } | |||||
| //public class HistoryInfo | |||||
| //{ | |||||
| // DateTime Time; | |||||
| // string Describe; | |||||
| //} | |||||
| //public class DetailInfo | |||||
| //{ | |||||
| // public short CourseId; | |||||
| // public short JobId; | |||||
| // List<HistoryInfo> Describes; | |||||
| //} | |||||
| #endregion | #endregion | ||||
| @@ -81,21 +94,21 @@ namespace StuMgmLib | |||||
| info.CourseStatus.Add(aa); | info.CourseStatus.Add(aa); | ||||
| return BinaryED.Serialize(info); | |||||
| MemoryStream ms = new MemoryStream(); | |||||
| BinaryFormatter iFormatter = new BinaryFormatter(); | |||||
| iFormatter.Serialize(ms, info); | |||||
| byte[] buff = ms.GetBuffer(); | |||||
| return buff; | |||||
| } | } | ||||
| public UserInfo Parse(byte[] bt) | public UserInfo Parse(byte[] bt) | ||||
| { | { | ||||
| MemoryStream ms = new MemoryStream(bt); | |||||
| BinaryFormatter iFormatter = new BinaryFormatter(); | |||||
| UserInfo obj = (UserInfo)iFormatter.Deserialize(ms); | |||||
| return obj; | |||||
| return BinaryED.Deserialize<UserInfo>(bt); | |||||
| //MemoryStream ms = new MemoryStream(bt); | |||||
| //BinaryFormatter iFormatter = new BinaryFormatter(); | |||||
| //UserInfo obj = (UserInfo)iFormatter.Deserialize(ms); | |||||
| //return obj; | |||||
| } | } | ||||
| } | } | ||||
| class StudentInfo | class StudentInfo | ||||
| @@ -1,11 +1,12 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Data; | |||||
| using System.Net; | using System.Net; | ||||
| using System.Net.Sockets; | using System.Net.Sockets; | ||||
| namespace StuMgmLib.MyNameSpace | namespace StuMgmLib.MyNameSpace | ||||
| { | { | ||||
| // 还有一种验证连接方式 Token | |||||
| public class TcpConn | public class TcpConn | ||||
| { | { | ||||
| private IPEndPoint IPP = null; | private IPEndPoint IPP = null; | ||||
| @@ -45,6 +46,9 @@ namespace StuMgmLib.MyNameSpace | |||||
| #endregion | #endregion | ||||
| #region 接收客户端连接 | #region 接收客户端连接 | ||||
| /// <summary> | |||||
| /// 接收客户端连接 | |||||
| /// </summary> | |||||
| public string acceptConnection() | public string acceptConnection() | ||||
| { | { | ||||
| try | try | ||||
| @@ -61,18 +65,25 @@ namespace StuMgmLib.MyNameSpace | |||||
| const int recvTimeOut = 3000; // 设置接收超时时间 | const int recvTimeOut = 3000; // 设置接收超时时间 | ||||
| #region 接收数据 | #region 接收数据 | ||||
| /// <summary> | |||||
| /// 接收数据 | |||||
| /// </summary> | |||||
| public string acpMsg() | public string acpMsg() | ||||
| { | { | ||||
| byte[] arrDataRecv = new byte[4096]; // 定义接收数组 | |||||
| byte[] dataRecv = new byte[4096]; // 定义接收数组 | |||||
| string reEdPoint = ""; | string reEdPoint = ""; | ||||
| try | try | ||||
| { | { | ||||
| reEdPoint = socketClient.RemoteEndPoint.ToString(); | reEdPoint = socketClient.RemoteEndPoint.ToString(); | ||||
| socketClient.ReceiveTimeout = recvTimeOut; | socketClient.ReceiveTimeout = recvTimeOut; | ||||
| int len = socketClient.Receive(arrDataRecv); | |||||
| DataAnalyze.GetFunc(arrDataRecv); // 解析 | |||||
| List<byte> listDataRecv = new List<byte> { }; // 定义截取列表 | |||||
| return reEdPoint + " " + len.ToString() + " 断开连接 \n"; | |||||
| socketClient.Receive(dataRecv); | |||||
| var cs = BinaryED.Deserialize<Info.ClientSend>(dataRecv); | |||||
| Info.ServerSend ss = DataAnalyze.ClientSendAnalyze(cs); | |||||
| byte[] dataSend = BinaryED.Serialize<Info.ServerSend>(ss); | |||||
| socketClient.Send(dataSend); | |||||
| return reEdPoint + " 断开连接 \n"; | |||||
| } | } | ||||
| catch // 客户端断开连接 | catch // 客户端断开连接 | ||||
| { | { | ||||
| @@ -33,7 +33,7 @@ | |||||
| <Prefer32Bit>false</Prefer32Bit> | <Prefer32Bit>false</Prefer32Bit> | ||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> | |||||
| <Reference Include="MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | <SpecificVersion>False</SpecificVersion> | ||||
| <HintPath>..\..\..\MySql.Data.dll</HintPath> | <HintPath>..\..\..\MySql.Data.dll</HintPath> | ||||
| </Reference> | </Reference> | ||||
| @@ -43,6 +43,7 @@ | |||||
| <Reference Include="System.Xml" /> | <Reference Include="System.Xml" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <Compile Include="MyNameSpace\BinaryED.cs" /> | |||||
| <Compile Include="MyNameSpace\DataAnalyze.cs" /> | <Compile Include="MyNameSpace\DataAnalyze.cs" /> | ||||
| <Compile Include="MyNameSpace\StuMgmSer.cs" /> | <Compile Include="MyNameSpace\StuMgmSer.cs" /> | ||||
| <Compile Include="MyNameSpace\TcpConn.cs" /> | <Compile Include="MyNameSpace\TcpConn.cs" /> | ||||
| @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmServer", "StuMgmServe | |||||
| EndProject | EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmLib", "StuMgmLib\StuMgmLib.csproj", "{725C2786-699E-424F-8F3E-FB5BB4E5A3A5}" | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StuMgmLib", "StuMgmLib\StuMgmLib.csproj", "{725C2786-699E-424F-8F3E-FB5BB4E5A3A5}" | ||||
| EndProject | EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}" | |||||
| EndProject | |||||
| Global | Global | ||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
| @@ -21,6 +23,10 @@ Global | |||||
| {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU | ||||
| {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Release|Any CPU.Build.0 = Release|Any CPU | {725C2786-699E-424F-8F3E-FB5BB4E5A3A5}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| {E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| EndGlobalSection | EndGlobalSection | ||||
| GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
| HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
| @@ -8,7 +8,7 @@ namespace StuMgmServer | |||||
| public partial class Server : Form | public partial class Server : Form | ||||
| { | { | ||||
| TcpConn tcpConn = new TcpConn(); | TcpConn tcpConn = new TcpConn(); | ||||
| Thread tAccept = null; | |||||
| Thread tUpdateUi = null; | |||||
| private delegate void SetTextCallback(string text); | private delegate void SetTextCallback(string text); | ||||
| public Server() | public Server() | ||||
| @@ -20,7 +20,7 @@ namespace StuMgmServer | |||||
| System.Environment.Exit(0); | System.Environment.Exit(0); | ||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| /// 委托更新界面 | |||||
| /// 委托:更新界面方法 | |||||
| /// </summary> | /// </summary> | ||||
| private void setText(string text) | private void setText(string text) | ||||
| { | { | ||||
| @@ -35,7 +35,9 @@ namespace StuMgmServer | |||||
| } | } | ||||
| } | } | ||||
| /// <summary> | |||||
| /// btn开关点击事件:开启、关闭服务器 | |||||
| /// </summary> | |||||
| private void btnSerSwitch_Click(object sender, EventArgs e) | private void btnSerSwitch_Click(object sender, EventArgs e) | ||||
| { | { | ||||
| bool sFlag = tcpConn.SocketExist; | bool sFlag = tcpConn.SocketExist; | ||||
| @@ -47,8 +49,8 @@ namespace StuMgmServer | |||||
| { | { | ||||
| int port = Convert.ToInt16(txtPort.Text); | int port = Convert.ToInt16(txtPort.Text); | ||||
| tcpConn.OpenServer(port); | tcpConn.OpenServer(port); | ||||
| tAccept = new Thread(updateHistory); | |||||
| tAccept.Start(); | |||||
| tUpdateUi = new Thread(updateHistory); | |||||
| tUpdateUi.Start(); | |||||
| } | } | ||||
| } | } | ||||
| catch (Exception ep) | catch (Exception ep) | ||||
| @@ -57,6 +59,9 @@ namespace StuMgmServer | |||||
| } | } | ||||
| } | } | ||||
| /// <summary> | |||||
| /// 线程:接收客户端连接,接收数据,数据处理;更新历史界面 | |||||
| /// </summary> | |||||
| private void updateHistory() | private void updateHistory() | ||||
| { | { | ||||
| while (tcpConn.SocketExist) | while (tcpConn.SocketExist) | ||||
| @@ -66,6 +71,9 @@ namespace StuMgmServer | |||||
| } | } | ||||
| } | } | ||||
| /// <summary> | |||||
| /// 定时器更新btn开关服务器 | |||||
| /// </summary> | |||||
| private void tmr_Tick(object sender, EventArgs e) | private void tmr_Tick(object sender, EventArgs e) | ||||
| { | { | ||||
| if (tcpConn.SocketExist) | if (tcpConn.SocketExist) | ||||
| @@ -112,15 +112,15 @@ | |||||
| <value>2.0</value> | <value>2.0</value> | ||||
| </resheader> | </resheader> | ||||
| <resheader name="reader"> | <resheader name="reader"> | ||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | </resheader> | ||||
| <resheader name="writer"> | <resheader name="writer"> | ||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | </resheader> | ||||
| <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||||
| <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||||
| <value>17, 17</value> | <value>17, 17</value> | ||||
| </metadata> | </metadata> | ||||
| <metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||||
| <metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||||
| <value>159, 17</value> | <value>159, 17</value> | ||||
| </metadata> | </metadata> | ||||
| </root> | </root> | ||||
| @@ -0,0 +1,179 @@ | |||||
| namespace Test | |||||
| { | |||||
| partial class Form1 | |||||
| { | |||||
| /// <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.rtxHistory = new System.Windows.Forms.RichTextBox(); | |||||
| this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); | |||||
| this.txtPort = new System.Windows.Forms.TextBox(); | |||||
| this.lblSwiSta = new System.Windows.Forms.Label(); | |||||
| this.btnSerSwitch = new System.Windows.Forms.Button(); | |||||
| this.lblPort = new System.Windows.Forms.Label(); | |||||
| 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 = 2; | |||||
| this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.25581F)); | |||||
| this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 72.74419F)); | |||||
| this.tlpAll.Controls.Add(this.rtxHistory, 0, 0); | |||||
| this.tlpAll.Controls.Add(this.tableLayoutPanel1, 0, 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 = 1; | |||||
| this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); | |||||
| this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 425F)); | |||||
| this.tlpAll.Size = new System.Drawing.Size(965, 425); | |||||
| this.tlpAll.TabIndex = 2; | |||||
| // | |||||
| // rtxHistory | |||||
| // | |||||
| this.rtxHistory.Dock = System.Windows.Forms.DockStyle.Fill; | |||||
| this.rtxHistory.Font = new System.Drawing.Font("Calibri", 10.8F); | |||||
| this.rtxHistory.Location = new System.Drawing.Point(266, 3); | |||||
| this.rtxHistory.Name = "rtxHistory"; | |||||
| this.rtxHistory.Size = new System.Drawing.Size(696, 419); | |||||
| this.rtxHistory.TabIndex = 2; | |||||
| this.rtxHistory.Text = ""; | |||||
| // | |||||
| // tableLayoutPanel1 | |||||
| // | |||||
| this.tableLayoutPanel1.ColumnCount = 2; | |||||
| this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45.8042F)); | |||||
| this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 54.1958F)); | |||||
| 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(257, 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(120, 10); | |||||
| this.txtPort.Name = "txtPort"; | |||||
| this.txtPort.Size = new System.Drawing.Size(134, 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(3, 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(120, 53); | |||||
| this.btnSerSwitch.Name = "btnSerSwitch"; | |||||
| this.btnSerSwitch.Size = new System.Drawing.Size(134, 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(13, 13); | |||||
| this.lblPort.Name = "lblPort"; | |||||
| this.lblPort.Size = new System.Drawing.Size(90, 23); | |||||
| this.lblPort.TabIndex = 0; | |||||
| this.lblPort.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(965, 24); | |||||
| this.menuStrip1.TabIndex = 3; | |||||
| this.menuStrip1.Text = "menuStrip1"; | |||||
| // | |||||
| // tmr | |||||
| // | |||||
| this.tmr.Enabled = true; | |||||
| this.tmr.Interval = 500; | |||||
| this.tmr.Tick += new System.EventHandler(this.tmr_Tick); | |||||
| // | |||||
| // Form1 | |||||
| // | |||||
| this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||||
| this.ClientSize = new System.Drawing.Size(965, 449); | |||||
| this.Controls.Add(this.tlpAll); | |||||
| this.Controls.Add(this.menuStrip1); | |||||
| this.Name = "Form1"; | |||||
| this.Text = "Form1"; | |||||
| 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.RichTextBox rtxHistory; | |||||
| private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; | |||||
| private System.Windows.Forms.TextBox txtPort; | |||||
| private System.Windows.Forms.Label lblSwiSta; | |||||
| private System.Windows.Forms.Button btnSerSwitch; | |||||
| private System.Windows.Forms.Label lblPort; | |||||
| private System.Windows.Forms.MenuStrip menuStrip1; | |||||
| private System.Windows.Forms.Timer tmr; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,90 @@ | |||||
| using System; | |||||
| using System.Threading; | |||||
| using System.Windows.Forms; | |||||
| using StuMgmLib.MyNameSpace; | |||||
| namespace Test | |||||
| { | |||||
| public partial class Form1 : Form | |||||
| { | |||||
| TcpConn tcpConn = new TcpConn(); | |||||
| Thread tUpdateUi = null; | |||||
| private delegate void SetTextCallback(string text); | |||||
| public Form1() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| private void Server_FormClosed(object sender, FormClosedEventArgs e) | |||||
| { | |||||
| System.Environment.Exit(0); | |||||
| } | |||||
| /// <summary> | |||||
| /// 委托:更新界面方法 | |||||
| /// </summary> | |||||
| private void setText(string text) | |||||
| { | |||||
| if (rtxHistory.InvokeRequired) | |||||
| { | |||||
| SetTextCallback method = new SetTextCallback(setText); | |||||
| Invoke(method, new object[] { text }); | |||||
| } | |||||
| else | |||||
| { | |||||
| rtxHistory.Text = text + rtxHistory.Text; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// btn开关点击事件:开启、关闭服务器 | |||||
| /// </summary> | |||||
| private void btnSerSwitch_Click(object sender, EventArgs e) | |||||
| { | |||||
| bool sFlag = tcpConn.SocketExist; | |||||
| try | |||||
| { | |||||
| if (sFlag == true) | |||||
| tcpConn.CloseServer(); | |||||
| else if (sFlag != true) | |||||
| { | |||||
| int port = Convert.ToInt16(txtPort.Text); | |||||
| tcpConn.OpenServer(port); | |||||
| tUpdateUi = new Thread(updateHistory); | |||||
| tUpdateUi.Start(); | |||||
| } | |||||
| } | |||||
| catch (Exception ep) | |||||
| { | |||||
| MessageBox.Show(ep.Message); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 线程:接收客户端连接,接收数据,数据处理;更新历史界面 | |||||
| /// </summary> | |||||
| private void updateHistory() | |||||
| { | |||||
| while (tcpConn.SocketExist) | |||||
| { | |||||
| setText(tcpConn.acceptConnection()); | |||||
| setText(tcpConn.acpMsg()); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 定时器更新btn开关服务器 | |||||
| /// </summary> | |||||
| private void tmr_Tick(object sender, EventArgs e) | |||||
| { | |||||
| if (tcpConn.SocketExist) | |||||
| btnSerSwitch.Text = "关闭服务器"; | |||||
| else | |||||
| btnSerSwitch.Text = "开启服务器"; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -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>242, 17</value> | |||||
| </metadata> | |||||
| <metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||||
| <value>384, 17</value> | |||||
| </metadata> | |||||
| </root> | |||||
| @@ -0,0 +1,20 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Windows.Forms; | |||||
| namespace Test | |||||
| { | |||||
| static class Program | |||||
| { | |||||
| /// <summary> | |||||
| /// 应用程序的主入口点。 | |||||
| /// </summary> | |||||
| [STAThread] | |||||
| static void Main() | |||||
| { | |||||
| Application.EnableVisualStyles(); | |||||
| Application.SetCompatibleTextRenderingDefault(false); | |||||
| Application.Run(new Form1()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| using System.Reflection; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| // 有关程序集的常规信息通过以下 | |||||
| // 特性集控制。更改这些特性值可修改 | |||||
| // 与程序集关联的信息。 | |||||
| [assembly: AssemblyTitle("Test")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("")] | |||||
| [assembly: AssemblyProduct("Test")] | |||||
| [assembly: AssemblyCopyright("Copyright © 2021")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||||
| // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | |||||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||||
| [assembly: ComVisible(false)] | |||||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||||
| [assembly: Guid("39f78726-24f8-499a-86d5-1758f9b27e0f")] | |||||
| // 程序集的版本信息由下面四个值组成: | |||||
| // | |||||
| // 主版本 | |||||
| // 次版本 | |||||
| // 生成号 | |||||
| // 修订号 | |||||
| // | |||||
| // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | |||||
| // 方法是按如下所示使用“*”: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||||
| @@ -0,0 +1,71 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // 此代码由工具生成。 | |||||
| // 运行时版本: 4.0.30319.42000 | |||||
| // | |||||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||||
| // 重新生成代码,这些更改将丢失。 | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace Test.Properties | |||||
| { | |||||
| /// <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 ((resourceMan == null)) | |||||
| { | |||||
| global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.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,30 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // This code was generated by a tool. | |||||
| // Runtime Version:4.0.30319.42000 | |||||
| // | |||||
| // Changes to this file may cause incorrect behavior and will be lost if | |||||
| // the code is regenerated. | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace Test.Properties | |||||
| { | |||||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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,87 @@ | |||||
| <?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>{E3D7C7F1-F922-4C6B-A44A-86F4DC73951A}</ProjectGuid> | |||||
| <OutputType>WinExe</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>Test</RootNamespace> | |||||
| <AssemblyName>Test</AssemblyName> | |||||
| <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| </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="Form1.cs"> | |||||
| <SubType>Form</SubType> | |||||
| </Compile> | |||||
| <Compile Include="Form1.Designer.cs"> | |||||
| <DependentUpon>Form1.cs</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Program.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| <EmbeddedResource Include="Form1.resx"> | |||||
| <DependentUpon>Form1.cs</DependentUpon> | |||||
| </EmbeddedResource> | |||||
| <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> | |||||
| </Compile> | |||||
| <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> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\StuMgmLib\StuMgmLib.csproj"> | |||||
| <Project>{725c2786-699e-424f-8f3e-fb5bb4e5a3a5}</Project> | |||||
| <Name>StuMgmLib</Name> | |||||
| </ProjectReference> | |||||
| </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> | |||||