Пример #1
0
        public static void AddDevice(string deviceIPAddress, string deviceName)
        {
            string configFilePath = ConfigFileManager.GetConfigurationFilePath();

            var xmlConfigFile = ConfigFileManager.LoadConfigFile(configFilePath);

            XmlNode xNodeServer = xmlConfigFile.CreateNode(XmlNodeType.Element, "Device", string.Empty);

            XmlAttribute xAttributeSite = xmlConfigFile.CreateAttribute("IPAddress");

            xAttributeSite.Value = deviceIPAddress;
            xNodeServer.Attributes.Append(xAttributeSite);

            XmlAttribute xAttributeName = xmlConfigFile.CreateAttribute("Name");

            xAttributeName.Value = deviceName;
            xNodeServer.Attributes.Append(xAttributeName);

            xmlConfigFile.GetElementsByTagName("Devices")[0]
            .InsertAfter(xNodeServer, xmlConfigFile.GetElementsByTagName("Devices")[0].LastChild);

            xmlConfigFile.Save(configFilePath);
        }
Пример #2
0
        public static void AddSDK(string sdkPath, string sdkName)
        {
            string configFilePath = ConfigFileManager.GetConfigurationFilePath();

            var xmlConfigFile = ConfigFileManager.LoadConfigFile(configFilePath);

            XmlNode xNodeServer = xmlConfigFile.CreateNode(XmlNodeType.Element, "SDK", string.Empty);

            XmlAttribute xAttributeSite = xmlConfigFile.CreateAttribute("Path");

            xAttributeSite.Value = sdkPath;
            xNodeServer.Attributes.Append(xAttributeSite);

            XmlAttribute xAttributeName = xmlConfigFile.CreateAttribute("Name");

            xAttributeName.Value = sdkName;
            xNodeServer.Attributes.Append(xAttributeName);

            xmlConfigFile.GetElementsByTagName("SDKs")[0]
            .InsertAfter(xNodeServer, xmlConfigFile.GetElementsByTagName("SDKs")[0].LastChild);

            xmlConfigFile.Save(configFilePath);
        }