Пример #1
0
        public static void Load()
        {
            _sdkList = new List <TradeSDK>();
            _xmlDoc  = new XmlDocument();

            if (!File.Exists(ConfigFileName.SDKFileName))
            {
                StreamWriter sw = new StreamWriter(ConfigFileName.SDKFileName, true, Encoding.UTF8);
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                sw.WriteLine("<TradeSDK>");
                sw.WriteLine("<Items>");
                sw.WriteLine("</Items>");
                sw.WriteLine("</TradeSDK>");
                sw.Close();
            }
            _xmlDoc.Load(ConfigFileName.SDKFileName);
            XmlNode     root = _xmlDoc.SelectSingleNode("TradeSDK");
            XmlNode     item = root.SelectSingleNode("Items");
            XmlNodeList SDKS = item.SelectNodes("SDK");

            foreach (XmlNode SDK in SDKS)
            {
                string   name       = SDK.Attributes["name"].Value;
                string   desc       = SDK.SelectSingleNode("Desc").FirstChild.Value;
                string   codestring = SDK.SelectSingleNode("Code").InnerText;
                TradeSDK pp         = new TradeSDK();
                pp._name = name;
                pp._desc = desc;
                pp._sdk  = Convert.FromBase64String(codestring);
                _sdkList.Add(pp);
            }
        }
Пример #2
0
        public static void InsertDLL(string dllname, byte[] sdk, string desc)
        {
            TradeSDK pp = new TradeSDK();

            pp._name = dllname;
            pp._sdk  = sdk;
            pp._desc = desc;
            _sdkList.Add(pp);
            InsertXML(dllname, sdk, desc);
        }