Files
ClientServerProject/CommonLibrary/HeadCode.cs

128 lines
5.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CommonLibrary
{
/// <summary>
/// 用于网络通信的二级协议头说明
/// </summary>
public class CommonHeadCode
{
/************************************************************************************************
*
* 注意您在准备二次开发时应该重新生成一个自己的GUID码
*
**************************************************************************************************/
/// <summary>
/// 用于同步和异步的网络的身份令牌,提升安全性
/// </summary>
public static Guid KeyToken { get; set; } = new Guid("1275BB9A-14B2-4A96-9673-B0AF0463D474");
/// <summary>
/// 同步通信的指令头说明以10000开头后面接2000030000
/// </summary>
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
public class SimplifyHeadCode
{
/// <summary>
/// 判断指令否是系统指令
/// </summary>
/// <param name="customer">指令</param>
/// <returns>是否符合</returns>
public static bool IsCustomerGroupSystem(int customer)
{
return (customer >= 10000 && customer < 11000);
}
public static int { get; } = 10000;//10000开始的表明是系统相关的
public static int { get; } = 10001;
public static int { get; } = 10002;
public static int { get; } = 10003;
public static int { get; } = 10004;
public static int { get; } = 10005;
public static int { get; } = 10006;
public static int { get; } = 10007;
public static int { get; } = 10008;
public static int { get; } = 10009;
public static int { get; } = 10010;
public static int { get; } = 10011;
public static int { get; } = 10012;
public static int { get; } = 10013;
public static int { get; } = 10014;
/// <summary>
/// 判断指令否是日志相关指令
/// </summary>
/// <param name="customer">指令</param>
/// <returns>是否符合</returns>
public static bool IsCustomerGroupLogging(int customer)
{
return (customer >= 11000 && customer < 12000);
}
public static int { get; } = 11000;//11000开头的是日志请求和清空
public static int { get; } = 11001;
public static int { get; } = 11002;
public static int { get; } = 11003;
public static int { get; } = 11004;
public static int { get; } = 11005;
public static int { get; } = 11006;
public static int { get; } = 11007;
public static int { get; } = 11008;
public static int { get; } = 11009;
public static int { get; } = 11010;
public static int { get; } = 11011;
public static int UDP日志查看 { get; } = 11012;
public static int UDP日志清空 { get; } = 11013;
public static int { get; } = 11014;
public static int { get; } = 11015;
/**************************************************************************************
*
* 为了保证您的指令头不和系统的冲突您的指令头应该以20000之后开头
*
**************************************************************************************/
}
/// <summary>
/// 异步通信的头说明以字母H开头后面跟I,G,K,L,M
/// </summary>
public class MultiNetHeadCode
{
/// <summary>
///
/// </summary>
/// <param name="customer">指令</param>
/// <returns>是否符合</returns>
public static bool IsCustomerGroupSystem(int customer)
{
return (customer >= 50000 && customer < 51000);
}
public static int 线 { get; } = 50000;
public static int { get; } = 50001;
public static int { get; } = 50002;
public static int { get; } = 50003;
public static int { get; } = 50004;
public static int { get; } = 50005;
public static int { get; } = 50006;
/**************************************************************************************
*
* 为了保证您的指令头不和系统的冲突您的指令头应该以I,J,K,L开头
*
**************************************************************************************/
}
//可以在下面进行扩展,需要保证长度都是统一的,新建您自己的类型
}
}