大家给看看这段程序,谢谢了
class protocol:IDisposable
{
private static protocol instance;
/// <summary>
/// 实例化协议类
/// </summary>
/// <returns></returns>
public protocol()
{
}
private string _model;
/// <summary>
/// 累加和后的指令属性
/// </summary>
/// <returns></returns>
public string _Model
{
get
{
return _model;
}
set
{
_model = value;
}
}
/// <summary>
/// 输入一个参数将其进行累加和及异或校验
/// </summary>
/// <param name="ls"></param>
/// <returns></returns>
private protocol(string ls)
{
#region //生成指令代码
char[] c_ls = ls.ToCharArray();
int sum = 0;//累加和
long xor = 0;//异或
int model = 0;//取模
string ls_jy = null;//临时校验参数
ASCIIEncoding AE1 = new ASCIIEncoding();
for (int i = 0; i < c_ls.Length; i++)
{
byte[] ByteArray1 = AE1.GetBytes(c_ls[i].ToString());
&nbs