System.Xml.XmlNode.SelectSingleNode(string)

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

840 Examples 7

19 View Source File : DotNetToJScript.cs
License : MIT License
Project Creator : 1y0n

static string CreateScriptlet(string script, string script_name, bool register_script, Guid clsid)
        {
            XmlDoreplacedent doc = new XmlDoreplacedent();
            doc.LoadXml(Global_Var.scriptlet_template);
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;
            settings.Encoding = new UTF8Encoding(false);

            XmlElement reg_node = (XmlElement)doc.SelectSingleNode("/package/component/registration");
            XmlNode root_node = register_script ? reg_node : doc.SelectSingleNode("/package/component");
            XmlNode script_node = root_node.AppendChild(doc.CreateElement("script"));
            script_node.Attributes.Append(doc.CreateAttribute("language")).Value = script_name;
            script_node.AppendChild(doc.CreateCDataSection(script));
            if (clsid != Guid.Empty)
            {
                reg_node.SetAttribute("clreplacedid", clsid.ToString("B"));
            }

            using (MemoryStream stm = new MemoryStream())
            {
                using (XmlWriter writer = XmlWriter.Create(stm, settings))
                {
                    doc.Save(writer);
                }
                return Encoding.UTF8.GetString(stm.ToArray());
            }
        }

19 View Source File : FauxDeployCMAgent.cs
License : GNU General Public License v3.0
Project Creator : 1RedOne

public static void SendDiscovery(string CMServerName, string clientName, string domainName, string SiteCode,
            string CertPath, SecureString preplaced, SmsClientId clientId, ILog log, bool enumerateAndAddCustomDdr = false)
        {
            using (MessageCertificateX509Volatile certificate = new MessageCertificateX509Volatile(CertPath, preplaced))

            {
                //X509Certificate2 thisCert = new X509Certificate2(CertPath, preplaced);

                log.Info($"Got SMSID from registration of: {clientId}");

                // create base DDR Message
                ConfigMgrDataDiscoveryRecordMessage ddrMessage = new ConfigMgrDataDiscoveryRecordMessage
                {
                    // Add necessary discovery data
                    SmsId = clientId,
                    ADSiteName = "Default-First-Site-Name", //Changed from 'My-AD-SiteName
                    SiteCode = SiteCode,
                    DomainName = domainName,
                    NetBiosName = clientName
                };

                ddrMessage.Discover();
                // Add our certificate for message signing
                ddrMessage.AddCertificateToMessage(certificate, CertificatePurposes.Signing);
                ddrMessage.AddCertificateToMessage(certificate, CertificatePurposes.Encryption);
                ddrMessage.Settings.HostName = CMServerName;
                ddrMessage.Settings.Compression = MessageCompression.Zlib;
                ddrMessage.Settings.ReplyCompression = MessageCompression.Zlib;
                Debug.WriteLine("Sending [" + ddrMessage.DdrInstances.Count + "] instances of Discovery data to CM");
                if (enumerateAndAddCustomDdr)
                {
                    //see current value for the DDR message
                    var OSSetting = ddrMessage.DdrInstances.OfType<InventoryInstance>().Where(m => m.Clreplaced == "CCM_DiscoveryData");

                    ////retrieve actual setting
                    string osCaption = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast<ManagementObject>()
                                        select x.GetPropertyValue("Caption")).FirstOrDefault().ToString();

                    XmlDoreplacedent xmlDoc = new XmlDoreplacedent();

                    ////retrieve reported value
                    xmlDoc.LoadXml(ddrMessage.DdrInstances.OfType<InventoryInstance>().FirstOrDefault(m => m.Clreplaced == "CCM_DiscoveryData")?.InstanceDataXml.ToString());

                    ////Set OS to correct setting
                    xmlDoc.SelectSingleNode("/CCM_DiscoveryData/PlatformID").InnerText = "Microsoft Windows NT Server 10.0";

                    ////Remove the instance
                    ddrMessage.DdrInstances.Remove(ddrMessage.DdrInstances.OfType<InventoryInstance>().FirstOrDefault(m => m.Clreplaced == "CCM_DiscoveryData"));

                    CMFauxStatusViewClreplacedesFixedOSRecord FixedOSRecord = new CMFauxStatusViewClreplacedesFixedOSRecord
                    {
                        PlatformId = osCaption
                    };
                    InventoryInstance instance = new InventoryInstance(FixedOSRecord);

                    ////Add new instance
                    ddrMessage.DdrInstances.Add(instance);
                }

                ddrMessage.SendMessage(Sender);

                ConfigMgrHardwareInventoryMessage hinvMessage = new ConfigMgrHardwareInventoryMessage();
                hinvMessage.Settings.HostName = CMServerName;
                hinvMessage.SmsId = clientId;
                hinvMessage.Settings.Compression = MessageCompression.Zlib;
                hinvMessage.Settings.ReplyCompression = MessageCompression.Zlib;
                //hinvMessage.Settings.Security.EncryptMessage = true;
                hinvMessage.Discover();

                var Clreplacedes = CMFauxStatusViewClreplacedes.GetWMIClreplacedes();
                foreach (string Clreplaced in Clreplacedes)
                {
                    try { hinvMessage.AddInstancesToInventory(WmiClreplacedToInventoryReportInstance.WmiClreplacedToInventoryInstances(@"root\cimv2", Clreplaced)); }
                    catch { log.Info($"!!!Adding clreplaced : [{Clreplaced}] :( not found on this system"); }
                }

                var SMSClreplacedes = new List<string> { "SMS_Processor", "CCM_System", "SMS_LogicalDisk" };
                foreach (string Clreplaced in SMSClreplacedes)
                {
                    log.Info($"---Adding clreplaced : [{Clreplaced}]");
                    try { hinvMessage.AddInstancesToInventory(WmiClreplacedToInventoryReportInstance.WmiClreplacedToInventoryInstances(@"root\cimv2\sms", Clreplaced)); }
                    catch { log.Info($"!!!Adding clreplaced : [{Clreplaced}] :( not found on this system"); }
                }

                hinvMessage.AddCertificateToMessage(certificate, CertificatePurposes.Signing | CertificatePurposes.Encryption);
                hinvMessage.Validate(Sender);
                hinvMessage.SendMessage(Sender);
            };
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public List<ServiceDefinition> ReadServices(XmlDoreplacedent doreplacedent, Dictionary<String, AccessMapping> accessMappings)
        {
            List<ServiceDefinition> definitions = new List<ServiceDefinition>();

            XmlNodeList servicesNodeList = doreplacedent.SelectNodes("//" + s_services);
            if (servicesNodeList == null)
            {
                return definitions;
            }

            foreach (XmlNode servicesNode in servicesNodeList)
            {
                // Get all of the service definition nodes
                foreach (XmlNode definitionNode in servicesNode.SelectNodes("./" + s_serviceDefinition))
                {
                    ServiceDefinition definition = new ServiceDefinition();

                    // Get the service type - it must exist
                    XmlNode serviceTypeNode = definitionNode.SelectSingleNode("./" + s_serviceType);
                    LocationXmlOperator.CheckXmlNodeNullOrEmpty(serviceTypeNode, s_serviceType, definitionNode);
                    definition.ServiceType = serviceTypeNode.InnerText;

                    // Get the identifier if it exists - it must exist if this is the client cache
                    XmlNode identifierNode = definitionNode.SelectSingleNode("./" + s_identifier);
                    if (m_isClientCache)
                    {
                        LocationXmlOperator.CheckXmlNodeNullOrEmpty(identifierNode, s_identifier, definitionNode);
                    }
                    definition.Identifier = (identifierNode != null) ? XmlConvert.ToGuid(identifierNode.InnerText) : Guid.Empty;

                    // Get the display name - it must exist
                    XmlNode displayNameNode = definitionNode.SelectSingleNode("./" + s_displayName);
                    LocationXmlOperator.CheckXmlNodeNullOrEmpty(displayNameNode, s_displayName, definitionNode);
                    definition.DisplayName = displayNameNode.InnerText;

                    // Get the description if it exists
                    XmlNode descriptionNode = definitionNode.SelectSingleNode("./" + s_description);
                    definition.Description = (descriptionNode != null) ? descriptionNode.InnerText : String.Empty;

                    // Get the relativePath and the relativeTo setting
                    XmlNode relativePathNode = definitionNode.SelectSingleNode("./" + s_relativePath);
                    LocationXmlOperator.CheckXmlNodeNull(relativePathNode, s_relativePath, definitionNode);
                    definition.RelativePath = relativePathNode.InnerText;

                    // Get the relativeTo setting
                    XmlAttribute relativeToAttribute = relativePathNode.Attributes[s_relativeTo];
                    CheckXmlAttributeNullOrEmpty(relativeToAttribute, s_relativeTo, relativePathNode);
                    RelativeToSetting setting;
                    if (!RelativeToEnumCache.GetRelativeToEnums().TryGetValue(relativeToAttribute.InnerText, out setting))
                    {
                        throw new ConfigFileException(relativeToAttribute.InnerText);
                    }
                    definition.RelativeToSetting = setting;

                    // If the relativeToSetting is FullyQualified and the path is empty, set it to null
                    // to make the framework happy.
                    if (definition.RelativeToSetting == RelativeToSetting.FullyQualified && definition.RelativePath == String.Empty)
                    {
                        definition.RelativePath = null;
                    }

                    XmlNode parentServiceTypeNode = definitionNode.SelectSingleNode("./" + s_parentServiceType);
                    definition.ParentServiceType = (parentServiceTypeNode != null) ? parentServiceTypeNode.InnerText : null;
                    
                    XmlNode parentIdentifierNode = definitionNode.SelectSingleNode("./" + s_parentIdentifier);
                    definition.ParentIdentifier = (parentIdentifierNode != null) ? XmlConvert.ToGuid(parentIdentifierNode.InnerText) : Guid.Empty;

                    // Get all of the location mappings
                    definition.LocationMappings = new List<LocationMapping>();
                    if (definition.RelativeToSetting == RelativeToSetting.FullyQualified)
                    {
                        XmlNodeList mappings = definitionNode.SelectNodes(".//" + s_locationMapping);

                        foreach (XmlNode mappingNode in mappings)
                        {
                            LocationMapping locationMapping = new LocationMapping();

                            // Get the accessMapping
                            XmlNode accessMappingNode = mappingNode.SelectSingleNode("./" + s_accessMapping);
                            LocationXmlOperator.CheckXmlNodeNullOrEmpty(accessMappingNode, s_accessMapping, mappingNode);
                            locationMapping.AccessMappingMoniker = accessMappingNode.InnerText;

                            // Only process the location code if this is the client cache and there better
                            // not be a location node if this isn't a client cache.
                            XmlNode locationNode = mappingNode.SelectSingleNode("./" + s_location);
                            if (m_isClientCache)
                            {
                                CheckXmlNodeNullOrEmpty(locationNode, s_location, mappingNode);
                            }

                            locationMapping.Location = (locationNode != null) ? locationNode.InnerText : null;

                            // We will let the caller build the proper location from the proper service definitions
                            // instead of doing it here.

                            definition.LocationMappings.Add(locationMapping);
                        }
                    }

                    // Get the resourceVersion
                    XmlNode resourceVersionNode = definitionNode.SelectSingleNode("./" + s_resourceVersion);
                    definition.ResourceVersion = (resourceVersionNode != null) ? XmlConvert.ToInt32(resourceVersionNode.InnerText) : 0;

                    // Get the minVersion
                    XmlNode minVersionNode = definitionNode.SelectSingleNode("./" + s_minVersion);
                    definition.MinVersionString = (minVersionNode != null) ? minVersionNode.InnerText : null;

                    // Get the maxVersion
                    XmlNode maxVersionNode = definitionNode.SelectSingleNode("./" + s_maxVersion);
                    definition.MaxVersionString = (maxVersionNode != null) ? maxVersionNode.InnerText : null;

                    // Get the releasedVersion
                    XmlNode releasedVersionNode = definitionNode.SelectSingleNode("./" + s_releasedVersion);
                    definition.ReleasedVersionString = (releasedVersionNode != null) ? releasedVersionNode.InnerText : null;

                    definitions.Add(definition);
                }
            }

            return definitions;
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public List<AccessMapping> ReadAccessMappings(XmlDoreplacedent doreplacedent)
        {
            List<AccessMapping> accessMappings = new List<AccessMapping>();

            XmlNodeList accessMappingNodeList = doreplacedent.SelectNodes("//" + s_accessMappings);
            if (accessMappingNodeList == null)
            {
                return accessMappings;
            }

            foreach (XmlNode accessMappingsNode in accessMappingNodeList)
            {
                foreach (XmlNode accessMappingNode in accessMappingsNode.SelectNodes("./" + s_accessMapping))
                {
                    AccessMapping accessMapping = new AccessMapping();

                    // Get the moniker
                    XmlNode monikerNode = accessMappingNode.SelectSingleNode("./" + s_moniker);
                    CheckXmlNodeNullOrEmpty(monikerNode, s_moniker, accessMappingNode);
                    accessMapping.Moniker = monikerNode.InnerText;

                    // Get the enabled property
                    XmlNode accessPointNode = accessMappingNode.SelectSingleNode("./" + s_accessPoint);
                    CheckXmlNodeNullOrEmpty(accessPointNode, s_accessPoint, accessMappingNode);
                    accessMapping.AccessPoint = accessPointNode.InnerText;

                    // Get the displayName property
                    XmlNode displayNameNode = accessMappingNode.SelectSingleNode("./" + s_displayName);
                    accessMapping.DisplayName = (displayNameNode != null) ? displayNameNode.InnerText : null;

                    XmlNode virtualDirectoryNode = accessMappingNode.SelectSingleNode("./" + s_virtualDirectory);
                    accessMapping.VirtualDirectory = (virtualDirectoryNode != null) ? virtualDirectoryNode.InnerText : null;

                    // If this isn't the client cache, load the location service url
                    if (!m_isClientCache)
                    {
                        XmlNode locationServiceUrlNode = accessMappingNode.SelectSingleNode("./" + s_locationServiceUrl);
                        String locationServiceUrl = (locationServiceUrlNode != null) ? locationServiceUrlNode.InnerText : String.Empty;
                        m_accessMappingLocationServiceUrls[accessMapping.Moniker] = locationServiceUrl;
                    }

                    accessMappings.Add(accessMapping);
                }
            }

            return accessMappings;
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public Int32 ReadLastChangeId(XmlDoreplacedent doreplacedent)
        {
            XmlNode lastChangeIdNode = doreplacedent.SelectSingleNode("//" + s_lastChangeId);
            return (lastChangeIdNode != null) ? XmlConvert.ToInt32(lastChangeIdNode.InnerText) : -1;
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public DateTime ReadCacheExpirationDate(XmlDoreplacedent doreplacedent)
        {
            XmlNode cacheExpirationDateNode = doreplacedent.SelectSingleNode("//" + s_cacheExpirationDate);
            return (cacheExpirationDateNode != null) ? XmlConvert.ToDateTime(cacheExpirationDateNode.InnerText, XmlDateTimeSerializationMode.Utc) : DateTime.MinValue;
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public String ReadDefaultAccessMappingMoniker(XmlDoreplacedent doreplacedent)
        {
            XmlNode defaultAccessMappingMonikerNode = doreplacedent.SelectSingleNode("//" + s_defaultAccessMappingMoniker);
            CheckXmlNodeNullOrEmpty(defaultAccessMappingMonikerNode, s_defaultAccessMappingMoniker, doreplacedent);
            return defaultAccessMappingMonikerNode.InnerText;
        }

19 View Source File : LocationXmlOperator.cs
License : MIT License
Project Creator : actions

public String ReadVirtualDirectory(XmlDoreplacedent doreplacedent)
        {
            XmlNode virtualDirectoryNode = doreplacedent.SelectSingleNode("//" + s_virtualDirectory);
            CheckXmlNodeNull(virtualDirectoryNode, s_virtualDirectory, doreplacedent);
            return virtualDirectoryNode.InnerText;
        }

19 View Source File : CoverageService.cs
License : MIT License
Project Creator : ademanuele

protected virtual XmlNode ParseRunSettings(string runSettingsFile)
    {
      try
      {
        using FileStream settingsFileStream = new FileStream(runSettingsFile, FileMode.Open);
        using StreamReader reader = new StreamReader(settingsFileStream);
        string xml = reader.ReadToEnd();
        XmlDoreplacedent doreplacedent = new XmlDoreplacedent();
        doreplacedent.Load(runSettingsFile);
        string providerName = provider.RunSettingsDataCollectorFriendlyName;
        string settingsXpath = $"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector[@friendlyName='{providerName}']";
        return doreplacedent.DoreplacedentElement.SelectSingleNode(settingsXpath);
      } catch
      {
        return null;
      }
    }

19 View Source File : ExceptionInfo.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

private static RemoteExceptionInfoItem DeserializeException(XmlNode par)
        {
            RemoteExceptionInfoItem item = null ;
            var me = par.SelectSingleNode(@"./Exception") ;
            if(me != null)
            {
                item = new RemoteExceptionInfoItem() ;
                var Type = me.SelectSingleNode("//Type") ;
                if(Type != null)
                {
                    item.Type = Type.InnerText ;
                }
                //LogRecorder.Trace(item.Type) ;
                //XmlNode Message = me.SelectSingleNode("//Message") ;
                //if (Message != null)
                //    item.Message = HttpUtility.UrlDecode(Message.InnerText);
                //Agebull.Common.Logging.LogRecorder.Trace(item.Message);
                //XmlNode Source = me.SelectSingleNode("//Source");
                //if (Source != null)
                //    item.Source = Source.InnerText;
                //XmlNode StackTrace = me.SelectSingleNode("//StackTrace");
                //if (StackTrace != null)
                //    item.StackTrace = HttpUtility.UrlDecode(StackTrace.InnerText);
                //Agebull.Common.Logging.LogRecorder.Trace(item.StackTrace);
                //XmlNode Reason = me.SelectSingleNode("//Reason");
                //if (Reason != null)
                //    item.Reason = HttpUtility.UrlDecode(Reason.InnerText);
                //Agebull.Common.Logging.LogRecorder.Trace(item.Reason);
                //XmlNode ErrorCode = me.SelectSingleNode("//ErrorCode");
                //if (ErrorCode != null)
                //    item.ErrorCode = HttpUtility.UrlDecode(ErrorCode.InnerText);
                //Agebull.Common.Logging.LogRecorder.Trace(item.ErrorCode);
                //XmlNode ErrorMessage = me.SelectSingleNode("//ErrorMessage");
                //if (ErrorMessage != null)
                //    item.ErrorMessage = HttpUtility.UrlDecode(ErrorMessage.InnerText);
                //Agebull.Common.Logging.LogRecorder.Trace(item.ErrorMessage);
                item.Item = DeserializeException(me) ;
            }
            return item ;
        }

19 View Source File : ConfigurationBase.cs
License : GNU General Public License v3.0
Project Creator : aiportal

public void LoadConfiguration(string filename)
		{
			try
			{
				byte[] bs = File.ReadAllBytes(filename);
				string xml = Encryption.Decrypt(Convert.ToBase64String(bs));

				XmlDoreplacedent doc = new XmlDoreplacedent();
				doc.LoadXml(xml);
				XmlNode root = doc.SelectSingleNode(ROOT_ELEMENT);

				Dictionary<string, object> dic = new Dictionary<string, object>();
				for (int i = 0; i < root.ChildNodes.Count; ++i)
					dic[root.ChildNodes[i].Name] = root.ChildNodes[i].InnerText;

				this.SetConfigurations(dic);
			}
			catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
		}

19 View Source File : ClassTypeEditor.cs
License : GNU General Public License v3.0
Project Creator : alexgracianoarj

private void RefreshIdenreplacedyGeneratorParameters()
        {
            XmlDoreplacedent xmlGeneratorParameters = new XmlDoreplacedent();
            
            if (!string.IsNullOrEmpty(Shape.CompositeType.GeneratorParameters))
                xmlGeneratorParameters.LoadXml(Shape.CompositeType.GeneratorParameters);

            if (Shape.CompositeType.IdGenerator == "HiLo")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;
                
                CodeGenerator.HiLoIdenreplacedyGeneratorParameters hiLo = null;

                if(xmlGeneratorParameters.SelectSingleNode("//HiLoIdenreplacedyGeneratorParameters") != null)
                    hiLo = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.HiLoIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    hiLo = new CodeGenerator.HiLoIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = hiLo;
            }
            else if (Shape.CompositeType.IdGenerator == "SeqHiLo")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;

                CodeGenerator.SeqHiLoIdenreplacedyGeneratorParameters seqHiLo = null;

                if (xmlGeneratorParameters.SelectSingleNode("//SeqHiLoIdenreplacedyGeneratorParameters") != null)
                    seqHiLo = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.SeqHiLoIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    seqHiLo = new CodeGenerator.SeqHiLoIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = seqHiLo;
            }
            else if (Shape.CompositeType.IdGenerator == "Sequence")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;
                
                CodeGenerator.SequenceIdenreplacedyGeneratorParameters sequence = null;

                if (xmlGeneratorParameters.SelectSingleNode("//SequenceIdenreplacedyGeneratorParameters") != null)
                    sequence = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.SequenceIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    sequence = new CodeGenerator.SequenceIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = sequence;
            }
            else if (Shape.CompositeType.IdGenerator == "UuidHex")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;

                CodeGenerator.UuidHexIdenreplacedyGeneratorParameters uuidHex = null;

                if (xmlGeneratorParameters.SelectSingleNode("//UuidHexIdenreplacedyGeneratorParameters") != null)
                    uuidHex = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.UuidHexIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    uuidHex = new CodeGenerator.UuidHexIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = uuidHex;
            }
            else if (Shape.CompositeType.IdGenerator == "Foreign")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;

                CodeGenerator.ForeignIdenreplacedyGeneratorParameters foreign = null;

                if (xmlGeneratorParameters.SelectSingleNode("//ForeignIdenreplacedyGeneratorParameters") != null)
                    foreign = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.ForeignIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    foreign = new CodeGenerator.ForeignIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = foreign;
            }
            else if (Shape.CompositeType.IdGenerator == "Custom")
            {
                this.Height = pnlGeneratorParameters.Bottom + pnlGeneratorParameters.Margin.Bottom;

                CodeGenerator.CustomIdenreplacedyGeneratorParameters custom = null;

                if (xmlGeneratorParameters.SelectSingleNode("//CustomIdenreplacedyGeneratorParameters") != null)
                    custom = CodeGenerator.GeneratorParametersDeSerializer.Deserialize<CodeGenerator.CustomIdenreplacedyGeneratorParameters>(Shape.CompositeType.GeneratorParameters);
                else
                {
                    Shape.CompositeType.GeneratorParameters = null;
                    custom = new CodeGenerator.CustomIdenreplacedyGeneratorParameters();
                }

                prgGeneratorParameters.SelectedObject = custom;
            }
            else
            {
                this.Height = pnlAdvancedOptions.Bottom + pnlAdvancedOptions.Margin.Bottom;
                Shape.CompositeType.GeneratorParameters = null;
            }
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldNotSavePatternString_WhenPatternStringIsFalse()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.PatternString = false;
            mSut.Save(xmlDoc, appender);

            XmlNode fileNode = appender.SelectSingleNode("file");

            replacedert.IsNull(fileNode?.Attributes?["type"]);
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveAppendTo_WhenOverwriteIsTrue()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Overwrite = true;
            mSut.Save(xmlDoc, appender);

            XmlNode appendToNode = appender.SelectSingleNode("appendToFile");

            replacedert.IsNotNull(appendToNode);
            replacedert.AreEqual("false", appendToNode.Attributes?["value"].Value);
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveFilePath()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.FilePath = "filepath";
            mSut.Save(xmlDoc, appender);

            XmlNode fileNode = appender.SelectSingleNode("file");

            replacedert.IsNotNull(fileNode);
            replacedert.AreEqual("filepath", fileNode.Attributes?["value"].Value);
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSavePatternString_WhenPatternStringIsTrue()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.PatternString = true;
            mSut.Save(xmlDoc, appender);

            XmlNode fileNode = appender.SelectSingleNode("file");

            replacedert.AreEqual("log4net.Util.PatternString", fileNode?.Attributes?["type"].Value);
        }

19 View Source File : FixTest.cs
License : MIT License
Project Creator : alexleen

[TestCase(FixFlags.None)]
        [TestCase(FixFlags.Partial)]
        [TestCase(FixFlags.Message | FixFlags.ThreadName | FixFlags.LocationInfo | FixFlags.UserName | FixFlags.Domain | FixFlags.Idenreplacedy | FixFlags.Exception | FixFlags.Properties)]
        public void Save_ShouldSaveCorrectly(FixFlags flags)
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            foreach (FixModel fixModel in mSut.Fixes)
            {
                fixModel.Enabled = flags.HasFlag(fixModel.Flag);
            }

            mSut.Save(xmlDoc, appender);

            XmlNode fixNode = appender.SelectSingleNode("Fix");

            replacedert.IsNotNull(fixNode);
            replacedert.AreEqual(((int)flags).ToString(), fixNode.Attributes?["value"].Value);
        }

19 View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave_WhenNotComposite()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedMode = RollingFileAppender.RollingMode.Date;
            mSut.Save(xmlDoc, appender);

            XmlNode rollingStyleNode = appender.SelectSingleNode("rollingStyle");

            replacedert.IsNotNull(rollingStyleNode);
            replacedert.AreEqual("Date", rollingStyleNode.Attributes["value"].Value);
        }

19 View Source File : StringMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement filterElement = xmlDoc.CreateElement("filter");

            mSut.Value = "match";
            mSut.Save(xmlDoc, filterElement);

            XmlNode stringNode = filterElement.SelectSingleNode("stringToMatch");

            replacedert.IsNotNull(stringNode);
            replacedert.AreEqual(mSut.Value, stringNode.Attributes["value"].Value);
        }

19 View Source File : TargetTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfConsoleError()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedItem = ConsoleError;
            mSut.Save(xmlDoc, appender);

            XmlNode targetNode = appender.SelectSingleNode("target");

            replacedert.IsNotNull(targetNode);
            replacedert.AreEqual(ConsoleError, targetNode.Attributes?["value"].Value);
        }

19 View Source File : ThresholdTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("threshold");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : EnumPropertyTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = MailPriority.High.ToString();
            mSut.Save(xmlDoc, appenderElement);

            XmlNode element = appenderElement.SelectSingleNode("elementName");
            replacedert.IsNotNull(element);
            replacedert.AreEqual(mSut.SelectedValue, element.Attributes["value"].Value);
        }

19 View Source File : BackColorTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("mapping");

            mSut.SelectedColor = ConsoleColor.Blue;
            mSut.Save(xmlDoc, appender);

            XmlNode backColorNode = appender.SelectSingleNode("backColor");

            replacedert.IsNotNull(backColorNode);
            replacedert.AreEqual(ConsoleColor.Blue.ToString(), backColorNode.Attributes?["value"].Value);
        }

19 View Source File : EncodingTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldNotSaveSelectedValue_WhenNotSelected()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.Save(xmlDoc, appenderElement);

            replacedert.IsNull(appenderElement.SelectSingleNode("encoding"));
        }

19 View Source File : EncodingTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedValue_WhenSelected()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = "whatev";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode encodingElement = appenderElement.SelectSingleNode("encoding");
            replacedert.IsNotNull(encodingElement);
            replacedert.AreEqual(mSut.SelectedValue, encodingElement.Attributes["value"].Value);
        }

19 View Source File : ForeColorTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("mapping");

            mSut.SelectedColor = ConsoleColor.Blue;
            mSut.Save(xmlDoc, appender);

            XmlNode foreColorNode = appender.SelectSingleNode("foreColor");

            replacedert.IsNotNull(foreColorNode);
            replacedert.AreEqual(ConsoleColor.Blue.ToString(), foreColorNode.Attributes?["value"].Value);
        }

19 View Source File : LevelPropertyTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("level");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : LevelToMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("levelToMatch");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : LockingModelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfNotExclusive()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedModel = LockingModelDescriptor.Minimal;
            mSut.Save(xmlDoc, appender);

            XmlNode modelNode = appender.SelectSingleNode("lockingModel");

            replacedert.IsNotNull(modelNode);
            replacedert.AreEqual(LockingModelDescriptor.Minimal.TypeNamespace, modelNode.Attributes?["type"].Value);
        }

19 View Source File : MaximumFileSizeTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfNotDefault()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Value = "100MB";
            mSut.Save(xmlDoc, appender);

            XmlNode maxFileSizeNode = appender.SelectSingleNode("maximumFileSize");

            replacedert.IsNotNull(maxFileSizeNode);
            replacedert.AreEqual(mSut.Value, maxFileSizeNode.Attributes["value"].Value);
        }

19 View Source File : MaxLevelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode levelNode = appender.SelectSingleNode("levelMax");

            replacedert.IsNotNull(levelNode);
            replacedert.AreEqual(Level.All.Name, levelNode.Attributes?["value"].Value);
        }

19 View Source File : MaxSizeRollBackupsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveCorrectly()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Value = "1";
            mSut.Save(xmlDoc, appender);

            XmlNode maxSizeNode = appender.SelectSingleNode("maxSizeRollBackups");

            replacedert.IsNotNull(maxSizeNode);
            replacedert.AreEqual("1", maxSizeNode.Attributes?["value"].Value);
        }

19 View Source File : MinLevelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode levelNode = appender.SelectSingleNode("levelMin");

            replacedert.IsNotNull(levelNode);
            replacedert.AreEqual(Level.All.Name, levelNode.Attributes?["value"].Value);
        }

19 View Source File : RegexMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement filterElement = xmlDoc.CreateElement("filter");

            mSut.Value = "match";
            mSut.Save(xmlDoc, filterElement);

            XmlNode regexNode = filterElement.SelectSingleNode("regexToMatch");

            replacedert.IsNotNull(regexNode);
            replacedert.AreEqual(mSut.Value, regexNode.Attributes["value"].Value);
        }

19 View Source File : RemoteAddressTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.Value = "1.2.3.4";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode regexNode = appenderElement.SelectSingleNode("remoteAddress");

            replacedert.IsNotNull(regexNode);
            replacedert.AreEqual(mSut.Value, regexNode.Attributes["value"].Value);
        }

19 View Source File : RemoteIdentityTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.Value = "str";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode idenreplacedyNode = appenderElement.SelectSingleNode("idenreplacedy");

            replacedert.IsNotNull(idenreplacedyNode);
            replacedert.AreEqual(mSut.Value, idenreplacedyNode.Attributes[Log4NetXmlConstants.Value].Value);
            replacedert.AreEqual(LayoutDescriptor.Pattern.TypeNamespace, idenreplacedyNode.Attributes[Log4NetXmlConstants.Type].Value);
        }

19 View Source File : OutgoingRefs.cs
License : MIT License
Project Creator : alexleen

public override void Load(XmlNode originalNode)
        {
            foreach (AppenderModel appenderModel in RefsCollection)
            {
                appenderModel.IsEnabled = originalNode.SelectSingleNode($"appender-ref[@ref='{appenderModel.Name}']") != null;
            }
        }

19 View Source File : CheckForUpdates.cs
License : Apache License 2.0
Project Creator : AmpScm

private static string NodeText(XmlDoreplacedent doc, string xpath)
        {
            XmlNode node = doc.SelectSingleNode(xpath);

            if (node != null)
                return node.InnerText;

            return null;
        }

19 View Source File : NMSConnectionFactory.cs
License : Apache License 2.0
Project Creator : apache

private static bool LookupConnectionFactoryInfo(string[] paths, string scheme, out string replacedemblyFileName,
            out string factoryClreplacedName)
        {
            bool foundFactory = false;
            string schemeLower = scheme.ToLower();
            ProviderFactoryInfo pfi;

            // Look for a custom configuration to handle this scheme.
            string configFileName = String.Format("nmsprovider-{0}.config", schemeLower);

            replacedemblyFileName = String.Empty;
            factoryClreplacedName = String.Empty;

            Tracer.DebugFormat("Attempting to locate provider configuration: {0}", configFileName);
            foreach (string path in paths)
            {
                string fullpath = Path.Combine(path, configFileName);
                Tracer.DebugFormat("Looking for: {0}", fullpath);

                try
                {
                    if (File.Exists(fullpath))
                    {
                        Tracer.DebugFormat("\tConfiguration file found in {0}", fullpath);
                        XmlDoreplacedent configDoc = new XmlDoreplacedent();

                        configDoc.Load(fullpath);
                        XmlElement providerNode = (XmlElement) configDoc.SelectSingleNode("/configuration/provider");

                        if (null != providerNode)
                        {
                            replacedemblyFileName = providerNode.GetAttribute("replacedembly");
                            factoryClreplacedName = providerNode.GetAttribute("clreplacedFactory");
                            if (!String.IsNullOrEmpty(replacedemblyFileName) && !String.IsNullOrEmpty(factoryClreplacedName))
                            {
                                foundFactory = true;
                                Tracer.DebugFormat("Selected custom provider for {0}: {1}, {2}", schemeLower,
                                    replacedemblyFileName, factoryClreplacedName);
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Tracer.DebugFormat("Exception while scanning {0}: {1}", fullpath, ex.Message);
                }
            }

            if (!foundFactory)
            {
                // Check for standard provider implementations.
                if (schemaProviderFactoryMap.TryGetValue(schemeLower, out pfi))
                {
                    replacedemblyFileName = pfi.replacedemblyFileName;
                    factoryClreplacedName = pfi.factoryClreplacedName;
                    foundFactory = true;
                    Tracer.DebugFormat("Selected standard provider for {0}: {1}, {2}", schemeLower, replacedemblyFileName,
                        factoryClreplacedName);
                }
            }

            return foundFactory;
        }

19 View Source File : NMSTestSupport.cs
License : Apache License 2.0
Project Creator : apache

protected string GetConfiguredConnectionURI()
        {
            Uri brokerUri = null;
            string[] paths = GetConfigSearchPaths();
            string connectionConfigFileName = GetConnectionConfigFileName();
            bool configFound = false;

            foreach (string path in paths)
            {
                string fullpath = Path.Combine(path, connectionConfigFileName);
                Tracer.Debug("\tScanning folder: " + path);

                if (File.Exists(fullpath))
                {
                    Tracer.Debug("\treplacedembly found!");
                    connectionConfigFileName = fullpath;
                    configFound = true;
                    break;
                }
            }

            replacedert.IsTrue(configFound, "Connection configuration file does not exist.");
            XmlDoreplacedent configDoc = new XmlDoreplacedent();

            configDoc.Load(connectionConfigFileName);
            XmlElement uriNode =
                (XmlElement) configDoc.SelectSingleNode(String.Format("/configuration/{0}", GetNameTestURI()));

            if (null != uriNode)
            {
                // Replace any environment variables embedded inside the string.
                brokerUri = new Uri(ReplaceEnvVar(uriNode.GetAttribute("value")));
            }

            return brokerUri.ToString();
        }

19 View Source File : NMSTestSupport.cs
License : Apache License 2.0
Project Creator : apache

protected bool CreateNMSFactory(string nameTestURI)
        {
            Uri brokerUri = null;
            string[] paths = GetConfigSearchPaths();
            object[] factoryParams = null;
            string connectionConfigFileName = GetConnectionConfigFileName();
            bool configFound = false;

            foreach (string path in paths)
            {
                string fullpath = Path.Combine(path, connectionConfigFileName);
                Tracer.Debug("\tScanning folder: " + path);

                if (File.Exists(fullpath))
                {
                    Tracer.Debug("\treplacedembly found!");
                    connectionConfigFileName = fullpath;
                    configFound = true;
                    break;
                }
            }

            replacedert.IsTrue(configFound, "Connection configuration file does not exist.");
            XmlDoreplacedent configDoc = new XmlDoreplacedent();

            configDoc.Load(connectionConfigFileName);
            XmlElement uriNode =
                (XmlElement) configDoc.SelectSingleNode(String.Format("/configuration/{0}", nameTestURI));

            if (null != uriNode)
            {
                // Replace any environment variables embedded inside the string.
                brokerUri = new Uri(ReplaceEnvVar(uriNode.GetAttribute("value")));
                factoryParams = GetFactoryParams(uriNode);
                clientId = ReplaceEnvVar(GetNodeValueAttribute(uriNode, "clientId", "NMSTestClientId"));
                userName = ReplaceEnvVar(GetNodeValueAttribute(uriNode, "userName", "guest"));
                preplacedWord = ReplaceEnvVar(GetNodeValueAttribute(uriNode, "preplacedWord", "guest"));
            }

            if (null == factoryParams)
            {
                NMSFactory = new Apache.NMS.NMSConnectionFactory(brokerUri);
            }
            else
            {
                NMSFactory = new Apache.NMS.NMSConnectionFactory(brokerUri, factoryParams);
            }

            return (null != NMSFactory);
        }

19 View Source File : NMSTestSupport.cs
License : Apache License 2.0
Project Creator : apache

protected object[] GetFactoryParams(XmlElement uriNode)
        {
            ArrayList factoryParams = new ArrayList();
            XmlElement factoryParamsNode = (XmlElement) uriNode.SelectSingleNode("factoryParams");

            if (null != factoryParamsNode)
            {
                XmlNodeList nodeList = factoryParamsNode.SelectNodes("param");

                if (null != nodeList)
                {
                    foreach (XmlElement paramNode in nodeList)
                    {
                        string paramType = paramNode.GetAttribute("type");
                        string paramValue = ReplaceEnvVar(paramNode.GetAttribute("value"));

                        switch (paramType)
                        {
                            case "string":
                                factoryParams.Add(paramValue);
                                break;

                            case "int":
                                factoryParams.Add(int.Parse(paramValue));
                                break;

                            // TODO: Add more parameter types
                        }
                    }
                }
            }

            if (factoryParams.Count > 0)
            {
                return factoryParams.ToArray();
            }

            return null;
        }

19 View Source File : NMSTestSupport.cs
License : Apache License 2.0
Project Creator : apache

protected static string GetNodeValueAttribute(XmlElement parentNode, string nodeName, string dflt)
        {
            XmlElement node = (XmlElement) parentNode.SelectSingleNode(nodeName);
            string val;

            if (null != node)
            {
                val = node.GetAttribute("value");
            }
            else
            {
                val = dflt;
            }

            return val;
        }

19 View Source File : XmlMethodLoader.cs
License : MIT License
Project Creator : arasplm

public XmlMethodInfo LoadMethod(string path)
		{
			XmlMethodInfo methodInfo = null;

			if (File.Exists(path))
			{
				try
				{
					var xmlDoreplacedent = new XmlDoreplacedent();
					xmlDoreplacedent.Load(path);
					XmlNode itemXmlNode = xmlDoreplacedent.SelectSingleNode("AML/Item");
					XmlNode nameTypeXmlNode = itemXmlNode.SelectSingleNode("name");
					XmlNode methodTypeXmlNode = itemXmlNode.SelectSingleNode("method_type");
					XmlNode methodCodeXmlNode = itemXmlNode.SelectSingleNode("method_code");

					methodInfo = new XmlMethodInfo()
					{
						Path = path,
						MethodName = nameTypeXmlNode.InnerText,
						MethodType = methodTypeXmlNode.InnerText,
						Code = methodCodeXmlNode.InnerText
					};
				}
				catch
				{

				}
			}

			return methodInfo;
		}

19 View Source File : ProjectConfigurationManager.cs
License : MIT License
Project Creator : arasplm

private XmlDoreplacedent MapProjectConfigToXmlDoc(IProjectConfiguraiton configuration)
		{
			//TODO: Refactoring: move to constant. All hardcoded sting should be constants if using more then 2 times.
			string configTempalte = "<?xml version = '1.0\' encoding = 'utf-8' ?><projectinfo><lastSelectedDir></lastSelectedDir><lastSelectedMfFile></lastSelectedMfFile><connections></connections><MethodsFolderPath></MethodsFolderPath><MethodConfigPath></MethodConfigPath><IOMFilePath></IOMFilePath><methods></methods><lastSavedSearch></lastSavedSearch><useVSFormatting></useVSFormatting><UseCommonProjectStructure></UseCommonProjectStructure><OpenFromPackageLastSearchType></OpenFromPackageLastSearchType></projectinfo>";

			var xmlDoc = new XmlDoreplacedent();
			xmlDoc.LoadXml(configTempalte);
			var lastSelectedDir = xmlDoc.SelectSingleNode("projectinfo/lastSelectedDir");
			lastSelectedDir.InnerText = configuration.LastSelectedDir;

			var lastSelectedMfFile = xmlDoc.SelectSingleNode("projectinfo/lastSelectedMfFile");
			lastSelectedMfFile.InnerText = configuration.LastSelectedMfFile;

			var usedVSFormat = xmlDoc.SelectSingleNode("projectinfo/useVSFormatting");
			usedVSFormat.InnerText = configuration.UseVSFormatting.ToString();

			var useCommonProjectStructureXmlNode = xmlDoc.SelectSingleNode("projectinfo/UseCommonProjectStructure");
			useCommonProjectStructureXmlNode.InnerText = configuration.UseCommonProjectStructure.ToString();

			var openFromPackageLastSearchType = xmlDoc.SelectSingleNode("projectinfo/OpenFromPackageLastSearchType");
			openFromPackageLastSearchType.InnerText = configuration.LastSelectedSearchTypeInOpenFromPackage;

			XmlNode methodsFolderPathNode = xmlDoc.SelectSingleNode("projectinfo/MethodsFolderPath");
			methodsFolderPathNode.InnerText = configuration.MethodsFolderPath;

			XmlNode methodConfigPathNode = xmlDoc.SelectSingleNode("projectinfo/MethodConfigPath");
			methodConfigPathNode.InnerText = configuration.MethodConfigPath;

			XmlNode IOMFilePathNode = xmlDoc.SelectSingleNode("projectinfo/IOMFilePath");
			IOMFilePathNode.InnerText = configuration.IOMFilePath;

			var connectionInfoXmlNode = xmlDoc.SelectSingleNode("projectinfo/connections");
			foreach (var connectionInfo in configuration.Connections)
			{
				XmlElement connectionInfoNode = xmlDoc.CreateElement("connectionInfo");

				XmlElement serverUrl = xmlDoc.CreateElement("serverUrl");
				serverUrl.InnerText = connectionInfo.ServerUrl;
				connectionInfoNode.AppendChild(serverUrl);

				XmlElement databaseName = xmlDoc.CreateElement("databaseName");
				databaseName.InnerText = connectionInfo.Database;
				connectionInfoNode.AppendChild(databaseName);

				XmlElement login = xmlDoc.CreateElement("login");
				login.InnerText = connectionInfo.Login;
				connectionInfoNode.AppendChild(login);

				XmlElement lastConnection = xmlDoc.CreateElement("lastConnection");
				lastConnection.InnerText = connectionInfo.LastConnection.ToString();
				connectionInfoNode.AppendChild(lastConnection);

				connectionInfoXmlNode.AppendChild(connectionInfoNode);
			}

			var methodInfoXmlNode = xmlDoc.SelectSingleNode("projectinfo/methods");
			foreach (var methodInfo in configuration.MethodInfos)
			{
				XmlElement metohdInfoNode = xmlDoc.CreateElement("methodInfo");

				XmlElement innovatorMethodConfigId = xmlDoc.CreateElement("configId");
				innovatorMethodConfigId.InnerText = methodInfo.InnovatorMethodConfigId;
				metohdInfoNode.AppendChild(innovatorMethodConfigId);

				XmlElement innovatorMethodId = xmlDoc.CreateElement("id");
				innovatorMethodId.InnerText = methodInfo.InnovatorMethodId;
				metohdInfoNode.AppendChild(innovatorMethodId);

				XmlElement methodName = xmlDoc.CreateElement("methodName");
				methodName.InnerText = methodInfo.MethodName;
				metohdInfoNode.AppendChild(methodName);

				XmlElement methodType = xmlDoc.CreateElement("methodType");
				methodType.InnerText = methodInfo.MethodType;
				metohdInfoNode.AppendChild(methodType);

				XmlElement comments = xmlDoc.CreateElement("comments");
				comments.InnerText = methodInfo.MethodComment;
				metohdInfoNode.AppendChild(comments);

				XmlElement language = xmlDoc.CreateElement("language");
				language.InnerText = methodInfo.MethodLanguage;
				metohdInfoNode.AppendChild(language);

				XmlElement templateName = xmlDoc.CreateElement("templateName");
				templateName.InnerText = methodInfo.TemplateName;
				metohdInfoNode.AppendChild(templateName);

				XmlElement packageName = xmlDoc.CreateElement("packageName");
				packageName.InnerText = methodInfo.Package.Name;
				metohdInfoNode.AppendChild(packageName);

				XmlElement eventData = xmlDoc.CreateElement("eventData");
				eventData.InnerText = methodInfo.EventData.ToString();
				metohdInfoNode.AppendChild(eventData);

				XmlElement executionAllowedTo = xmlDoc.CreateElement("executionAllowedTo");
				executionAllowedTo.InnerText = methodInfo.ExecutionAllowedToId;

				XmlAttribute executionAllowedToKeyedName = xmlDoc.CreateAttribute("keyedName");
				executionAllowedToKeyedName.InnerText = methodInfo.ExecutionAllowedToKeyedName;
				executionAllowedTo.Attributes.Append(executionAllowedToKeyedName);
				metohdInfoNode.AppendChild(executionAllowedTo);
				if (methodInfo is PackageMethodInfo)
				{
					var packageMethodInfo = (PackageMethodInfo)methodInfo;
					XmlElement manifestFileName = xmlDoc.CreateElement("manifestFileName");
					manifestFileName.InnerText = packageMethodInfo.ManifestFileName;
					metohdInfoNode.AppendChild(manifestFileName);
				}

				methodInfoXmlNode.AppendChild(metohdInfoNode);
			}

			var lastSavedSearchXmlNode = xmlDoc.SelectSingleNode("projectinfo/lastSavedSearch");
			foreach (var lastSavedSearch in configuration.LastSavedSearch)
			{
				string itemTypeName = lastSavedSearch.Key;
				List<PropertyInfo> properties = lastSavedSearch.Value;

				XmlElement searchItemNode = xmlDoc.CreateElement("searchItem");

				XmlAttribute itemTypeNameXmlAttribute = xmlDoc.CreateAttribute("itemTypeName");
				itemTypeNameXmlAttribute.InnerText = itemTypeName;
				searchItemNode.Attributes.Append(itemTypeNameXmlAttribute);

				foreach (PropertyInfo property in properties)
				{
					if (property.IsReadonly || string.IsNullOrEmpty(property.PropertyValue))
					{
						continue;
					}

					XmlElement propertyXmlElement = xmlDoc.CreateElement("property");

					XmlElement propertyName = xmlDoc.CreateElement("propertyName");
					propertyName.InnerText = property.PropertyName;
					propertyXmlElement.AppendChild(propertyName);

					XmlElement propertyValue = xmlDoc.CreateElement("propertyValue");
					propertyValue.InnerText = property.PropertyValue;
					propertyXmlElement.AppendChild(propertyValue);

					searchItemNode.AppendChild(propertyXmlElement);
					lastSavedSearchXmlNode.AppendChild(searchItemNode);
				}
			}

			return xmlDoc;
		}

19 View Source File : ProjectConfigurationManager.cs
License : MIT License
Project Creator : arasplm

private IProjectConfiguraiton MapXmlDocToProjectConfig(IProjectConfiguraiton projectConfiguration, XmlDoreplacedent xmlDoc)
		{
			projectConfiguration.LastSelectedDir = xmlDoc.SelectSingleNode("projectinfo/lastSelectedDir")?.InnerText;
			projectConfiguration.LastSelectedMfFile = xmlDoc.SelectSingleNode("projectinfo/lastSelectedMfFile")?.InnerText;
			bool.TryParse(xmlDoc.SelectSingleNode("projectinfo/useVSFormatting")?.InnerText, out bool isUsedVSFormatting);
			projectConfiguration.UseVSFormatting = isUsedVSFormatting;
			bool.TryParse(xmlDoc.SelectSingleNode("projectinfo/UseCommonProjectStructure")?.InnerText, out bool isUsedCommonProjectStructure);
			projectConfiguration.UseCommonProjectStructure = isUsedCommonProjectStructure;

			projectConfiguration.LastSelectedSearchTypeInOpenFromPackage = xmlDoc.SelectSingleNode("projectinfo/OpenFromPackageLastSearchType")?.InnerText;
			projectConfiguration.MethodsFolderPath = xmlDoc.SelectSingleNode("projectinfo/MethodsFolderPath")?.InnerText ?? DefaultMethodsFolderPath;
			projectConfiguration.MethodConfigPath = xmlDoc.SelectSingleNode("projectinfo/MethodConfigPath")?.InnerText ?? DefaultMethodConfigFilePath;
			projectConfiguration.IOMFilePath = xmlDoc.SelectSingleNode("projectinfo/IOMFilePath")?.InnerText ?? DefaultIOMDllFilePath;

			var connectionInfoXmlNodes = xmlDoc.SelectNodes("projectinfo/connections/connectionInfo");
			foreach (XmlNode connectionInfoNode in connectionInfoXmlNodes)
			{
				var connectionInfo = new ConnectionInfo();
				connectionInfo.ServerUrl = connectionInfoNode.SelectSingleNode("serverUrl").InnerText;
				connectionInfo.Database = connectionInfoNode.SelectSingleNode("databaseName").InnerText;
				connectionInfo.Login = connectionInfoNode.SelectSingleNode("login").InnerText;

				bool value;
				if (bool.TryParse(connectionInfoNode.SelectSingleNode("lastConnection")?.InnerText, out value))
				{
					connectionInfo.LastConnection = value;
				}

				projectConfiguration.AddConnection(connectionInfo);
			}
			var methodInfoXmlNodes = xmlDoc.SelectNodes("projectinfo/methods/methodInfo");
			foreach (XmlNode methodInfoNode in methodInfoXmlNodes)
			{
				XmlNode manifestFileNameNode = methodInfoNode.SelectSingleNode("manifestFileName");
				MethodInfo methodInfo;
				if (manifestFileNameNode != null)
				{
					methodInfo = new PackageMethodInfo()
					{
						ManifestFileName = manifestFileNameNode.InnerText
					};
				}
				else
				{
					methodInfo = new MethodInfo();
				}

				methodInfo.InnovatorMethodConfigId = methodInfoNode.SelectSingleNode("configId").InnerText;
				methodInfo.InnovatorMethodId = methodInfoNode.SelectSingleNode("id").InnerText;
				methodInfo.MethodName = methodInfoNode.SelectSingleNode("methodName").InnerText;
				methodInfo.MethodType = methodInfoNode.SelectSingleNode("methodType").InnerText;
				methodInfo.MethodComment = methodInfoNode.SelectSingleNode("comments")?.InnerText;
				methodInfo.MethodLanguage = methodInfoNode.SelectSingleNode("language").InnerText;
				methodInfo.TemplateName = methodInfoNode.SelectSingleNode("templateName").InnerText;
				methodInfo.Package = new PackageInfo(methodInfoNode.SelectSingleNode("packageName").InnerText);

				EventSpecificData eventData;
				if (Enum.TryParse(methodInfoNode.SelectSingleNode("eventData")?.InnerText, out eventData))
				{
					methodInfo.EventData = eventData;
				}
				else
				{
					methodInfo.EventData = EventSpecificData.None;
				}

				XmlNode executionAllowedTo = methodInfoNode.SelectSingleNode("executionAllowedTo");
				XmlAttribute executionAllowedKeyedName = executionAllowedTo.Attributes["keyedName"];
				methodInfo.ExecutionAllowedToId = executionAllowedTo.InnerText;
				methodInfo.ExecutionAllowedToKeyedName = executionAllowedKeyedName.InnerText;

				projectConfiguration.MethodInfos.Add(methodInfo);
			}

			var searchItemNodes = xmlDoc.SelectNodes("projectinfo/lastSavedSearch/searchItem");
			foreach (XmlNode searchItemNode in searchItemNodes)
			{
				string itemTypeName = searchItemNode.Attributes["itemTypeName"]?.InnerText;
				if (string.IsNullOrEmpty(itemTypeName))
					continue;
				var properties = new List<PropertyInfo>();
				var propertyNodes = searchItemNode.SelectNodes("property");

				foreach (XmlNode propertyNode in propertyNodes)
				{
					var savedSearch = new PropertyInfo();
					savedSearch.PropertyName = propertyNode.SelectSingleNode("propertyName").InnerText;
					savedSearch.PropertyValue = propertyNode.SelectSingleNode("propertyValue").InnerText;

					properties.Add(savedSearch);
				}


				projectConfiguration.LastSavedSearch.Add(itemTypeName, properties);
			}

			return projectConfiguration;
		}

19 View Source File : SaveToPackageCmd.cs
License : MIT License
Project Creator : arasplm

public override void ExecuteCommandImpl(object sender, EventArgs args)
		{
			TemplateLoader templateLoader = new TemplateLoader();
			templateLoader.Load(projectManager.MethodConfigPath);

			var packageManager = new PackageManager(authManager, this.messageManager);

			string selectedMethodPath = projectManager.MethodPath;
			string selectedMethodName = Path.GetFileNameWithoutExtension(selectedMethodPath);
			MethodInfo methodInformation = projectConfigurationManager.CurrentProjectConfiguraiton.MethodInfos.FirstOrDefault(m => m.MethodName == selectedMethodName);
			if (methodInformation == null)
			{
				throw new Exception();
			}

			string manifastFileName;
			if (methodInformation is PackageMethodInfo)
			{
				PackageMethodInfo packageMethodInfo = (PackageMethodInfo)methodInformation;
				manifastFileName = packageMethodInfo.ManifestFileName;
			}
			else
			{
				manifastFileName = "imports.mf";
			}

			string packageMethodFolderPath = this.projectConfigurationManager.CurrentProjectConfiguraiton.UseCommonProjectStructure ? methodInformation.Package.MethodFolderPath : string.Empty;
			string methodWorkingFolder = Path.Combine(projectManager.ServerMethodFolderPath, packageMethodFolderPath, methodInformation.MethodName);

			ICodeProvider codeProvider = codeProviderFactory.GetCodeProvider(projectManager.Language);

			string sourceCode = File.ReadAllText(selectedMethodPath, new UTF8Encoding(true));
			CodeInfo codeItemInfo = codeProvider.UpdateSourceCodeToInsertExternalItems(methodWorkingFolder, sourceCode, methodInformation, projectConfigurationManager.CurrentProjectConfiguraiton.UseVSFormatting);
			if (codeItemInfo != null)
			{
				var dialogResult = dialogFactory.GetMessageBoxWindow().ShowDialog(messageManager.GetMessage("CouldNotInsertExternalItemsInsideOfMethodCodeSection"),
					messageManager.GetMessage("ArasVSMethodPlugin"),
					MessageButtons.OKCancel,
					MessageIcon.Question);
				if (dialogResult == MessageDialogResult.Cancel)
				{
					return;
				}

				projectManager.AddItemTemplateToProjectNew(codeItemInfo, packageMethodFolderPath, true, 0);
				sourceCode = codeItemInfo.Code;
			}

			var saveView = dialogFactory.GetSaveToPackageView(projectConfigurationManager.CurrentProjectConfiguraiton, templateLoader, packageManager, codeProvider, projectManager, methodInformation, sourceCode);
			var saveViewResult = saveView.ShowDialog();
			if (saveViewResult?.DialogOperationResult != true)
			{
				return;
			}

			string pathPackageToSaveMethod;
			string rootPath = saveViewResult.PackagePath;
			string importFilePath = Path.Combine(rootPath, manifastFileName);
			if (File.Exists(importFilePath))
			{
				var xmlDoreplacedent = new XmlDoreplacedent();
				xmlDoreplacedent.Load(importFilePath);
				XmlNode importsXmlNode = xmlDoreplacedent.SelectSingleNode("imports");
				XmlNode packageXmlNode = importsXmlNode.SelectSingleNode($"package[@name='{saveViewResult.SelectedPackage}']");

				if (packageXmlNode == null)
				{
					XmlElement packageXmlElement = xmlDoreplacedent.CreateElement("package");
					packageXmlElement.SetAttribute("name", saveViewResult.SelectedPackage.Name);
					packageXmlElement.SetAttribute("path", saveViewResult.SelectedPackage.Path);
					importsXmlNode.AppendChild(packageXmlElement);

					XmlWriterSettings settings = new XmlWriterSettings();
					settings.Encoding = new UTF8Encoding(true);
					settings.Indent = true;
					settings.IndentChars = "\t";
					settings.OmitXmlDeclaration = true;
					using (XmlWriter xmlWriter = XmlWriter.Create(importFilePath, settings))
					{
						xmlDoreplacedent.Save(xmlWriter);
					}

				}
				else
				{
					pathPackageToSaveMethod = packageXmlNode.Attributes["path"].Value;
				}
			}
			else
			{
				var xmlDoreplacedent = new XmlDoreplacedent();
				XmlElement importsXmlNode = xmlDoreplacedent.CreateElement("imports");
				XmlElement packageXmlElement = xmlDoreplacedent.CreateElement("package");
				packageXmlElement.SetAttribute("name", saveViewResult.SelectedPackage.Name);
				packageXmlElement.SetAttribute("path", saveViewResult.SelectedPackage.Path);
				importsXmlNode.AppendChild(packageXmlElement);
				xmlDoreplacedent.AppendChild(importsXmlNode);

				XmlWriterSettings settings = new XmlWriterSettings();
				settings.Indent = true;
				settings.IndentChars = "\t";
				settings.OmitXmlDeclaration = true;
				settings.Encoding = new UTF8Encoding(true);
				using (XmlWriter xmlWriter = XmlWriter.Create(importFilePath, settings))
				{
					xmlDoreplacedent.Save(xmlWriter);
				}
			}

			string methodPath = Path.Combine(rootPath, saveViewResult.SelectedPackage.MethodFolderPath);
			Directory.CreateDirectory(methodPath);

			string methodId = null;
			string methodFilePath = Path.Combine(methodPath, $"{saveViewResult.MethodName}.xml");
			if (File.Exists(methodFilePath))
			{
				var methodXmlDoreplacedent = new XmlDoreplacedent();
				methodXmlDoreplacedent.Load(methodFilePath);
				methodId = methodXmlDoreplacedent.SelectSingleNode("/AML/Item/@id").InnerText;
			}
			else
			{
				methodId = saveViewResult.MethodInformation.InnovatorMethodConfigId;
			}

			string updateMethodCodeForSavingToAmlPackage = saveViewResult.MethodCode.Replace("]]>", "]]]]><![CDATA[>");
			string methodTemplate = [email protected]"<AML>
 <Item type=""Method"" id=""{methodId}"" action=""add"">" +
  (!string.IsNullOrWhiteSpace(saveViewResult.MethodComment) ? $"<comments>{saveViewResult.MethodComment}</comments>" : "") +
  [email protected]"<execution_allowed_to keyed_name=""{saveViewResult.SelectedIdenreplacedyKeyedName}"" type=""Idenreplacedy"">{saveViewResult.SelectedIdenreplacedyId}</execution_allowed_to>
  <method_code><![CDATA[{updateMethodCodeForSavingToAmlPackage}]]></method_code>
  <method_type>{saveViewResult.MethodInformation.MethodLanguage}</method_type>
  <name>{saveViewResult.MethodName}</name>
 </Item>
</AML>";

			XmlDoreplacedent resultXmlDoc = new XmlDoreplacedent();
			resultXmlDoc.LoadXml(methodTemplate);
			SaveToFile(methodFilePath, resultXmlDoc);

			if (methodInformation.MethodName == saveViewResult.MethodName &&
				methodInformation.Package.Name == saveViewResult.SelectedPackage.Name)
			{
				methodInformation.Package = saveViewResult.SelectedPackage;
				methodInformation.ExecutionAllowedToKeyedName = saveViewResult.SelectedIdenreplacedyKeyedName;
				methodInformation.ExecutionAllowedToId = saveViewResult.SelectedIdenreplacedyId;
				methodInformation.MethodComment = saveViewResult.MethodComment;
			}

			projectConfigurationManager.CurrentProjectConfiguraiton.LastSelectedDir = rootPath;
			projectConfigurationManager.Save(projectManager.ProjectConfigPath);

			// Show a message box to prove we were here
			var messageWindow = dialogFactory.GetMessageBoxWindow();
			messageWindow.ShowDialog(this.messageManager.GetMessage("MethodSavedToPackage", saveViewResult.MethodName, saveViewResult.SelectedPackage.Name),
				string.Empty,
				MessageButtons.OK,
				MessageIcon.Information);
		}

19 View Source File : GlobalConfiguration.cs
License : MIT License
Project Creator : arasplm

public void Load()
		{
			string filePath = this.ConfigFilePath;
			if (!this.iIOWrapper.FileExists(filePath))
			{
				this.configXmlDoreplacedent = new XmlDoreplacedent();
				this.configurationXmlElement = this.configXmlDoreplacedent.CreateElement(configuration);
				this.userCodeTemplatesXmlElement = this.configXmlDoreplacedent.CreateElement(userCodeTemplates);

				this.configurationXmlElement.AppendChild(this.userCodeTemplatesXmlElement);
				this.configXmlDoreplacedent.AppendChild(this.configurationXmlElement);
			}
			else
			{
				this.configXmlDoreplacedent = this.iIOWrapper.XmlDoreplacedentLoad(filePath);
				this.configurationXmlElement = (XmlElement)this.configXmlDoreplacedent.SelectSingleNode(configuration);
				this.userCodeTemplatesXmlElement = (XmlElement)this.configurationXmlElement.SelectSingleNode(userCodeTemplates);
			}
		}

19 View Source File : DebugMethodViewModelTest.cs
License : MIT License
Project Creator : arasplm

[OneTimeSetUp]
		public void LoadMethodInfo()
		{
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string methodFullPath = Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\TestMethodItem.xml");

			XmlDoreplacedent testMethodItemXMLDoc = new XmlDoreplacedent();
			testMethodItemXMLDoc.Load(methodFullPath);

			this.methodCode = testMethodItemXMLDoc.SelectSingleNode("//method_code").InnerText;
			this.methodInformation = new MethodInfo()
			{
				InnovatorMethodConfigId = testMethodItemXMLDoc.SelectSingleNode("//config_id").InnerText,
				MethodType = "server",
				MethodName = testMethodItemXMLDoc.SelectSingleNode("//name").InnerText,
				MethodLanguage = "C#",
				EventData = EventSpecificData.None
			};
		}

19 View Source File : OpenFromPackageViewModel.cs
License : MIT License
Project Creator : arasplm

private void OnFolderBrowserCommandClicked()
		{
			var actualFolderPath = GetActualFolderPath();
			var viewAdapter = this.dialogFactory.GetOpenFromPackageTreeView(actualFolderPath, this.Package, this.MethodName, this.SelectedSearchType);
			var dialogResult = viewAdapter.ShowDialog();

			if (dialogResult.DialogOperationResult == true)
			{
				this.Package = dialogResult.SelectedPackage.Name.Split('\\')[0];
				this.SelectedManifestFilePath = dialogResult.SelectedPath;
				this.SelectedSearchType = dialogResult.SelectedSearchType;

				var xmlDoreplacedent = new XmlDoreplacedent();
				xmlDoreplacedent.Load(dialogResult.SelectedMethodFullName);
				XmlNode itemXmlNode = xmlDoreplacedent.SelectSingleNode("AML/Item");
				XmlNode commentsXmlNode = itemXmlNode.SelectSingleNode("comments");
				XmlNode methodCodeXmlNode = itemXmlNode.SelectSingleNode("method_code");
				XmlNode executionAllowedToXmlNode = itemXmlNode.SelectSingleNode("execution_allowed_to");
				XmlNode methodTypeXmlNode = itemXmlNode.SelectSingleNode("method_type");
				XmlNode nameTypeXmlNode = itemXmlNode.SelectSingleNode("name");

				this.MethodLanguage = methodTypeXmlNode.InnerText;

				if (methodLanguage == "C#" || methodLanguage == "VB")
				{
					this.MethodType = "server";
				}
				else
				{
					this.MethodType = "client";
				}

				this.MethodComment = commentsXmlNode?.InnerText;
				this.MethodCode = methodCodeXmlNode.InnerText;
				this.IdenreplacedyKeyedName = executionAllowedToXmlNode.Attributes["keyed_name"].InnerText;
				this.IdenreplacedyId = executionAllowedToXmlNode.InnerText;
				this.MethodName = nameTypeXmlNode.InnerText;
				this.MethodConfigId = itemXmlNode.Attributes["id"].InnerText;
				this.MethodId = itemXmlNode.Attributes["id"].InnerText;

				TemplateInfo template;
				string templateName = templateLoader.GetMethodTemplateName(methodCode);
				if (string.IsNullOrEmpty(templateName))
				{
					template = templateLoader.GetDefaultTemplate(methodLanguage);
				}
				else
				{
					template = templateLoader.GetTemplateFromCodeString(templateName, methodLanguage);
					if (template == null)
					{
						var messageWindow = this.dialogFactory.GetMessageBoxWindow();
						messageWindow.ShowDialog(messageManager.GetMessage("TheTemplateFromSelectedMethodNotFoundDefaultTemplateWillBeUsed", templateName),
							"Open method from AML package",
							MessageButtons.OK,
							MessageIcon.Information);

						template = templateLoader.GetDefaultTemplate(methodLanguage);
					}
				}

				this.SelectedTemplate = template;
			}
		}

See More Examples