private static List <CustomShellType.FuncCode> ReadFuncCodeSettingNode(XmlNode child) { List <CustomShellType.FuncCode> funcCodeList = new List <CustomShellType.FuncCode>(); foreach (XmlNode c in child.ChildNodes) { if (c.Name == "func") { CustomShellType.FuncCode funcCode = new CustomShellType.FuncCode(); //初始化一下Parmas funcCode.FuncParams = new List <CustomShellType.ParamStruct>(); foreach (XmlNode cc in c.ChildNodes) { if (cc.Name == "name") { funcCode.Name = cc.InnerText; } else if (cc.Name == "type") { funcCode.Type = cc.InnerText; } else if (cc.Name == "path") { funcCode.Path = cc.InnerText; } else if (cc.Name == "item") { funcCode.Item = cc.InnerText; } else if (cc.Name == "funcParam") { funcCode.FuncParams.Add(ReadParamNode(cc)); } } funcCodeList.Add(funcCode); } } return(funcCodeList); }
private static List<CustomShellType.FuncCode> ReadFuncCodeSettingNode(XmlNode child) { List<CustomShellType.FuncCode> funcCodeList = new List<CustomShellType.FuncCode>(); foreach (XmlNode c in child.ChildNodes) { if (c.Name == "func") { CustomShellType.FuncCode funcCode = new CustomShellType.FuncCode(); //初始化一下Parmas funcCode.FuncParams = new List<CustomShellType.ParamStruct>(); foreach (XmlNode cc in c.ChildNodes) { if (cc.Name == "name") { funcCode.Name = cc.InnerText; } else if (cc.Name == "type") { funcCode.Type = cc.InnerText; } else if (cc.Name == "path") { funcCode.Path = cc.InnerText; } else if (cc.Name == "item") { funcCode.Item = cc.InnerText; } else if (cc.Name == "funcParam") { funcCode.FuncParams.Add(ReadParamNode(cc)); } } funcCodeList.Add(funcCode); } } return funcCodeList; }
private Dictionary <string, string> GetCode(CustomShellType customShellType, string pass, CustomShellType.FuncCode funcCode, string[] parmas) { DataCombine dataCombine = new DataCombine(); Dictionary <string, string> dic = new Dictionary <string, string>(); //MainCodeSetting string mainCodeString = FillParams(customShellType.MainCodeSetting.Item, customShellType.MainCodeSetting.FuncCodeParam); NameValueCollection mainCodeItem = new NameValueCollection { { pass, EncryItem(customShellType.BasicSetting.MainCodeParam.EncryMode, mainCodeString) } }; AddItemToDic(dic, customShellType.BasicSetting.MainCodeParam.Location, dataCombine.CombineToStr(mainCodeItem)); //FuncCode string funcCodeString = ""; if (funcCode.FuncParams.Count > 0) { funcCodeString = FillParams(funcCode.Item, funcCode.FuncParams); } else { funcCodeString = funcCode.Item; } //判断是否随机参数 string funcParamName = customShellType.MainCodeSetting.FuncCodeParam.Name; if (GlobalSetting.IsParamRandom) { string newguid = _randomParam[funcParamName]; funcParamName = newguid; } NameValueCollection funcCodeItem = new NameValueCollection { { funcParamName, EncryItem(customShellType.MainCodeSetting.FuncCodeParam.EncryMode, funcCodeString) } }; AddItemToDic(dic, customShellType.MainCodeSetting.FuncCodeParam.Location, dataCombine.CombineToStr(funcCodeItem)); //FunParma if (parmas != null && parmas.Length > 0) { if (parmas.Length != funcCode.FuncParams.Count) { throw new Exception("调用方法的参数个数与实现代码的参数个数不符合"); } for (int i = 0; i < parmas.Length; i++) { string parName = funcCode.FuncParams[i].Name; if (GlobalSetting.IsParamRandom) { string newguid = _randomParam[parName]; parName = newguid; } NameValueCollection item = new NameValueCollection { { parName, EncryItem(funcCode.FuncParams[i].EncryMode, parmas[i]) } }; AddItemToDic(dic, funcCode.FuncParams[i].Location, dataCombine.CombineToStr(item)); //dataCombine.AddFuncParmaItem("z" + (i + 1), EncryItem(FuncCode.FuncParmaEncryMode, parmas[i])); } //AddItemToDic(dic, FuncCode.FuncParmaLocation, dataCombine.CombineToStr(dataCombine.FuncParmaItems)); } return(dic); }