Beispiel #1
0
 /// <summary>
 /// 解析指令内容
 /// </summary>
 /// <param name="cmd">指令代码</param>
 /// <param name="cmdString">需解析字符串</param>
 /// <returns>参数集</returns>
 public static List<ParamInfo> ResolveCommand(int cmd, string cmdString)
 {
     List<ParamInfo> list = new List<ParamInfo>();
     try
     {
         //遍历枚举类
         foreach (ParamEnum st in (ParamEnum[])System.Enum.GetValues(typeof(ParamEnum)))
         {
             string str = GetStringContent(cmdString, "<" + st.ToString() + ">", "</" + st.ToString() + ">");
             if (str != null)
             {
                 ParamInfo p = new ParamInfo(st.ToString(), str);
                 list.Add(p);
             }
         }
     }
     catch (Exception ex)
     {
         Log.SetLog("VideoChatHelp.CommandHelp.ResolveCommand       ResolveCommand:" + ex.Message.ToString());
     }
     return list;
 }
Beispiel #2
0
 /// <summary>
 /// 从参数集中获取指定的参数对象
 /// </summary>
 /// <param name="list">参数集</param>
 /// <param name="ParamName">参数名</param>
 /// <returns></returns>
 public static ParamInfo GetParamInfoByParams(List<ParamInfo> list, string ParamName)
 {
     ParamInfo param = new ParamInfo(ParamName,"0");
     try
     {
         foreach (ParamInfo p in list)
         {
             if (p.Name == ParamName)
             {
                 param = p;
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         Log.SetLog("VideoChatHelp.CommandHelp.GetParamInfoByParams       GetParamInfoByParams:" + ex.Message.ToString());
     }
     return param;
 }