System.Xml.XmlDocument.Load(string)

Here are the examples of the csharp api System.Xml.XmlDocument.Load(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

625 Examples 7

19 Source : ProjectLevelActions.cs
with Apache License 2.0
from aws

private void UpdateCsprojReference(string projectFile)
        {
            XmlDoreplacedent projectDoc = new XmlDoreplacedent();
            projectDoc.Load(projectFile);

            XmlNode newService = projectDoc.CreateNode(XmlNodeType.Element, "Compile", null);
            XmlNode attr = projectDoc.CreateNode(XmlNodeType.Attribute, "Include", null);
            attr.Value = Constants.MonolithService + ".cs";
            newService.Attributes.SetNamedItem(attr);

            var files = projectDoc.GetElementsByTagName("Compile");
            files.Item(0).ParentNode.InsertBefore(newService, files.Item(0));

            projectDoc.Save(projectFile);
        }

19 Source : ElementThemeResourceDictionaryBase.cs
with MIT License
from ay2015

private void PrepareStyles(List<Type> typeList, Brush accentBrush, ResourceDictionary parent)
        {
            var templateDirectory = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            string absolutePath = System.IO.Path.Combine(templateDirectory, "ay.Wpf.Theme.Element.ThemeConfig.Default.xml");
            XmlDoreplacedent doc = new XmlDoreplacedent();
            doc.Load(absolutePath);
            XmlNode node = doc.SelectSingleNode("Root");
            XmlNodeList childs = node.ChildNodes;

            foreach (Type type in typeList)
            {
                ElementStylesBase ElementStylesBase = Activator.CreateInstance(type, ColorMode) as ElementStylesBase;
                if (ElementStylesBase.MergedDatas.Count > 0)
                {
                    PrepareStyles(ElementStylesBase.MergedDatas, accentBrush, ElementStylesBase);
                }


                foreach (XmlNode replaced in childs)
                {
                    var keyvaluedesc = replaced.Attributes["Des"].Value;
                    if (keyvaluedesc == "�Զ�����") continue;
                    var keyname = replaced.Name;
                    var keyvalue = replaced.Attributes["value"].Value;
   
                    var _1 = HexToBrush.FromHex(keyvalue) as SolidColorBrush;
                    ElementStylesBase.EnsureResource(keyname, _1);
                    //���color
                    ElementStylesBase.EnsureResource(keyname+".color", _1.Color);
                    if (keyname == "colorprimary")
                    {
                        SetColor(ElementStylesBase, _1, "colorprimary");
                    }
                    else if (keyname == "colorsuccess")
                    {
                        SetColor(ElementStylesBase, _1, "colorsuccess");
                    }
                    else if (keyname == "colorwarning")
                    {
                        SetColor(ElementStylesBase, _1, "colorwarning");
                    }
                    else if (keyname == "colordanger")
                    {
                        SetColor(ElementStylesBase, _1, "colordanger");
                    }
                    else if (keyname == "colorinfo")
                    {
                        SetColor(ElementStylesBase, _1, "colorinfo");
                    }
                }

                ElementStylesBase.Initialize();
                if (parent != null)
                {
                    parent.MergedDictionaries.Add(ElementStylesBase);
                }
            }
        }

19 Source : UserSettings.cs
with Apache License 2.0
from beckzhu

public static void Init()
        {
            try
            {
                //获取数据文件的存储目录
                for (int i = _appDataDirs.Length - 1; i >= 0; i--)
                {
                    if (File.Exists(Path.Combine(_appDataDirs[i], _appDataFiles[0])) && File.Exists(Path.Combine(_appDataDirs[i], _appDataFiles[1])))
                    {
                        AppDataDir = _appDataDirs[i];
                        AppDataLocation = (DataStoreLocation)i;
                        break;
                    }
                }
                if (AppDataDir == null) AppDataDir = _appDataDirs[0];

                //创建并加载xml文件
                _xmlFile = Path.Combine(AppDataDir, "UserSettings.xml");
                _xmldoc = new XmlDoreplacedent();

                if (!File.Exists(_xmlFile))
                {
                    _xmldoc.AppendChild(_xmldoc.CreateXmlDeclaration("1.0", "utf-8", null));
                    XmlElement xmlRoot = _xmldoc.CreateElement("Settings");
                    xmlRoot.AppendChild(_xmldoc.CreateElement("General"));
                    xmlRoot.AppendChild(_xmldoc.CreateElement("UserHabits"));
                    _xmldoc.AppendChild(xmlRoot);
                    _xmldoc.Save(_xmlFile);
                }
                _xmldoc.Load(_xmlFile);

                _xmlGeneral = (XmlElement)_xmldoc.DoreplacedentElement.SelectSingleNode("General");
                _xmlUserHabits = (XmlElement)_xmldoc.DoreplacedentElement.SelectSingleNode("UserHabits");
                if (_xmlGeneral == null || _xmlUserHabits == null)
                {
                    throw new Exception("用户配置文件加载失败。\n原因:Xml节点不能为空。");
                }
                //使用习惯
                MainWindow_Width = _xmlUserHabits.GetAttrDouble("MainWindow_Width");
                if (MainWindow_Width < 800) MainWindow_Width = 1000;
                MainWindow_Height = _xmlUserHabits.GetAttrDouble("MainWindow_Height");
                if (MainWindow_Height < 600) MainWindow_Height = 800;
                MainWindow_Maximize = _xmlUserHabits.GetAttrBool("MainWindow_Maximize");
                Home_IsPaneOpen = _xmlUserHabits.GetAttrBool("Home_IsPaneOpen", true);
                HomeRemoteTreeView_Width = new GridLength(_xmlUserHabits.GetAttrDouble("HomeRemoteTreeView_Width"));
                if (HomeRemoteTreeView_Width.Value < 200) HomeRemoteTreeView_Width = new GridLength(260);
                FinalCheckDateTime = _xmlUserHabits.GetAttrDateTime("FinalCheckDateTime");
                //常规设置
                NotifyIcon = _xmlGeneral.GetAttrBool("TrayIcon");
                NewAppDataLocation = (DataStoreLocation)_xmlGeneral.GetAttrInt("NewAppDataLocation");

                if (NewAppDataLocation != AppDataLocation)//数据位置被改变
                {
                    MoveDataToNewLocation();
                }
                //远程列表展开的节点
                RemoteTreeExpand = new List<string>();
                _xmlRemoteTreeView = (XmlElement)_xmlUserHabits.SelectSingleNode("RemoteTreeView");
                if (_xmlRemoteTreeView == null)
                {
                    _xmlRemoteTreeView = _xmldoc.CreateElement("RemoteTreeView");
                    _xmlUserHabits.AppendChild(_xmlRemoteTreeView);
                }
                var expandNodes = _xmlRemoteTreeView.SelectNodes("ExpandItem");
                foreach (var node in expandNodes)
                {
                    XmlElement xmlElement = node as XmlElement;
                    if (xmlElement != null)
                    {
                        RemoteTreeExpand.Add(xmlElement.GetAttribute("uuid"));
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception($"加载用户配置文件失败。\n原因:{e.Message}");
            }
        }

19 Source : SaveOpen.cs
with MIT License
from BelkinAndrey

void Load() 
    {
        XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
        xmlDoc.Load(Application.dataPath + "/Data/" + PathFile + ".tad"); //открываем файл

        List<InspectorNeuron> ListInspector = new List<InspectorNeuron>();

        int maxId = 0;
        foreach (XmlNode node in xmlDoc.SelectNodes("NetSave/Neurons/Neuron")) 
        {
            int type = int.Parse(node.Attributes.GetNamedItem("Type").Value);
            Vector2 pos = new Vector2(float.Parse(node.Attributes.GetNamedItem("X").Value), float.Parse(node.Attributes.GetNamedItem("Y").Value));
            int Layer = int.Parse(node.Attributes.GetNamedItem("Layer").Value);
            InspectorNeuron Inspector = GetComponent<InsertOneNeuron>().LoadNeuron(pos, Layer, type);
            int id = int.Parse(node.Attributes.GetNamedItem("IDNeuron").Value);
            Inspector.isNeuron.IDNeuron = id;
            if (id > maxId) maxId = id;

            if (node.Attributes["MaxSumm"] != null) 
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).MaxSumm = float.Parse(node.Attributes.GetNamedItem("MaxSumm").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).MaxSumm = float.Parse(node.Attributes.GetNamedItem("MaxSumm").Value);
            }

            if (node.Attributes["MinSumm"] != null)
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).MinSumm = float.Parse(node.Attributes.GetNamedItem("MinSumm").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).MinSumm = float.Parse(node.Attributes.GetNamedItem("MinSumm").Value);
            }

            if (node.Attributes["threshold"] != null)
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).threshold = float.Parse(node.Attributes.GetNamedItem("threshold").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).threshold = float.Parse(node.Attributes.GetNamedItem("threshold").Value);
            }

            if (node.Attributes["Dampfer"] != null)
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).Dampfer = float.Parse(node.Attributes.GetNamedItem("Dampfer").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).Dampfer = float.Parse(node.Attributes.GetNamedItem("Dampfer").Value);
            }

            if (node.Attributes["AnswerTime"] != null)
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).AnswerTime = int.Parse(node.Attributes.GetNamedItem("AnswerTime").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).AnswerTime = int.Parse(node.Attributes.GetNamedItem("AnswerTime").Value);
            }

            if (node.Attributes["ReposeTime"] != null)
            {
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatorSimple))
                    (Inspector.isNeuron.summator as SummatorSimple).ReposeTime = int.Parse(node.Attributes.GetNamedItem("ReposeTime").Value);
                if (Inspector.isNeuron.summator.GetType() == typeof(SummatordIN))
                    (Inspector.isNeuron.summator as SummatordIN).ReposeTime = int.Parse(node.Attributes.GetNamedItem("ReposeTime").Value);
            }

            if (node.Attributes["MaxModul"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).MaxModul = float.Parse(node.Attributes.GetNamedItem("MaxModul").Value);

            if (node.Attributes["DampferM"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).DampferM = float.Parse(node.Attributes.GetNamedItem("DampferM").Value);

            if (node.Attributes["EvaluationTime"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).EvaluationTime = int.Parse(node.Attributes.GetNamedItem("EvaluationTime").Value);

            if (node.Attributes["IterationLimit"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).IterationLimit = int.Parse(node.Attributes.GetNamedItem("IterationLimit").Value);

            if (node.Attributes["thresholdUp"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).thresholdUp = float.Parse(node.Attributes.GetNamedItem("thresholdUp").Value);

            if (node.Attributes["StartAdaptTime"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).StartAdaptTime = int.Parse(node.Attributes.GetNamedItem("StartAdaptTime").Value);

            if (node.Attributes["SpeedAdapt"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).SpeedAdapt = int.Parse(node.Attributes.GetNamedItem("SpeedAdapt").Value);

            if (node.Attributes["MinThreshold"] != null)
                (Inspector.isNeuron.modulator as ModulatorMod).MinThreshold = float.Parse(node.Attributes.GetNamedItem("MinThreshold").Value);

            if (node.Attributes["thresholdDown"] != null)
                (Inspector.isNeuron.summator as SummatordIN).thresholdDown = float.Parse(node.Attributes.GetNamedItem("thresholdDown").Value);

            if (node.Attributes["TimeReAction"] != null)
                (Inspector.isNeuron.summator as SummatordIN).TimeReAction = int.Parse(node.Attributes.GetNamedItem("TimeReAction").Value);

            ListInspector.Add(Inspector);
        }
        GetComponent<SpaceNeuron>().MaxIDNeuron = maxId;

        foreach (XmlNode node in xmlDoc.SelectNodes("NetSave/Synapses/Synapse")) 
        {
            int parentN = int.Parse(node.Attributes.GetNamedItem("parentNeuron").Value);
            int targetN = int.Parse(node.Attributes.GetNamedItem("targetNeuron").Value);
            GetComponent<InsertSynapse>().SynapseInsert(ListInspector[parentN].gameObject, ListInspector[targetN].gameObject);
            int indexS = int.Parse(node.Attributes.GetNamedItem("index").Value);
            GetComponent<SpaceNeuron>().SynapseList[indexS].TypeSynapse = int.Parse(node.Attributes.GetNamedItem("TypeSynapse").Value);
            GetComponent<SpaceNeuron>().SynapseList[indexS].descriptor = int.Parse(node.Attributes.GetNamedItem("descriptor").Value);
            GetComponent<SpaceNeuron>().SynapseList[indexS].Force = float.Parse(node.Attributes.GetNamedItem("Force").Value);
            GetComponent<SpaceNeuron>().SynapseList[indexS].Delay = int.Parse(node.Attributes.GetNamedItem("Delay").Value);
            GetComponent<SpaceNeuron>().SynapseList[indexS].Freeze = bool.Parse(node.Attributes.GetNamedItem("Freeze").Value);
        }

        foreach (GameObject value in listTols) 
        {
            XmlNode node = xmlDoc.SelectSingleNode("NetSave/" + value.name);
            if (node.Attributes.GetNamedItem("target").Value != "-1") 
            {
                value.GetComponentInChildren<ToolSelect>().LoodTool(ListInspector[int.Parse(node.Attributes.GetNamedItem("target").Value)].gameObject);
            }
        }
    }

19 Source : LoadBrain.cs
with MIT License
from BelkinAndrey

void Load()
    {
        XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
        xmlDoc.Load(Application.dataPath + "/Data/" + PathFile + ".tad"); //открываем файл


        int maxId = 0;
        foreach (XmlNode node in xmlDoc.SelectNodes("NetSave/Neurons/Neuron"))
        {
            int type = int.Parse(node.Attributes.GetNamedItem("Type").Value);
            Vector2 pos = new Vector2(float.Parse(node.Attributes.GetNamedItem("X").Value), float.Parse(node.Attributes.GetNamedItem("Y").Value));
            int Layer = int.Parse(node.Attributes.GetNamedItem("Layer").Value);

            Neuron neuron = GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().CreateNeuron(pos, Layer, type);

            int id = int.Parse(node.Attributes.GetNamedItem("IDNeuron").Value);
            neuron.IDNeuron = id;
            if (id > maxId) maxId = id;

            if (node.Attributes["MaxSumm"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).MaxSumm = float.Parse(node.Attributes.GetNamedItem("MaxSumm").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).MaxSumm = float.Parse(node.Attributes.GetNamedItem("MaxSumm").Value);
            }

            if (node.Attributes["MinSumm"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).MinSumm = float.Parse(node.Attributes.GetNamedItem("MinSumm").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).MinSumm = float.Parse(node.Attributes.GetNamedItem("MinSumm").Value);
            }

            if (node.Attributes["threshold"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).threshold = float.Parse(node.Attributes.GetNamedItem("threshold").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).threshold = float.Parse(node.Attributes.GetNamedItem("threshold").Value);
            }

            if (node.Attributes["Dampfer"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).Dampfer = float.Parse(node.Attributes.GetNamedItem("Dampfer").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).Dampfer = float.Parse(node.Attributes.GetNamedItem("Dampfer").Value);
            }

            if (node.Attributes["AnswerTime"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).AnswerTime = int.Parse(node.Attributes.GetNamedItem("AnswerTime").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).AnswerTime = int.Parse(node.Attributes.GetNamedItem("AnswerTime").Value);
            }

            if (node.Attributes["ReposeTime"] != null)
            {
                if (neuron.summator.GetType() == typeof(SummatorSimple))
                    (neuron.summator as SummatorSimple).ReposeTime = int.Parse(node.Attributes.GetNamedItem("ReposeTime").Value);
                if (neuron.summator.GetType() == typeof(SummatordIN))
                    (neuron.summator as SummatordIN).ReposeTime = int.Parse(node.Attributes.GetNamedItem("ReposeTime").Value);
            }

            if (node.Attributes["MaxModul"] != null)
                (neuron.modulator as ModulatorMod).MaxModul = float.Parse(node.Attributes.GetNamedItem("MaxModul").Value);

            if (node.Attributes["DampferM"] != null)
                (neuron.modulator as ModulatorMod).DampferM = float.Parse(node.Attributes.GetNamedItem("DampferM").Value);

            if (node.Attributes["EvaluationTime"] != null)
                (neuron.modulator as ModulatorMod).EvaluationTime = int.Parse(node.Attributes.GetNamedItem("EvaluationTime").Value);

            if (node.Attributes["IterationLimit"] != null)
                (neuron.modulator as ModulatorMod).IterationLimit = int.Parse(node.Attributes.GetNamedItem("IterationLimit").Value);

            if (node.Attributes["thresholdUp"] != null)
                (neuron.modulator as ModulatorMod).thresholdUp = float.Parse(node.Attributes.GetNamedItem("thresholdUp").Value);

            if (node.Attributes["StartAdaptTime"] != null)
                (neuron.modulator as ModulatorMod).StartAdaptTime = int.Parse(node.Attributes.GetNamedItem("StartAdaptTime").Value);

            if (node.Attributes["SpeedAdapt"] != null)
                (neuron.modulator as ModulatorMod).SpeedAdapt = int.Parse(node.Attributes.GetNamedItem("SpeedAdapt").Value);

            if (node.Attributes["MinThreshold"] != null)
                (neuron.modulator as ModulatorMod).MinThreshold = float.Parse(node.Attributes.GetNamedItem("MinThreshold").Value);

            if (node.Attributes["thresholdDown"] != null)
                (neuron.summator as SummatordIN).thresholdDown = float.Parse(node.Attributes.GetNamedItem("thresholdDown").Value);

            if (node.Attributes["TimeReAction"] != null)
                (neuron.summator as SummatordIN).TimeReAction = int.Parse(node.Attributes.GetNamedItem("TimeReAction").Value);
        }
        GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().MaxIDNeuron = maxId;

        foreach (XmlNode node in xmlDoc.SelectNodes("NetSave/Synapses/Synapse"))
        {
            int parentN = int.Parse(node.Attributes.GetNamedItem("parentNeuron").Value);
            int targetN = int.Parse(node.Attributes.GetNamedItem("targetNeuron").Value);
            Synapse synapse = GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().CreateSynapse(
                GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[parentN],
                GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[targetN]);
            synapse.TypeSynapse = int.Parse(node.Attributes.GetNamedItem("TypeSynapse").Value);
            synapse.descriptor = int.Parse(node.Attributes.GetNamedItem("descriptor").Value);
            synapse.Force = float.Parse(node.Attributes.GetNamedItem("Force").Value);
            synapse.Delay = int.Parse(node.Attributes.GetNamedItem("Delay").Value);
            synapse.Freeze = bool.Parse(node.Attributes.GetNamedItem("Freeze").Value);
        }

        for (int i = 0; i < listTols.Length; i++) 
        {
            XmlNode node = xmlDoc.SelectSingleNode("NetSave/" + listTols[i]);
            NeuronTools[i] = int.Parse(node.Attributes.GetNamedItem("target").Value);
        }

        if (NeuronTools[11] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[11]].onAction 
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS1L;
        if (NeuronTools[12] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[12]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS2L;
        if (NeuronTools[13] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[13]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS3L;
        if (NeuronTools[14] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[14]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS4L;
        if (NeuronTools[15] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[15]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS5L;
        if (NeuronTools[16] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[16]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS6L;
        if (NeuronTools[17] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[17]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS7L;
        if (NeuronTools[18] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[18]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS8L;

        if (NeuronTools[19] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[19]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS1R;
        if (NeuronTools[20] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[20]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS2R;
        if (NeuronTools[21] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[21]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS3R;
        if (NeuronTools[22] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[22]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS4R;
        if (NeuronTools[23] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[23]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS5R;
        if (NeuronTools[24] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[24]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS6R;
        if (NeuronTools[25] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[25]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS7R;
        if (NeuronTools[26] != -1) GetComponent<ManagerWorld>().Tadpole1.GetComponent<SpaceNeuron>().NeuronList[NeuronTools[26]].onAction
            += GetComponent<ManagerWorld>().Tadpole1.GetComponent<JointTadLP>().EventS8R;
    }

19 Source : XMLCaching.cs
with GNU General Public License v3.0
from BRH-Media

public static XmlDoreplacedent XmlFromCache(string sourceUrl)
        {
            try
            {
                //ensure we're allowed to perform caching operations on XML files//ensure we're allowed to perform caching operations on XML files
                if (ObjectProvider.Settings.CacheSettings.Mode.EnableXmlCaching)
                {
                    //ensure the URL requested is already cached
                    if (XmlInCache(sourceUrl))
                    {
                        //get the encoded cache path for this XML record
                        var fqPath = XmlCachePath(sourceUrl);

                        //check if expiring caches are enabled
                        if (ObjectProvider.Settings.CacheSettings.Expiry.Enabled)
                        {
                            //has this record expired?
                            if (!CachingExpiry.CheckCacheExpiry(fqPath,
                                ObjectProvider.Settings.CacheSettings.Expiry.Interval))
                            {
                                //log status
                                LoggingHelpers.RecordCacheEvent("Cached URL is not expired; loading from cached copy.",
                                    sourceUrl);

                                //create a new XML record and load from the cached copy
                                var doc = new XmlDoreplacedent();
                                doc.Load(fqPath);

                                //return cached copy
                                return doc;
                            }
                            else
                            {
                                //log status
                                LoggingHelpers.RecordCacheEvent(
                                    "Cached URL is out-of-date; attempting to get a new copy.",
                                    sourceUrl);

                                //force the download of a new copy
                                var newDoc = XmlGet.GetXmlTransaction(sourceUrl, true);

                                //replace the existing record with the new one
                                var replaceResult = XmlReplaceCache(newDoc, sourceUrl);

                                //logging procedure
                                LoggingHelpers.RecordCacheEvent(
                                    replaceResult ? "Cache replacement succeeded" : "Cache replacement failed",
                                    sourceUrl);

                                //return the newly-downloaded record
                                return newDoc;
                            }
                        }
                        else
                        {
                            //log status
                            LoggingHelpers.RecordCacheEvent("Loading from cached copy", sourceUrl);

                            //create a new XML record and load from the cached copy
                            var doc = new XmlDoreplacedent();
                            doc.Load(fqPath);

                            //return cached copy
                            return doc;
                        }
                    }
                    else

                        //log status
                        LoggingHelpers.RecordCacheEvent("URL isn't cached; couldn't load from specified file.",
                            sourceUrl);
                }
            }
            catch (Exception ex)
            {
                //log the error
                LoggingHelpers.RecordException(ex.Message, "XmlCacheGetError");
                LoggingHelpers.RecordCacheEvent("Couldn't retrieve existing cached file (an error occurred)", sourceUrl);
            }

            //default
            return new XmlDoreplacedent();
        }

19 Source : ConvertAppToCore3Command.cs
with MIT License
from brianlagunas

void UpdateNuGetPackageReferences(ProjectRootElement projectRoot, ProjectData projectData)
        {
            //TODO: only use the top-level pacakages, not all packages
            var packageConfigFilePath = Path.Combine(projectData.FilePath, Constants.NuGetPackagesConfigFileName);
            if (File.Exists(packageConfigFilePath))
            {
                XmlDoreplacedent doreplacedent = new XmlDoreplacedent();
                doreplacedent.Load(packageConfigFilePath);

                XmlNodeList packageList = doreplacedent.GetElementsByTagName("package");

                ProjecreplacedemGroupElement packageRefItemGroup = projectRoot.AddItemGroup();
                foreach (XmlNode package in packageList)
                {
                    var id = package.Attributes["id"].InnerText;
                    var version = package.Attributes["version"].InnerText;
                    var item = packageRefItemGroup.AddItem(Constants.PackageReference, id);
                    item.AddMetadata(Constants.Version, version, true);
                }

                File.Delete(packageConfigFilePath);
            }
        }

19 Source : AddProjectWizard.cs
with MIT License
from BTDF

private void UpdateProjectFile(string projectFilePath, DeploymentOptions options, bool writeOnlyWhenNonDefault)
        {
            XmlDoreplacedent projectXml = new XmlDoreplacedent();
            projectXml.Load(projectFilePath);

            XmlNamespaceManager xnm = new XmlNamespaceManager(projectXml.NameTable);
            xnm.AddNamespace(string.Empty, "http://schemas.microsoft.com/developer/msbuild/2003");
            xnm.AddNamespace("ns0", "http://schemas.microsoft.com/developer/msbuild/2003");

            XmlElement projectElement = projectXml.SelectSingleNode("/ns0:Project", xnm) as XmlElement;
            string bizTalkProductName = GetBizTalkProductName();

            if (string.Compare(bizTalkProductName, "Microsoft BizTalk Server 2010", true) == 0
                || string.Compare(bizTalkProductName, "Microsoft BizTalk Server 2013", true) == 0
                || string.Compare(bizTalkProductName, "Microsoft BizTalk Server 2013 R2", true) == 0)
            {
                projectElement.SetAttribute("ToolsVersion", "4.0");
            }

            XmlElement generalPropertyGroup = projectXml.SelectSingleNode("/ns0:Project/ns0:PropertyGroup[1]", xnm) as XmlElement;

            Type doType = options.GetType();
            PropertyInfo[] doProperties = doType.GetProperties();

            foreach (PropertyInfo pi in doProperties)
            {
                if (pi.PropertyType.Equals(typeof(bool)))
                {
                    if (writeOnlyWhenNonDefault)
                    {
                        object[] dvAttribute = pi.GetCustomAttributes(typeof(DefaultValueAttribute), false);
                        DefaultValueAttribute dva = dvAttribute[0] as DefaultValueAttribute;
                        bool defaultValue = (bool)dva.Value;

                        bool propertyValue = (bool)pi.GetValue(options, null);

                        if (defaultValue != propertyValue)
                        {
                            WriteElementText(projectXml, xnm, generalPropertyGroup, pi.Name, propertyValue);
                        }
                    }
                    else
                    {
                        WriteElementText(projectXml, xnm, generalPropertyGroup, pi.Name, (bool)pi.GetValue(options, null));
                    }
                }
            }


            projectXml.Save(projectFilePath);
        }

19 Source : AutoUpdate.cs
with MIT License
from cdmxz

public bool GetUpdate()
        {
            if (File.Exists(xmlPath))
                File.Delete(xmlPath);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            // 下载Xml文件
            using (WebClient client = new WebClient())
                client.DownloadFile(xmlUrl, xmlPath);
            // 判断Xml文件是否存在
            if (!File.Exists(xmlPath))
                throw new Exception("下载更新XML文件失败");
            // 加载Xml文件
            XmlDoreplacedent xml = new XmlDoreplacedent();
            xml.Load(xmlPath);
            // 得到根节点
            XmlNode root = xml.SelectSingleNode("AutoUpdate");
            XmlNode node = root.SelectSingleNode("Update");
            // 将节点转为元素
            XmlElement element = (XmlElement)node;
            // 得到Version属性的值
            UpdateVersion = element.GetAttribute("Version");
            FileUrl = node.SelectSingleNode("FileUrl").InnerText;
            BuildTime = node.SelectSingleNode("BuildTime").InnerText;
            FileMd5 = node.SelectSingleNode("FileMd5").InnerText;
            UpdateSize = node.SelectSingleNode("UpdateSize").InnerText;
            UpdateInfo = node.SelectSingleNode("UpdateInfo").InnerText;
            if (File.Exists(xmlPath))
                File.Delete(xmlPath);
            VersionInfo = string.Format($"当前版本:{currentVersion}\r\n最新版本:{UpdateVersion}\r\n最新版编译时间:{BuildTime}\r\n");
            UpdateInfo += "\r\n手动下载链接:" + FileUrl;
            // 比较版本号,如果当前版本小于升级版本
            if (new Version(currentVersion) < new Version(UpdateVersion))
                return true;
            else
                return false;
        }

19 Source : Cradles.cs
with The Unlicense
from ceramicskate0

public static XmlDoreplacedent GET_XML_Load(string URL)
        {
            XmlDoreplacedent doc = new XmlDoreplacedent();
            doc.PreserveWhitespace = true;
            try
            {
                doc.Load(URL);
                return doc;
            }
            catch (System.IO.FileNotFoundException)
            {
                return null;
            }
        }

19 Source : PanoramaParser.cs
with Apache License 2.0
from CheckPointSW

public bool DetectPanoramaConfFile(string fileName)
        {
            bool is_panorama = false;
            XmlDoreplacedent xDoc = new XmlDoreplacedent();
            try
            {
                xDoc.Load(fileName);
                XmlElement xRoot = xDoc.DoreplacedentElement;
                XmlNode panoramaNode = xRoot.SelectSingleNode("panorama");
                if (panoramaNode != null)
                    is_panorama = true;
            }
            catch { }
            return is_panorama;
        }

19 Source : components.cs
with BSD 2-Clause "Simplified" License
from chengse66

private void load_category()
	{
		string category = momiji_host.replacedembly + "\\" + "momiji" + ".categories";
		string component = momiji_host.replacedembly + "\\" + "momiji" + ".components";
        string maplestory = momiji_host.replacedembly + "\\" + "mapleStory" + ".components";

        if (File.Exists(category) && File.Exists(component))
		{
			XmlDoreplacedent categories = new XmlDoreplacedent();
			XmlDoreplacedent components = new XmlDoreplacedent();
            
			categories.Load(category);
			components.Load(component);
            //追加XML
            
            if (File.Exists(maplestory))
            {
                XmlDoreplacedent maplestorys = new XmlDoreplacedent();
                maplestorys.Load(maplestory);
                parse_node(maplestorys["momiji"],components["momiji"]);
            }

            load_category(categories["momiji"], components["momiji"]);
		}
	}

19 Source : SwaggerCacheProvider.cs
with MIT License
from chi8708

public ConcurrentDictionary<string, string> GetControllerDesc()
        {
            string xmlpath = _xml;
            ConcurrentDictionary<string, string> controllerDescDict = new ConcurrentDictionary<string, string>();
            if (File.Exists(xmlpath))
            {
                XmlDoreplacedent xmldoc = new XmlDoreplacedent();
                xmldoc.Load(xmlpath);
                string type = string.Empty, path = string.Empty, controllerName = string.Empty;

                string[] arrPath;
                int length = -1, cCount = "Controller".Length;
                XmlNode summaryNode = null;
                foreach (XmlNode node in xmldoc.SelectNodes("//member"))
                {
                    type = node.Attributes["name"].Value;
                    if (type.StartsWith("T:"))
                    {
                        //控制器
                        arrPath = type.Split('.');
                        length = arrPath.Length;
                        controllerName = arrPath[length - 1];
                        if (controllerName.EndsWith("Controller"))
                        {
                            //获取控制器注释
                            summaryNode = node.SelectSingleNode("summary");
                            string key = controllerName.Remove(controllerName.Length - cCount, cCount);
                            if (summaryNode != null && !string.IsNullOrEmpty(summaryNode.InnerText) && !controllerDescDict.ContainsKey(key))
                            {
                                controllerDescDict.TryAdd(key, summaryNode.InnerText.Trim());
                            }
                        }
                    }
                }
            }
            return controllerDescDict;
        }

19 Source : Util.cs
with MIT License
from circles-arrows

internal static Task<ModellerVersion> CheckForUpdates()
        {
            return Task.Run(() =>
            {
                try
                {
                    XmlDoreplacedent doc = new XmlDoreplacedent();
                    doc.Load("https://www.blueprint41.com/download/updater.xml");

                    XmlNode modellerNode = doc.DoreplacedentElement.SelectSingleNode("/modeller");
                    string version = modellerNode.SelectSingleNode("version").InnerText;
                    string downloadUrl = modellerNode.SelectSingleNode("downloadUrl").InnerText;

                    string[] versions = version.Split('.');

                    long.TryParse(versions[0], out long major);
                    long.TryParse(versions[1], out long minor);
                    long.TryParse(versions[2], out long patch);

                    ModellerVersion updatedVersion = new ModellerVersion(major, minor, patch, downloadUrl);

                    return updatedVersion;
                }
                catch (Exception ex)
                {
                    return ModellerVersion.Empty;
                }
            });
        }

19 Source : frm_Main.cs
with GNU General Public License v3.0
from cjybyjk

private string GetNodeText(string themeDir,string node)
        {
            try
            {
                XmlDoreplacedent doc = new XmlDoreplacedent();
                doc.Load(themeDir + @"\description.xml");
                XmlNodeList dd = doc.GetElementsByTagName(node);
                return dd.Item(0).InnerText;
            }
            catch
            {
                return "无法读取 " + node;
            }
            
        }

19 Source : GameGenieDataBase.cs
with GNU General Public License v3.0
from ClusterM

public void ImportCodes(string AFileName, bool AQuiet = false)
        {
            if (File.Exists(AFileName))
            {
                XmlDoreplacedent lXml = new XmlDoreplacedent();
                XmlNodeList lCodes = null;
                XmlNode lCodeNode = null;
                XmlAttribute lAttribute = null;

                lXml.Load(AFileName);
                lCodes = lXml.SelectNodes("//genie/..");

                FModified = true;

                XmlNode lDeleteNode = GameNode.FirstChild;
                while (lDeleteNode != null)
                {
                    GameNode.RemoveChild(GameNode.FirstChild);
                    lDeleteNode = GameNode.FirstChild;
                }
                GameCodes.Clear();

                string lGameFileName = Path.Combine(Path.Combine(Path.Combine(Program.BaseDirectoryExternal, "games"), FGame.Code), FGame.Code + ".nes");
                foreach (XmlNode lCurCode in lCodes)
                {
                    NesFile lGame = new NesFile(lGameFileName);
                    try
                    {
                        lGame.PRG = GameGeniePatcherNes.Patch(lGame.PRG, lCurCode["genie"].InnerText);

                        lCodeNode = FXml.CreateElement("gamegenie");
                        GameNode.AppendChild(lCodeNode);

                        lAttribute = FXml.CreateAttribute("code");
                        lAttribute.Value = lCurCode["genie"].InnerText.ToUpper().Trim();
                        lCodeNode.Attributes.Append(lAttribute);

                        lAttribute = FXml.CreateAttribute("description");
                        lAttribute.Value = lCurCode["description"].InnerText;
                        lCodeNode.Attributes.Append(lAttribute);

                        GameCodes.Add(new GameGenieCode(lCurCode["genie"].InnerText.ToUpper().Trim(), lCurCode["description"].InnerText));
                    }
                    catch (GameGenieFormatException)
                    {
                        if (!AQuiet)
                            MessageBox.Show(string.Format(Resources.GameGenieFormatError, lCurCode["genie"].InnerText, FGame.Name), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    catch (GameGenieNotFoundException)
                    {
                        if (!AQuiet)
                            MessageBox.Show(string.Format(Resources.GameGenieNotFound, lCurCode["genie"].InnerText, FGame.Name), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }

19 Source : SourcetrailExtensionPackage.cs
with Apache License 2.0
from CoatiSoftware

public string GetPackageVersion()
		{
			string replacedemblyPath = replacedembly.GetExecutingreplacedembly().Location;
			replacedemblyPath = replacedemblyPath.Substring(0, replacedemblyPath.LastIndexOf('\\'));
			string manifestPath = Path.Combine(replacedemblyPath, "extension.vsixmanifest");

			XmlDoreplacedent doc = new XmlDoreplacedent();
			doc.Load(manifestPath);
			XmlElement metaData = doc.DoreplacedentElement.ChildNodes.Cast<XmlElement>().First(x => x.Name == "Metadata");
			XmlElement idenreplacedy = metaData.ChildNodes.Cast<XmlElement>().First(x => x.Name == "Idenreplacedy");

			return idenreplacedy.GetAttribute("Version");
		}

19 Source : XDCMake.cs
with zlib License
from codecat

static void Main(string[] args)
	{
		var inputFiles = new List<string>();
		var outputFile = string.Empty;
		var replacedemblyName = string.Empty;

		foreach (var arg in args)
		{
			if (arg.Length < 2)
			{
				continue;
			}

			if (arg[0] == '@')
			{
				ProcessStartInfo startInfo = new ProcessStartInfo();
				startInfo.FileName = replacedembly.GetExecutingreplacedembly().Location;
				startInfo.Arguments = File.ReadAllText(arg.Substring(1));
				startInfo.UseShellExecute = false;
				startInfo.RedirectStandardOutput = true;

				Process process = Process.Start(startInfo);
				Console.Write(process.StandardOutput.ReadToEnd());
				process.WaitForExit();
				return;
			}

			if (arg[0] != '/' && arg[0] != '-')
			{
				replacedemblyName = arg;
				continue;
			}

			string id = arg.Substring(1);
			string param = string.Empty;

			if (id[0] == 'F')
			{
				if (id.Length > 2)
				{
					param = id.Substring(2);
					id = id.Substring(0, 2);
				}
			}

			switch (id)
			{
				case "Fs":
					inputFiles.Add(param);
					break;
				case "Fo":
					outputFile = param;
					break;
			}
		}

		if (outputFile.Length == 0)
		{
			Console.WriteLine("error XDC0007 : No output file specified");
			return;
		}

		if (replacedemblyName.Length == 0)
		{
			replacedemblyName = Path.GetFileNameWithoutExtension(outputFile);
		}

		var outputDoreplacedent = new XmlDoreplacedent();
		outputDoreplacedent.LoadXml("<doc><replacedembly>" + replacedemblyName + "</replacedembly><members/></doc>");
		XmlNode outputNode = outputDoreplacedent.DoreplacedentElement.SelectSingleNode("members");

		foreach (var file in inputFiles)
		{
			var doc = new XmlDoreplacedent();

			try
			{
				doc.Load(file);
			}
			catch (Exception)
			{
				Console.WriteLine(file + " : warning XDC0004 : Unable to load XML fragment");
				continue;
			}

			XmlNode members = doc.SelectSingleNode("doc/members");

			if (members == null)
			{
				Console.WriteLine(file + " : warning XDC0022 : File contains no <doc><members> tag");
				continue;
			}

			foreach (XmlNode member in members.ChildNodes)
			{
				member.Attributes.RemoveNamedItem("decl");
				member.Attributes.RemoveNamedItem("source");
				member.Attributes.RemoveNamedItem("line");

				outputNode.AppendChild(outputDoreplacedent.ImportNode(member, true));
			}
		}

		try
		{
			outputDoreplacedent.Save(outputFile);
		}
		catch (Exception)
		{
			Console.WriteLine("error XDC0002 : Cannot write to output file");
		}
	}

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void XmlToJson_CheckIfJson_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");

            var rsopJson = replacedysisService.XmlToJson(doc);

            replacedert.IsInstanceOfType(rsopJson, typeof(JObject));
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void XmlToJson_CheckIfJsonEmpty_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\emptyValid.xml");

            var rsopJson = replacedysisService.XmlToJson(doc);

            replacedert.IsInstanceOfType(rsopJson, typeof(JObject));
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void XmlToJson_CheckIfJson_WithoutNamespaces_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var regex = "q[0-9]:";

            var rsopJson = replacedysisService.XmlToJson(doc);

            var hasNamespaces = Regex.Match(rsopJson.ToString(), regex, RegexOptions.IgnoreCase);
            replacedert.IsFalse(hasNamespaces.Success);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseAuditSettings_GoodRsop_NumberOfAuditSettingsIs28_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var auditSettings = replacedysisService.replacedyseAuditSettings(rsopJson);

            replacedert.AreEqual(28, auditSettings.Count);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseAuditSettings_GoodRsop_AllItemsAreNotNull_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var auditSettings = replacedysisService.replacedyseAuditSettings(rsopJson);

            Collectionreplacedert.AllItemsAreNotNull(auditSettings);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseAuditSettings_GoodRsop_AreCorrectType_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var auditSettings = replacedysisService.replacedyseAuditSettings(rsopJson);

            Collectionreplacedert.AllItemsAreInstancesOfType(auditSettings, typeof(AuditSetting));
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedysePolicies_GoodRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var policies = replacedysisService.replacedysePolicies(rsopJson);

            Collectionreplacedert.AreEqual(RecommendedPolicies, policies);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseSecurityOptions_BadRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\bad_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var securityOptions = replacedysisService.replacedyseSecurityOptions(rsopJson);

            Collectionreplacedert.AreNotEqual(RecommendedSecurityOptions, securityOptions);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseAuditSettings_GoodRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var auditSettings = replacedysisService.replacedyseAuditSettings(rsopJson);

            Collectionreplacedert.AreEqual(RecommendedAuditSettings, auditSettings);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedysePolicies_GoodRsop_AllItemsAreNotNull_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var policies = replacedysisService.replacedysePolicies(rsopJson);

            Collectionreplacedert.AllItemsAreNotNull(policies);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseSecurityOptions_GoodRsop_NumberOfPoliciesIs1_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var securityOptions = replacedysisService.replacedyseSecurityOptions(rsopJson);

            replacedert.AreEqual(1, securityOptions.Count);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseSecurityOptions_GoodRsop_AllItemsAreNotNull_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var securityOptions = replacedysisService.replacedyseSecurityOptions(rsopJson);

            Collectionreplacedert.AllItemsAreNotNull(securityOptions);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseSecurityOptions_GoodRsop_AreCorrectType_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var securityOptions = replacedysisService.replacedyseSecurityOptions(rsopJson);

            Collectionreplacedert.AllItemsAreInstancesOfType(securityOptions, typeof(SecurityOption));
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseSecurityOptions_GoodRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var securityOptions = replacedysisService.replacedyseSecurityOptions(rsopJson);

            Collectionreplacedert.AreEqual(RecommendedSecurityOptions, securityOptions);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseRegistrySettings_GoodRsop_NumberOfPoliciesIs2_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var registrySettings = replacedysisService.replacedyseRegistrySetting(rsopJson);

            replacedert.AreEqual(2, registrySettings.Count);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseRegistrySettings_GoodRsop_AllItemsAreNotNull_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var registrySettings = replacedysisService.replacedyseRegistrySetting(rsopJson);

            Collectionreplacedert.AllItemsAreNotNull(registrySettings);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseRegistrySettings_GoodRsop_AreCorrectType_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var registrySettings = replacedysisService.replacedyseRegistrySetting(rsopJson);

            Collectionreplacedert.AllItemsAreInstancesOfType(registrySettings, typeof(RegistrySetting));
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseRegistrySettings_GoodRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var registrySettings = replacedysisService.replacedyseRegistrySetting(rsopJson);

            Collectionreplacedert.AreEqual(RecommendedRegistrySettings, registrySettings);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedyseAuditSettings_BadRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\bad_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var auditSettings = replacedysisService.replacedyseAuditSettings(rsopJson);

            Collectionreplacedert.AreNotEqual(RecommendedAuditSettings, auditSettings);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedysePolicies_BadRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\bad_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var policies = replacedysisService.replacedysePolicies(rsopJson);

            Collectionreplacedert.AreNotEqual(RecommendedPolicies, policies);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void RegistrySettings_BadRsop_AllSettingsAreEqual_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\bad_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var registrySettings = replacedysisService.replacedyseRegistrySetting(rsopJson);

            Collectionreplacedert.AreNotEqual(RecommendedRegistrySettings, registrySettings);
        }

19 Source : AnalysisService.cs
with MIT License
from CompassSecurity

private void replacedyseEachXml(FileInfo[] rsopXml, List<Rsop> rsops)
        {
            foreach (var xml in rsopXml)
            {
                var doc = new XmlDoreplacedent();
                try
                {
                    doc.Load(xml.FullName);
                }
                catch (Exception e)
                {
                    throw new InvalidXmlException("Your provided Xml-File is not an valid" ,e.Message) ;
                }
                var rsopJson = XmlToJson(doc);

                var allRsopGpos = GetAllRsopGpos(rsopJson);
                var auditSettings = replacedyseAuditSettings(rsopJson);
                var securityOptions = replacedyseSecurityOptions(rsopJson);
                var policies = replacedysePolicies(rsopJson);
                var registrySettings = replacedyseRegistrySetting(rsopJson);

                var organisationalUnit = GetOrganisationalUnitOfRsop(rsopJson);
                if (organisationalUnit == null) { continue; }

                var site = GetSiteOfRsop(rsopJson);
                if (site == null) { continue; }

                var rsop = new Rsop
                {
                    Domain = organisationalUnit.ADDomain,
                    OrganizationalUnit = organisationalUnit,
                    Site = site,
                    AuditSettings = auditSettings.OrderBy(x => x.SubcategoryName).ToList(),
                    Policies = policies.OrderBy(x => x.Name).ToList(),
                    RegistrySettings = registrySettings.OrderBy(x => x.Name).ToList(),
                    SecurityOptions = securityOptions.OrderBy(x => x.Description).ToList(),
                    Gpos = allRsopGpos
                };

                rsops.Add(rsop);
            }
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedysePolicies_GoodRsop_NumberOfPoliciesIs3_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var policies = replacedysisService.replacedysePolicies(rsopJson);

            replacedert.AreEqual(3, policies.Count);
        }

19 Source : AnalysisServiceTest.cs
with MIT License
from CompassSecurity

[TestMethod]
        public void replacedysePolicies_GoodRsop_AreCorrectType_Test()
        {
            var doc = new XmlDoreplacedent();
            doc.Load("..\\..\\TestRsopXml\\recommended_rsop.xml");
            var rsopJson = replacedysisService.XmlToJson(doc);

            var policies = replacedysisService.replacedysePolicies(rsopJson);

            Collectionreplacedert.AllItemsAreInstancesOfType(policies, typeof(Policy));
        }

19 Source : GameCloundEditorCommonLua.cs
with MIT License
from CragonGame

void OnEnable()
    {
        MD5 = new MD5CryptoServiceProvider();

        string current_dir = System.Environment.CurrentDirectory;
        current_dir = current_dir.Replace(@"\", "/");
        string replacedet_path = current_dir + "/" + GameCloudEditor.replacedetRoot;
        mRowreplacedetPath = replacedet_path + "CommonLua";

        mABTargetPathRoot = Path.Combine(current_dir, GameCloudEditor.replacedetBundleTargetDirectory);
        mABTargetPathRoot = mABTargetPathRoot.Replace(@"\", "/");
        mCommonLuaDateFileListPath = mABTargetPathRoot + "/CommonLua";

        mVersionInfoPath = mCommonLuaDateFileListPath + "/" + mVersionInfoName;
        XmlDoreplacedent x_d = new XmlDoreplacedent();
        x_d.Load(mVersionInfoPath);
        XmlElement root = null;
        root = x_d.DoreplacedentElement;

        foreach (XmlNode i in root.ChildNodes)
        {
            if (i is XmlComment)
            {
                continue;
            }

            var xml_element = (XmlElement)i;
            CurrentVersion = xml_element.GetAttribute("Version");
        }
    }

19 Source : GameCloundEditorCommonLua.cs
with MIT License
from CragonGame

void _changeDataData(bool add)
    {
        int data = int.Parse(CurrentVersion.Replace(".", ""));
        if (add)
        {
            data += 1;
        }
        else
        {
            data -= 1;
        }
        string data_version = data.ToString();
        data_version = data_version.Insert(1, ".").Insert(4, ".");
        CurrentVersion = data_version;

        XmlDoreplacedent x_d = new XmlDoreplacedent();
        x_d.Load(mVersionInfoPath);
        XmlElement root = null;
        root = x_d.DoreplacedentElement;

        foreach (XmlNode i in root.ChildNodes)
        {
            if (i is XmlComment)
            {
                continue;
            }

            var xml_element = (XmlElement)i;
            xml_element.SetAttribute("Version", CurrentVersion);
        }

        x_d.Save(mVersionInfoPath);
    }

19 Source : GameCloudEditor.cs
with MIT License
from CragonGame

void _translatePatchXml(string path)
    {
        XmlDoreplacedent abpath_xml = new XmlDoreplacedent();
        abpath_xml.Load(path);

        XmlElement root = null;
        root = abpath_xml.DoreplacedentElement;

        foreach (XmlNode i in root.ChildNodes)
        {
            if (i is XmlComment)
            {
                continue;
            }

            var xml_element = (XmlElement)i;
            ProjectPlatformInfo platform_info = new ProjectPlatformInfo();
            platform_info.PlatformKey = (_ePlatform)(int.Parse(xml_element.GetAttribute("PlatformKey")));
            platform_info.PlatformName = xml_element.GetAttribute("PlatformName");
            platform_info.BundleVersion = xml_element.GetAttribute("BundleVersion");
            platform_info.DataVersion = xml_element.GetAttribute("DataVersion");
            platform_info.PlatformTargetRootPath = CurrentProjectABTargetPath + "/" +
                platform_info.PlatformName + "/" + platform_info.BundleVersion + "/" + "DataVersion_";
            platform_info.BuildTarget = (BuildTarget)(int.Parse(xml_element.GetAttribute("BuildTarget")));
            platform_info.IsBuildPlatform = false;
            MapProjectPlatformInfo[platform_info.PlatformName] = platform_info;
        }
    }

19 Source : Triage.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static void TriageRDCManFile(Dictionary<string, string> MasterKeys, string rdcManFile, bool unprotect = false)
        {
            // triage a specific RDCMan.settings file

            if (!File.Exists(rdcManFile))
                return;

            var lastAccessed = File.GetLastAccessTime(rdcManFile);
            var lastModified = File.GetLastWriteTime(rdcManFile);

            var xmlDoc = new XmlDoreplacedent();
            xmlDoc.Load(rdcManFile);

            Console.WriteLine("    RDCManFile    : {0}", rdcManFile);
            Console.WriteLine("    Accessed      : {0}", lastAccessed);
            Console.WriteLine("    Modified      : {0}", lastModified);

            // show any recently used servers
            var recentlyUsed = xmlDoc.GetElementsByTagName("recentlyUsed");
            if (recentlyUsed[0]["server"] != null)
            {
                var recentlyUsedServer = recentlyUsed[0]["server"].InnerText;
                Console.WriteLine("    Recent Server : {0}", recentlyUsedServer);
            }

            // see if there are any credential profiles
            var credProfileNodes = xmlDoc.GetElementsByTagName("credentialsProfile");

            if ((credProfileNodes != null) && (credProfileNodes.Count != 0))
            {
                Console.WriteLine("\r\n        Cred Profiles");
            }
            foreach (XmlNode credProfileNode in credProfileNodes)
            {
                Console.WriteLine();
                DisplayCredProfile(MasterKeys, credProfileNode, unprotect);
            }

            // check default logonCredentials stuff
            var logonCredNodes = xmlDoc.GetElementsByTagName("logonCredentials");

            if ((logonCredNodes != null) && (logonCredNodes.Count != 0))
            {
                Console.WriteLine("\r\n        Default Logon Credentials");
            }
            foreach (XmlNode logonCredNode in logonCredNodes)
            {
                Console.WriteLine();
                DisplayCredProfile(MasterKeys, logonCredNode, unprotect);
            }

            // grab the recent RDG files
            var filesToOpen = xmlDoc.GetElementsByTagName("FilesToOpen");
            var items = filesToOpen[0].ChildNodes;

            // triage recently used RDG files
            foreach (XmlNode rdgFile in items)
            {
                if (Interop.PathIsUNC(rdcManFile))
                {
                    // If the RDCMan.settings file is a \\UNC path (so /server:X was used),
                    //  check if the .RDG file is local or also a \\UNC path.
                    if (!Interop.PathIsUNC(rdgFile.InnerText))
                    {
                        // If the file .RDG file is local, try to translate it to the server \\UNC path
                        var computerName = rdcManFile.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries)[0];
                        var rdgUncPath = Helpers.ConvertLocalPathToUNCPath(computerName, rdgFile.InnerText);
                        TriageRDGFile(MasterKeys, rdgUncPath, unprotect);
                    }
                    else
                    {
                        TriageRDGFile(MasterKeys, rdgFile.InnerText, unprotect);
                    }
                }
                else
                {
                    TriageRDGFile(MasterKeys, rdgFile.InnerText, unprotect);
                }
            }
            Console.WriteLine();
        }

19 Source : Triage.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static void TriagePSCredFile(Dictionary<string, string> MasterKeys, string credFile, bool unprotect = false)
        {
            // triage a saved PSCredential .xml
            //  example - `Get-Credential | Export-Clixml -Path C:\Temp\cred.xml`

            if (!File.Exists(credFile))
                throw new Exception($"PSCredential .xml); file '{credFile}' is not accessible or doesn't exist!\n");

            var lastAccessed = File.GetLastAccessTime(credFile);
            var lastModified = File.GetLastWriteTime(credFile);

            var xmlDoc = new XmlDoreplacedent();
            xmlDoc.Load(credFile);

            Console.WriteLine("    CredFile         : {0}", credFile);
            Console.WriteLine("    Accessed         : {0}", lastAccessed);
            Console.WriteLine("    Modified         : {0}", lastModified);

            var props = xmlDoc.GetElementsByTagName("Props");
            if (props.Count > 0)
            {
                var userName = props[0].ChildNodes[0].InnerText;
                var dpapiBlob = props[0].ChildNodes[1].InnerText;

                Console.WriteLine("    User Name        : {0}", userName);

                var blobBytes = Helpers.StringToByteArray(dpapiBlob);

                if (blobBytes.Length > 0)
                {
                    var decBytesRaw = Dpapi.DescribeDPAPIBlob(blobBytes, MasterKeys, "blob", unprotect);

                    if ((decBytesRaw != null) && (decBytesRaw.Length != 0))
                    {
                        var preplacedword = "";
                        var finalIndex = Array.LastIndexOf(decBytesRaw, (byte)0);
                        if (finalIndex > 1)
                        {
                            var decBytes = new byte[finalIndex + 1];
                            Array.Copy(decBytesRaw, 0, decBytes, 0, finalIndex);
                            preplacedword = Encoding.Unicode.GetString(decBytes);
                        }
                        else
                        {
                            preplacedword = Encoding.ASCII.GetString(decBytesRaw);
                        }

                        Console.WriteLine("    Preplacedword         : {0}", preplacedword);
                    }
                }
            }

            Console.WriteLine();
        }

19 Source : Triage.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static void TriageRDGFile(Dictionary<string, string> MasterKeys, string rdgFilePath, bool unprotect = false)
        {
            // parses a RDG connection file, decrypting any preplacedword blobs as appropriate

            if (File.Exists(rdgFilePath))
            {
                Console.WriteLine("\r\n      {0}", rdgFilePath);

                var xmlDoc = new XmlDoreplacedent();
                xmlDoc.Load(rdgFilePath);

                var credProfileNodes = xmlDoc.GetElementsByTagName("credentialsProfile");

                if ((credProfileNodes != null) && (credProfileNodes.Count != 0))
                {
                    Console.WriteLine("\r\n        Cred Profiles");
                }
                foreach (XmlNode credProfileNode in credProfileNodes)
                {
                    Console.WriteLine();
                    DisplayCredProfile(MasterKeys, credProfileNode, unprotect);
                }

                var servers = xmlDoc.GetElementsByTagName("server");

                if ((servers != null) && (servers.Count != 0))
                {
                    Console.WriteLine("\r\n        Servers");
                }

                foreach (XmlNode server in servers)
                {
                    try
                    {
                        if ((server["properties"]["name"] != null))
                        {
                            if (server["properties"]["displayName"] != null)
                            {
                                Console.WriteLine("\r\n          Name         : {0} ({1})", server["properties"]["name"].InnerText, server["properties"]["displayName"].InnerText);
                            }
                            else
                            {
                                Console.WriteLine("\r\n          Name         : {0}", server["properties"]["name"].InnerText);
                            }

                            if (server["logonCredentials"] != null)
                            {
                                DisplayCredProfile(MasterKeys, server["logonCredentials"], unprotect);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Exception: {0}", e);
                    }
                }
            }
            else
            {
                Console.WriteLine("\r\n      [X] .RDG file '{0}' is not accessible or doesn't exist!", rdgFilePath);
            }
        }

19 Source : Main.cs
with MIT License
from cwensley

public void ReadXml()
        {
            if (File.Exists(SettingsFile))
            {
                var doc = new XmlDoreplacedent();
                doc.Load(SettingsFile);
                var head = (XmlElement)doc.SelectSingleNode("pablo");

                Settings.ReadXml(head);

                var elem = (XmlElement)head.SelectSingleNode("main");
                if (elem != null)
                {
                    var dir = elem.GetAttribute("path");
                    if (Directory.Exists(dir))
                        FileList.Initialize(dir);
                }

                head.ReadChildXml("main-window", new WindowStateSaver(this));
            }
        }

19 Source : PrinterSettingInfoOp.cs
with GNU General Public License v3.0
from cymheart

public void AddPrinterSettingToFile(PrinterSettingInfo printerSettingInfo)
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement root;

            if (File.Exists(printerSettingPath))
            {
                xmlDoc.Load(printerSettingPath);//加载xml
            }
            else
            {
                XmlDeclaration xmldecl;
                xmldecl = xmlDoc.CreateXmlDeclaration("1.0", "gb2312", null);
                xmlDoc.AppendChild(xmldecl);

                //加入一个根元素     
                root = xmlDoc.CreateElement("Root");//创建一个<Root>节点 
                root.SetAttribute("name", "打印模块对应设置信息");//设置该节点genre属性 
                root.SetAttribute("ISBN", "2-3631-4");//设置该节点ISBN属性
                xmlDoc.AppendChild(root);

                XmlElement xesub1 = xmlDoc.CreateElement("Row");
                xesub1.SetAttribute("PrintModuleKey", printerSettingInfo.printModuleKey);//设置该节点打印模块关键字属性 
                xesub1.SetAttribute("PrinterName", printerSettingInfo.printerName);//设置该节点打印机名称属性 
                xesub1.SetAttribute("PageName", printerSettingInfo.pageName);
                xesub1.SetAttribute("PageSizeWidth", printerSettingInfo.pageSize.Width.ToString());//设置该节点打印机页面尺寸宽度属性 
                xesub1.SetAttribute("PageSizeHeight", printerSettingInfo.pageSize.Height.ToString());//设置该节点打印机页面尺寸高度属性        
                xesub1.SetAttribute("ExSettingFileName", printerSettingInfo.exSettingFileName);//设置该节点打印机扩展属性文件路径 
                root.AppendChild(xesub1);

                //保存创建好的XML文档
                Utils.CreateDir(printerSettingPath);
                xmlDoc.Save(printerSettingPath);
                return;
            }


            XmlNodeList xmlList = xmlDoc.GetElementsByTagName("Root"); //取得节点名为Root的XmlNode集合
            foreach (XmlNode xmlNode in xmlList)
            {
                XmlNodeList childList = xmlNode.ChildNodes; //取得row节点集合

                foreach (XmlNode cxmlNode in childList)
                {
                    if (cxmlNode.Attributes["PrintModuleKey"].Value == printerSettingInfo.printModuleKey)
                    {
                        cxmlNode.Attributes["PrinterName"].Value = printerSettingInfo.printerName;//设置该节点打印机名称属性 

                        cxmlNode.Attributes["PageName"].Value = printerSettingInfo.pageName;
                        cxmlNode.Attributes["PageSizeWidth"].Value = printerSettingInfo.pageSize.Width.ToString();//设置该节点打印机页面尺寸宽度属性 
                        cxmlNode.Attributes["PageSizeHeight"].Value = printerSettingInfo.pageSize.Height.ToString();//设置该节点打印机页面尺寸高度属性        

                        cxmlNode.Attributes["ExSettingFileName"].Value = printerSettingInfo.exSettingFileName;//设置该节点打印机扩展属性文件路径 
                        xmlDoc.Save(printerSettingPath);
                        return;
                    }
                }
            }

            XmlNodeList list = xmlDoc.GetElementsByTagName("Root");//创建一个<Node>节点 
            XmlNode rootx = list[0];
            XmlElement xesub = xmlDoc.CreateElement("Row");

            xesub.SetAttribute("PrintModuleKey", printerSettingInfo.printModuleKey);//设置该节点打印模块关键字属性 
            xesub.SetAttribute("PrinterName", printerSettingInfo.printerName);//设置该节点打印机名称属性 
            xesub.SetAttribute("PageName", printerSettingInfo.pageName);
            xesub.SetAttribute("PageSizeWidth", printerSettingInfo.pageSize.Width.ToString());//设置该节点打印机页面尺寸宽度属性 
            xesub.SetAttribute("PageSizeHeight", printerSettingInfo.pageSize.Height.ToString());//设置该节点打印机页面尺寸高度属性        
            xesub.SetAttribute("ExSettingFileName", printerSettingInfo.exSettingFileName);//设置该节点打印机扩展属性文件路径 
            rootx.AppendChild(xesub);

            //保存创建好的XML文档
            xmlDoc.Save(printerSettingPath);
        }

See More Examples