不太会,读取text可以,但是里面有关键字,需要根据关键字信息生成类中的属性以及字段。下面的为xml:<Msg module="10" command="4" moduleName="Account" msgname="CheckAccount" fromside="C" toside="S" info="检查账号是否存在">
<Param name="account" type="string" info="账号"/>
生成一个cs文件:名字是C2SAccountCheckAccount.cs,代码为:[C#] 纯文本查看 复制代码 using System;
using PokeSockets;
using System.Collections.Generic;
/// <summary>
/// 检查账号是否存在
/// </summary>
public class C2SAccountCheckAccount : RemoteSender
{
public C2SAccountCheckAccount(string account)
{
this.account = account;
module= new byte[]{10};
command=4;
}
override internal void InitializeValues ()
{
mfieldsDic = new Dictionary<object, object>();
}
override internal void InitializeStruct ()
{
}
override internal RemoteStruct CreateListValueST (int fieldIdx)
{
return null;
}
/// <summary>
/// 账号
/// </summary>
public string account
{
get
{
return (string)fieldsDic["account"];
}
set
{
fieldsDic["account"] = value;
}
}
} |