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 View Source File : GlobalAppHelper.cs
License : MIT License
Project Creator : aspose-gis

private void initResources(string ResourcesFile, string SessionID)
		{
			SessionID = "R" + SessionID;
			if (AsposeGISContext.Current.Cache[SessionID] == null)
			{
				// Added to solve the file not found problem, the wait is one time only when the application initializes or replacedociated files are modified
				//System.Threading.Thread.Sleep(500);
				Dictionary<string, string> resources = new Dictionary<string, string>();
				XmlDoreplacedent xd = new XmlDoreplacedent();
				// TextWriter tr = (TextWriter)File.CreateText("F:\\replacedets\\my.log");tr.WriteLine(ResourcesFile);
				// tr.WriteLine(File.Exists(ResourcesFile)); tr.Close();
				if (ResourcesFile.Trim() != "")
				{
					xd.Load(ResourcesFile);
				}
				XmlNodeList xl = xd.SelectNodes("resources/res"); // use xpath to reach the res tag within resources
				foreach (XmlNode n in xl) // read the name attribute for key name and values from in between the tags
					resources.Add(n.Attributes["name"].Value, n.InnerText);

				// Add this dictionary into the cache with no expiration and replacedociate a reload method in case of file change


				AsposeGISContext.Current.Cache.Add(
				   SessionID,
					resources,
					new CacheDependency(ResourcesFile),
					Cache.NoAbsoluteExpiration,
					Cache.NoSlidingExpiration,
					CacheItemPriority.NotRemovable,
					delegate (string key, object value, CacheItemRemovedReason reason) { initResources(ResourcesFile, SessionID); });
			}
		}

19 View Source File : HelpGeneratorBase.cs
License : Apache License 2.0
Project Creator : aws

private void LoadExamplesCache()
        {
            var examplesPath = Path.Combine(Options.RootPath, "generator", "AWSPSGeneratorLib", "HelpMaterials", "Examples");
            Console.WriteLine("Loading example files from {0}", Path.GetFullPath(examplesPath));

            ExamplesCache = new Dictionary<string, XmlDoreplacedent>();
            var serviceSubFolders = Directory.GetDirectories(examplesPath, "*.*", SearchOption.TopDirectoryOnly);
            foreach (var serviceFolder in serviceSubFolders)
            {
                var exampleFiles = Directory.GetFiles(serviceFolder, "*.xml");
                foreach (var exampleFile in exampleFiles)
                {
                    var doreplacedent = new XmlDoreplacedent {PreserveWhitespace = true};
                    doreplacedent.Load(exampleFile);
                    var cmdletName = Path.GetFileNameWithoutExtension(exampleFile);
                    ExamplesCache[cmdletName] = doreplacedent;
                    Console.WriteLine("...loaded examples for {0}", cmdletName);
                }
            }

            Console.WriteLine();
        }

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

[Test]
		public void AddUserCodeTemplatePath_Should()
		{
			//Arange
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string configFilePath = Path.Combine(currentPath, @"Configurations\TestData\config.xml");
			MockConfigFilePath(configFilePath);
			this.iOWrapper.FileExists(configFilePath).Returns(File.Exists(configFilePath));

			XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(configFilePath);
			this.iOWrapper.XmlDoreplacedentLoad(configFilePath).Returns(xmlDoreplacedent);

			GlobalConfigurationTestProxy globalConfigurationTest = new GlobalConfigurationTestProxy(this.iOWrapper);

			//Act
			globalConfigurationTest.AddUserCodeTemplatePath("testUserCodeTemplatePath3");

			//replacedert
			replacedert.NotNull(globalConfigurationTest.ConfigXmlDoreplacedent.SelectSingleNode("//userCodeTemplate[text()=\"testUserCodeTemplatePath3\"]"));
		}

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

[SetUp]
		public void Setup()
		{
			this.innovatorUser = new InnovatorUser();
			this.serverConnection = Subsreplacedute.For<IServerConnection>();
			this.innovatorInstance = new Innovator(this.serverConnection);
			this.iOMWrapper = Subsreplacedute.For<IIOMWrapper>();

			this.authManager = new AuthenticationManagerProxy(serverConnection, innovatorInstance, innovatorUser, iOMWrapper);
			this.dialogFactory = Subsreplacedute.For<IDialogFactory>();
			this.projectConfigurationManager = Subsreplacedute.For<IProjectConfigurationManager>();
			this.projectConfiguration = Subsreplacedute.For<IProjectConfiguraiton>();
			this.messageManager = Subsreplacedute.For<MessageManager>();
			this.packageManager = new PackageManager(authManager, messageManager);
			this.arasDataProvider = Subsreplacedute.For<IArasDataProvider>();
			this.methodInformation = new MethodInfo();
			this.templateLoader = new TemplateLoader();
			this.projectManager = Subsreplacedute.For<IProjectManager>();
			this.codeProvider = Subsreplacedute.For<ICodeProvider>();
			this.globalConfiguration = Subsreplacedute.For<IGlobalConfiguration>();

			this.globalConfiguration.GetUserCodeTemplatesPaths().Returns(new List<string>());

			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is<XmlDoreplacedent>(doc => doc.DoreplacedentElement.Attributes["type"].Value == "Value"), Arg.Any<XmlDoreplacedent>()))
								.Do(x =>
								{
									(x[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\ActionLocationsListValue.xml"));
								});

			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is<XmlDoreplacedent>(doc => doc.DoreplacedentElement.Attributes["type"].Value == "Filter Value"), Arg.Any<XmlDoreplacedent>()))
								.Do(x =>
								{
									(x[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodTypesListFilterValue.xml"));
								});

			this.projectConfiguration.LastSavedSearch.Returns(new Dictionary<string, List<PropertyInfo>>());

			XmlDoreplacedent methodItemTypeAML = new XmlDoreplacedent();
			methodItemTypeAML.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml"));

			Item methodItemType = this.innovatorInstance.newItem();
			methodItemType.loadAML(methodItemTypeAML.OuterXml);

			this.arasDataProvider.GetMethodItemTypeInfo().Returns(new MethodItemTypeInfo(methodItemType, messageManager));

			this.createMethodViewModel = new CreateMethodViewModel(authManager,
					dialogFactory,
					projectConfiguration,
					templateLoader,
					packageManager,
					projectManager,
					arasDataProvider,
					codeProvider,
					globalConfiguration,
					messageManager);

		}

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

public void Load(string templatesFileText)
		{
			XmlDoreplacedent doc = new XmlDoreplacedent();
			doc.Load(templatesFileText);

			var supportedTemlates = doc.GetElementsByTagName("Support");
			foreach (XmlNode item in supportedTemlates)
			{
				supportedTemplates.Add(item.Attributes["template"].InnerText);
			}
			supportedTemplates = supportedTemplates.Distinct().ToList();
			var templateElements = doc.GetElementsByTagName("Template");
			foreach (XmlNode item in templateElements)
			{
				var templateName = item.Attributes["name"].InnerText;

				bool isSuccessfullySupported = true;
				bool value;
				if (bool.TryParse(item.Attributes["isSupported"]?.InnerText, out value))
				{
					isSuccessfullySupported = value;
				}

				string message = item.Attributes["message"]?.InnerText;
				var templateIsSupported = supportedTemplates.Contains(templateName);
				var templateCode = item.InnerText;
				string templateLanguage = string.Empty;
				if (templateCode.Contains("Imports Microsoft.VisualBasic"))
				{
					templateLanguage = "VB";
				}
				if (templateCode.Contains("using System;"))
				{
					templateLanguage = "C#";
				}
				var template = new TemplateInfo()
				{
					TemplateName = templateName,
					IsSuccessfullySupported = isSuccessfullySupported,
					Message = message,
					IsSupported = templateIsSupported,
					TemplateCode = templateCode,
					TemplateLanguage = templateLanguage
				};

				templates.Add(template);
			}
		}

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

[Test]
		public void Ctor_ShouldLoadExistedXmlDoreplacedent()
		{
			//Arange
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string configFilePath = Path.Combine(currentPath, @"Configurations\TestData\config.xml");
			MockConfigFilePath(configFilePath);
			this.iOWrapper.FileExists(configFilePath).Returns(File.Exists(configFilePath));

			XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(configFilePath);
			this.iOWrapper.XmlDoreplacedentLoad(configFilePath).Returns(xmlDoreplacedent);

			//Act
			GlobalConfigurationTestProxy globalConfigurationTest = new GlobalConfigurationTestProxy(this.iOWrapper);

			//replacedert
			replacedert.AreEqual(xmlDoreplacedent.InnerXml, globalConfigurationTest.ConfigXmlDoreplacedent.InnerXml);
		}

19 View Source File : GenerationSources.cs
License : Apache License 2.0
Project Creator : aws

public (replacedembly replacedembly, XmlDoreplacedent Ndoc, IEnumerable<string> Dependencies) Load(string baseName, bool addAsReference = true)
        {
            if (string.IsNullOrEmpty(SdkreplacedembliesFolder))
            {
                throw new InvalidOperationException("Expected 'SdkNugetFolder' to have been set prior to calling Load(...)");
            }

            SdkVersionsUtils.EnsureSdkLibraryIsAvailable(baseName, SdkreplacedembliesFolder, PlatformsToExtractLibrariesFor);
            var dependencies = SdkVersionsUtils.GetDependencies(SdkreplacedembliesFolder, baseName);


            if (addAsReference)
            {
                var replacedemblyFile = Path.Combine(SdkreplacedembliesFolder, DotNetPlatformNetStandard20, $"{baseName}.dll");
                var ndocFile = Path.Combine(SdkreplacedembliesFolder, DotNetPlatformNetStandard20, $"{baseName}.xml");
                try
                {
                    var replacedembly = replacedembly.LoadFrom(replacedemblyFile);
                    var ndoc = new XmlDoreplacedent();
                    ndoc.Load(ndocFile);

                    Add(baseName, replacedembly, ndoc);
                    return (replacedembly, ndoc, dependencies);
                }
                catch (Exception)
                {
                    Console.WriteLine("An exception occured while processing files {0} and {1}.", replacedemblyFile, ndocFile);
                    throw;
                }
            }

            return (null, null, null);
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : ameyer505

private void ExportSecurityToUI(string inputFilePath, string outputFilePath)
        {
            List<SecurityLayerGridObject> securityLayerList = ConvertGridToObjects();

            XmlDoreplacedent xDoc = new XmlDoreplacedent();
            xDoc.Load(inputFilePath);

            string xml = xDoc.OuterXml;
            foreach (var securityLayer in securityLayerList.Where(sl => sl.Selected == true))
            {
                xml = ReplaceSecurityLayerParameters(xml, securityLayer);
            }

            IEnumerable<string> securityLayersToRemove = ConvertGridToObjects().Where(sl => sl.Selected == false).Select(x => x.Name);

            XmlDoreplacedent renamedXDoc = new XmlDoreplacedent();
            TextReader tr = new StringReader(xml);
            renamedXDoc.Load(tr);

            XmlNodeList roles = renamedXDoc.GetElementsByTagName("AxSecurityRole");
            List<XmlNode> rolesToRemove = new List<XmlNode>();
            foreach (XmlNode role in roles)
            {
                string roleName = role["Name"]?.InnerText;
                if (securityLayersToRemove.Contains(roleName))
                    rolesToRemove.Add(role);
            }

            foreach(XmlNode role in rolesToRemove)
                role.ParentNode.RemoveChild(role);

            XmlNodeList duties = renamedXDoc.GetElementsByTagName("AxSecurityDuty");
            List<XmlNode> dutiesToRemove = new List<XmlNode>();
            foreach (XmlNode duty in duties)
            {
                string dutyName = duty["Name"]?.InnerText;
                if (securityLayersToRemove.Contains(dutyName))
                    dutiesToRemove.Add(duty);
            }

            foreach (XmlNode duty in dutiesToRemove)
                duty.ParentNode.RemoveChild(duty);

            XmlNodeList privileges = renamedXDoc.GetElementsByTagName("AxSecurityPrivilege");
            List<XmlNode> privsToRemove = new List<XmlNode>();
            foreach (XmlNode privilege in privileges)
            {
                string privilegeName = privilege["Name"]?.InnerText;
                if (securityLayersToRemove.Contains(privilegeName))
                    privsToRemove.Add(privilege);
            }

            foreach (XmlNode priv in privsToRemove)
                priv.ParentNode.RemoveChild(priv);

            renamedXDoc.Save(outputFilePath + @"\SecurityDatabaseCustomizations.xml");
        }

19 View Source File : ConfigMigrate.cs
License : Apache License 2.0
Project Creator : aws

private Configuration LoadWebConfig(string projectDir)
        {
            string webConfigFilePath = Path.Combine(projectDir, Constants.WebConfig);

            if (File.Exists(webConfigFilePath))
            {
                try
                {

                    XElement webConfigXml = XElement.Load(webConfigFilePath);
                    System.Xml.XmlDoreplacedent xmlDoreplacedent = new System.Xml.XmlDoreplacedent();
                    xmlDoreplacedent.Load(webConfigFilePath);

                    // Comment out connection strings if type has a configProtectionProvider
                    // This can comment out connection strings that do not have "EncryptedData"
                    IEnumerable<XElement> encryptedConnectionStringElement =
                        from element in webConfigXml.Elements("connectionStrings")
                        where (string)element.Attribute("configProtectionProvider") != null
                        select element;

                    if (encryptedConnectionStringElement.HasAny())
                    {
                        System.Xml.XmlNode elementToComment = xmlDoreplacedent.SelectSingleNode("/configuration/connectionStrings");
                        string commentContents = elementToComment.OuterXml;

                        // Its contents are the XML content of target node
                        System.Xml.XmlComment commentNode = xmlDoreplacedent.CreateComment(commentContents);

                        // Get a reference to the parent of the target node
                        System.Xml.XmlNode parentNode = elementToComment.ParentNode;

                        // Replace the target node with the comment
                        parentNode.ReplaceChild(commentNode, elementToComment);
                        xmlDoreplacedent.Save(webConfigFilePath);
                    }

                    var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = webConfigFilePath };
                    var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
                    return configuration;
                }
                catch (Exception ex)
                {
                    LogHelper.LogError(ex, string.Format("Error processing web.config file {0}", webConfigFilePath));
                }
            }
            return null;
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : ameyer505

private List<SecurityLayerGridObject> ParseInputXML(string inputFilePath)
        {
            List<SecurityLayerGridObject> securityLayerList = new List<SecurityLayerGridObject>();
            XmlDoreplacedent xDoc = new XmlDoreplacedent();
            xDoc.Load(inputFilePath);
            XmlNodeList roles = xDoc.GetElementsByTagName("AxSecurityRole");
            foreach (XmlNode role in roles)
            {
                string roleName = role["Name"]?.InnerText;
                if (roleName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected = false,
                        OldName = roleName,
                        Name = roleName,
                        OldLabel = role["Label"]?.InnerText ?? "",
                        Label = role["Label"]?.InnerText ?? "",
                        OldDescription = role["Description"]?.InnerText ?? "",
                        Description = role["Description"]?.InnerText ?? "",
                        Type = "Role"
                    };
                    securityLayerList.Add(sl);
                }
            }

            XmlNodeList duties = xDoc.GetElementsByTagName("AxSecurityDuty");
            foreach (XmlNode duty in duties)
            {
                string dutyName = duty["Name"]?.InnerText;
                if (dutyName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected = false,
                        OldName = dutyName,
                        Name = dutyName,
                        OldLabel = duty["Label"]?.InnerText ?? "",
                        Label = duty["Label"]?.InnerText ?? "",
                        OldDescription = duty["Description"]?.InnerText ?? "",
                        Description = duty["Description"]?.InnerText ?? "",
                        Type = "Duty"
                    };
                    securityLayerList.Add(sl);
                }
            }

            XmlNodeList privileges = xDoc.GetElementsByTagName("AxSecurityPrivilege");
            foreach (XmlNode privilege in privileges)
            {
                string privilegeName = privilege["Name"]?.InnerText;
                if (privilegeName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected = false,
                        OldName = privilegeName,
                        Name = privilegeName,
                        OldLabel = privilege["Label"]?.InnerText ?? "",
                        Label = privilege["Label"]?.InnerText ?? "",
                        OldDescription = privilege["Description"]?.InnerText ?? "",
                        Description = privilege["Description"]?.InnerText ?? "",
                        Type = "Privilege"
                    };
                    securityLayerList.Add(sl);
                }
            }
            return securityLayerList;
        }

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

private string LoadMethodCode()
		{
			if (this.methodFile == null)
			{
				this.methodFile = new XmlDoreplacedent();
				this.methodFile.Load(this.fullName);
			}

			XmlNode methodCodeNode = this.methodFile.SelectSingleNode("//method_code");
			return methodCodeNode.InnerText;
		}

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

[OneTimeSetUp]
		public void Init()
		{
			serverConnection = Subsreplacedute.For<IServerConnection>();
			Innovator innovatorIns = new Innovator(serverConnection);

			this.authManager = new AuthenticationManagerProxy(this.serverConnection, innovatorIns, new InnovatorUser(), Subsreplacedute.For<IIOMWrapper>());
			this.dialogFactory = Subsreplacedute.For<IDialogFactory>();
			this.projectConfigurationManager = Subsreplacedute.For<IProjectConfigurationManager>();
			this.projectConfiguration = Subsreplacedute.For<IProjectConfiguraiton>();
			this.messageManager = Subsreplacedute.For<MessageManager>();
			this.packageManager = new PackageManager(this.authManager, this.messageManager);
			this.templateLoader = new TemplateLoader();
			this.codeProvider = Subsreplacedute.For<ICodeProvider>();
			this.projectManager = Subsreplacedute.For<IProjectManager>();
			this.arasDataProvider = Subsreplacedute.For<IArasDataProvider>();
			this.iOWrapper = Subsreplacedute.For<IIOWrapper>();
			this.methodInformation = new MethodInfo()
			{
				MethodName = string.Empty,
				Package = new PackageInfo(string.Empty)
			};

			this.projectConfiguration.LastSavedSearch.Returns(new Dictionary<string, List<PropertyInfo>>());

			XmlDoreplacedent methodItemTypeDoc = new XmlDoreplacedent();
			methodItemTypeDoc.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml"));

			Item methodItemType = innovatorIns.newItem();
			methodItemType.loadAML(methodItemTypeDoc.OuterXml);
			MethodItemTypeInfo methodItemTypeInfo = new MethodItemTypeInfo(methodItemType, messageManager);
			this.arasDataProvider.GetMethodItemTypeInfo().Returns(methodItemTypeInfo);

			string pathToFileForSave = Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodAml\ReturnNullMethodAml.xml");
			this.saveToPackageViewModel = new SaveToPackageViewModel(authManager,
				dialogFactory,
				projectConfiguration,
				templateLoader,
				packageManager,
				codeProvider,
				projectManager,
				arasDataProvider,
				iOWrapper,
				messageManager,
				methodInformation,
				pathToFileForSave);
		}

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 : OpenFromArasViewModelTest.cs
License : MIT License
Project Creator : arasplm

[Test]
		[Ignore("Should be updated")]
		public void SearchMethodDialogCommandExcecute_ShouldSetExpectedPropertyValue()
		{
			//Arange
			ISearcher searcher = Subsreplacedute.For<ISearcher>();
			IItemSearchView searchView = Subsreplacedute.For<IItemSearchView>();
			ItemSearchPresenter itemSearchPresenter = Subsreplacedute.ForPartsOf<ItemSearchPresenter>(searchView, searcher);
			itemSearchPresenter.When(x => x.Run(Arg.Any<ItemSearchPresenterArgs>())).DoNotCallBase();

			this.dialogFactory.GereplacedemSearchPresenter("Method", "Method").Returns(itemSearchPresenter);
			this.projectConfigurationManager.CurrentProjectConfiguraiton.LastSavedSearch.Returns(new Dictionary<string, List<PropertyInfo>>());

			ItemSearchPresenterResult searchResult = new ItemSearchPresenterResult()
			{
				DialogResult = DialogResult.OK,
				ItemType = "Method",
				ItemId = "1BF96D4255962F7EA5970426401A841E"
			};

			itemSearchPresenter.Run(Arg.Any<ItemSearchPresenterArgs>()).Returns(searchResult);

			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Any<XmlDoreplacedent>(), Arg.Any<XmlDoreplacedent>()))
				.Do(callBack =>
				{
					(callBack[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\TestMethodItem.xml"));
				});

			//Act
			this.openFromArasViewModel.SearchMethodDialogCommand.Execute(null);

			//replacedert
			replacedert.AreEqual("ReturnNullMethodName", this.openFromArasViewModel.MethodName);
			replacedert.AreEqual("1BF96D4255962F7EA5970426401A841E", this.openFromArasViewModel.MethodId);
			replacedert.AreEqual("616634B3DC344D51964CD7AD988051D7", this.openFromArasViewModel.MethodConfigId);
			replacedert.AreEqual("C#", this.openFromArasViewModel.MethodLanguage);
			replacedert.AreEqual("World", this.openFromArasViewModel.IdenreplacedyKeyedName);
			replacedert.AreEqual("A73B655731924CD0B027E4F4D5FCC0A9", this.openFromArasViewModel.IdenreplacedyId);
			replacedert.IsEmpty(this.openFromArasViewModel.MethodComment);
			replacedert.AreEqual("server", this.openFromArasViewModel.MethodType);
			replacedert.AreEqual("return null;", this.openFromArasViewModel.MethodCode);
			replacedert.IsNull(this.openFromArasViewModel.SelectedTemplate);
			replacedert.AreEqual(1, this.projectConfigurationManager.CurrentProjectConfiguraiton.LastSavedSearch.Count);
		}

19 View Source File : ModDownloader.cs
License : GNU General Public License v3.0
Project Creator : amakvana

public Dictionary<string, string> ReadGamereplacedleIdDatabase(string gamereplacedleIDsXml)
        {
            // detect yuzu user directory 
            // loop through /load/ folder & get replacedle names from replacedle Id's
            // return list 

            var d = new Dictionary<string, string>();
            var doc = new XmlDoreplacedent();

            doc.Load(gamereplacedleIDsXml);
            var nodes = doc.DoreplacedentElement.SelectNodes("//*[local-name()='games']/*[local-name()='game']");
            foreach (XmlNode node in nodes)
            {
                string replacedleName = node["replacedle_name"].InnerText.Trim();
                string replacedleId = node["replacedle_id"].InnerText.Trim();
                
                if (!string.IsNullOrWhiteSpace(replacedleId) && Directory.Exists($"{UserDirPath}/load/{replacedleId}"))
                {
                    d.Add(replacedleName, replacedleId);
                }
            }
            return d;
        }

19 View Source File : SampleWizardPage.cs
License : MIT License
Project Creator : aspose-pdf

private void UpdatePrjReferenceHintPath(string projectFilePath, AsposeComponent component)
        {
            if (!File.Exists(projectFilePath))
                return;

            XmlDoreplacedent xdDoc = new XmlDoreplacedent();
            xdDoc.Load(projectFilePath);

            XmlNamespaceManager xnManager =
             new XmlNamespaceManager(xdDoc.NameTable);
            xnManager.AddNamespace("tu",
             "http://schemas.microsoft.com/developer/msbuild/2003");

            XmlNode xnRoot = xdDoc.DoreplacedentElement;
            XmlNodeList xnlPages = xnRoot.SelectNodes("//tu:ItemGroup", xnManager);
            foreach (XmlNode node in xnlPages)
            {
                XmlNodeList nodelist = node.SelectNodes("//tu:HintPath", xnManager);
                foreach (XmlNode nd in nodelist)
                {
                    string innter = nd.InnerText;
                    nd.InnerText = "..\\Bin\\" + component.Name + ".dll";
                }
            }
            xdDoc.Save(projectFilePath);
        }

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 : XmlOverridesMerger.cs
License : Apache License 2.0
Project Creator : aws

public static void ApplyOverrides(string folderPath, string configurationsFolder)
        {
            var serviceOverrides = ReadOverrides(folderPath, out _);

            foreach (var serviceOverride in serviceOverrides)
            {
                string configurationFilePath = Path.Combine(configurationsFolder, $"{serviceOverride.Key}.xml");
                ConfigModel serviceConfig = null;
                if (File.Exists(configurationFilePath))
                {
                    var currentConfig = new XmlDoreplacedent();
                    currentConfig.Load(configurationFilePath);
                    if (Merge(currentConfig.DoreplacedentElement, serviceOverride.Value))
                    {
                        var serializer = new XmlSerializer(typeof(ConfigModel));
                        serviceConfig = (ConfigModel)serializer.Deserialize(new XmlNodeReader(currentConfig.DoreplacedentElement));
                    }
                }
                else
                {
                    var overrides = new XmlAttributeOverrides();
                    overrides.Add(typeof(ConfigModel), new XmlAttributes() { XmlRoot = new XmlRootAttribute("Service") });
                    var serializer = new XmlSerializer(typeof(ConfigModel), overrides);
                    serviceConfig = (ConfigModel)serializer.Deserialize(new XmlNodeReader(serviceOverride.Value));
                }

                if (serviceConfig != null)
                {
                    serviceConfig.ServiceOperationsList = serviceConfig.ServiceOperationsList.OrderBy(so => so.MethodName).ToList();
                    serviceConfig.Serialize(configurationFilePath);
                }
            }
        }

19 View Source File : UpdatePriceSettings.cs
License : GNU Affero General Public License v3.0
Project Creator : alexander-pick

private void loadPresets()
    {
      DirectoryInfo d = new DirectoryInfo(@".//Presets");
      FileInfo[] Files = d.GetFiles("*.xml");
      presets = new Dictionary<string, MKMBotSettings>();
      foreach (FileInfo file in Files)
      {
        MKMBotSettings s = new MKMBotSettings();
        try
        {
          XmlDoreplacedent doc = new XmlDoreplacedent();
          doc.Load(file.FullName);
          s.Parse(doc);
          string name = file.Name.Substring(0, file.Name.Length - 4); // cut off the ".xml"
          presets[name] = s;
          comboBoxPresets.Items.Add(name);
        }
        catch (Exception eError)
        {
          MKMHelpers.LogError("reading preset " + file.Name, eError.Message, false);
        }
      }
      comboBoxPresets.SelectedIndex = comboBoxPresets.Items.Add("Choose Preset...");
    }

19 View Source File : PSHelpGenerator.cs
License : Apache License 2.0
Project Creator : aws

protected override void GenerateHelper()
        {
            Console.WriteLine("Generating Native PowerShell help (Get-Help) doreplacedentation file");
            base.GenerateHelper();

            var buildLogsPath = Path.Combine(this.Options.RootPath, "logs");
            if (!Directory.Exists(buildLogsPath))
                Directory.CreateDirectory(buildLogsPath);

            var logFilename = Path.Combine(buildLogsPath, Name + ".dll-Help.log");
            var oldWriter = Console.Out;
            try
            {
                using (var consoleWriter = new StreamWriter(File.OpenWrite(logFilename)))
                {
                    Console.SetOut(consoleWriter);
                    var outputFile = Path.Combine(this.OutputFolder, Name + PsHelpFilenameTail);

                    var settings = new XmlWriterSettings
                    {
                        Indent = true
                    };

                    using (var psHelpWriter = new XmlTextWriter(outputFile, Encoding.UTF8))
                    {
                        psHelpWriter.Formatting = Formatting.Indented;

                        psHelpWriter.WriteStartElement("helpItems");
                        psHelpWriter.WriteAttributeString("schema", "maml");

                        Parallel.ForEach(CmdletTypes, (cmdletType) =>
                        {
                            CmdletInfo cmdletInfo = InspectCmdletAttributes(cmdletType);

                            using (StringWriter sectionWriter = new StringWriter())
                            using (var sectionXmlWriter = XmlWriter.Create(sectionWriter, new XmlWriterSettings()
                            {
                                OmitXmlDeclaration = true,
                                ConformanceLevel = ConformanceLevel.Fragment,
                                CloseOutput = true
                            }))
                            {
                                string synopsis = null;
                                if (cmdletInfo.AWSCmdletAttribute == null)
                                {
                                    Console.WriteLine("Unable to find AWSCmdletAttribute for type " + cmdletType.FullName);
                                }
                                else
                                {
                                    var cmdletReturnAttributeType = cmdletInfo.AWSCmdletAttribute.GetType();
                                    synopsis = cmdletReturnAttributeType.GetProperty("Synopsis").GetValue(cmdletInfo.AWSCmdletAttribute, null) as string;
                                }

                                foreach (var cmdletAttribute in cmdletInfo.CmdletAttributes)
                                {
                                    sectionXmlWriter.WriteStartElement("command");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "maml", null, "http://schemas.microsoft.com/maml/2004/10");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "command", null, "http://schemas.microsoft.com/maml/dev/command/2004/10");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "dev", null, "http://schemas.microsoft.com/maml/dev/2004/10");
                                    {
                                        var typeDoreplacedentation = DoreplacedentationUtils.GetTypeDoreplacedentation(cmdletType, replacedemblyDoreplacedentation);
                                        typeDoreplacedentation = DoreplacedentationUtils.FormatXMLForPowershell(typeDoreplacedentation);
                                        Console.WriteLine($"Cmdlet = {cmdletType.FullName}");
                                        Console.WriteLine($"Doreplacedentation = {typeDoreplacedentation}");

                                        var cmdletName = cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName;

                                        var allProperties = GetRootSimpleProperties(cmdletType);
                                        var parameterParreplacedioning = new CmdletParameterSetParreplacedions(allProperties, cmdletAttribute.DefaultParameterSetName);

                                        var serviceAbbreviation = GetServiceAbbreviation(cmdletType);

                                        WriteDetails(sectionXmlWriter, cmdletAttribute, typeDoreplacedentation, cmdletName, synopsis);
                                        WriteSyntax(sectionXmlWriter, cmdletName, parameterParreplacedioning);
                                        WriteParameters(sectionXmlWriter, cmdletName, allProperties);
                                        WriteReturnValues(sectionXmlWriter, cmdletInfo.AWSCmdletOutputAttributes);
                                        WriteRelatedLinks(sectionXmlWriter, serviceAbbreviation, cmdletName);
                                        WriteExamples(sectionXmlWriter, cmdletName);
                                    }
                                    sectionXmlWriter.WriteEndElement();
                                }

                                sectionXmlWriter.Close();
                                lock (psHelpWriter)
                                {
                                    psHelpWriter.WriteRaw(sectionWriter.ToString());
                                }
                            }
                        });

                        psHelpWriter.WriteEndElement();
                    }

                    Console.WriteLine($"Verifying help file {outputFile} using XmlDoreplacedent...");
                    try
                    {
                        var doreplacedent = new XmlDoreplacedent();
                        doreplacedent.Load(outputFile);
                    }
                    catch (Exception e)
                    {
                        Logger.LogError(e, $"Error when loading file {outputFile} as XmlDoreplacedent");
                    }
                }
            }
            finally
            {
                Console.SetOut(oldWriter);
            }
        }

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

[Test]
		public void SelectedIdenreplacedyCommand()
		{
			//Arange
			projectConfigurationManager.CurrentProjectConfiguraiton.LastSavedSearch.Returns(new Dictionary<string, List<PropertyInfo>>());

			List<PropertyInfo> lastSavedSearch = new List<PropertyInfo>();
			IItemSearchView view = Subsreplacedute.For<IItemSearchView>();
			ISearcher iSearcher = Subsreplacedute.For<ISearcher>();
			ItemSearchPresenterResult searchPresenterResult = new ItemSearchPresenterResult()
			{
				DialogResult = System.Windows.Forms.DialogResult.OK,
				ItemType = "Idenreplacedy",
				ItemId = "A73B655731924CD0B027E4F4D5FCC0A9",
				LastSavedSearch = lastSavedSearch
			};

			ItemSearchPresenter itemSearchPresenter = Subsreplacedute.ForPartsOf<ItemSearchPresenter>(view, iSearcher);
			itemSearchPresenter.When(x => x.Run(Arg.Any<ItemSearchPresenterArgs>())).DoNotCallBase();
			itemSearchPresenter.Run(Arg.Any<ItemSearchPresenterArgs>()).Returns(searchPresenterResult);

			this.dialogFactory.GereplacedemSearchPresenter("Idenreplacedy", "Idenreplacedy").Returns(itemSearchPresenter);
			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is<XmlDoreplacedent>(doc => doc.DoreplacedentElement.Attributes["type"].Value == "Idenreplacedy"), Arg.Any<XmlDoreplacedent>()))
								.Do(x =>
								{
									(x[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\WorldItenreplacedyItem.xml"));
								});

			//Act
			saveMethodViewModel.SelectedIdenreplacedyCommand.Execute(null);

			//replacedert
			replacedert.AreEqual("A73B655731924CD0B027E4F4D5FCC0A9", saveMethodViewModel.SelectedIdenreplacedyId);
			replacedert.AreEqual("World", saveMethodViewModel.SelectedIdenreplacedyKeyedName);
			replacedert.AreEqual(lastSavedSearch, projectConfigurationManager.CurrentProjectConfiguraiton.LastSavedSearch["Idenreplacedy"]);
		}

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

[Test]
		public void SelectedIdenreplacedyCommandExecute_ShouldFillExpected()
		{
			//Arange
			IItemSearchView view = Subsreplacedute.For<IItemSearchView>();
			ISearcher iSearcher = Subsreplacedute.For<ISearcher>();

			ItemSearchPresenterResult searchPresenterResult = new ItemSearchPresenterResult()
			{
				DialogResult = System.Windows.Forms.DialogResult.OK,
				ItemId = "A73B655731924CD0B027E4F4D5FCC0A9",
				ItemType = "Idenreplacedy",
				LastSavedSearch = new List<PropertyInfo>()
			};

			ItemSearchPresenter itemSearchPresenter = Subsreplacedute.ForPartsOf<ItemSearchPresenter>(view, iSearcher);
			itemSearchPresenter.When(x => x.Run(Arg.Any<ItemSearchPresenterArgs>())).DoNotCallBase();
			itemSearchPresenter.Run(Arg.Any<ItemSearchPresenterArgs>()).Returns(searchPresenterResult);

			this.dialogFactory.GereplacedemSearchPresenter("Idenreplacedy", "Idenreplacedy").Returns(itemSearchPresenter);

			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is<XmlDoreplacedent>(doc => doc.DoreplacedentElement.Attributes["type"].Value == "Idenreplacedy"), Arg.Any<XmlDoreplacedent>()))
								.Do(x =>
								{
									(x[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\WorldItenreplacedyItem.xml"));
								});

			//Act
			this.saveToPackageViewModel.SelectedIdenreplacedyCommand.Execute(null);

			//replacedert
			replacedert.AreEqual("World", this.saveToPackageViewModel.SelectedIdenreplacedyKeyedName);
			replacedert.AreEqual("A73B655731924CD0B027E4F4D5FCC0A9", this.saveToPackageViewModel.SelectedIdenreplacedyId);
			replacedert.AreEqual(1, this.projectConfiguration.LastSavedSearch.Count);
		}

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

public static Project Load(string fileName)
		{
			if (string.IsNullOrEmpty(fileName))
				throw new ArgumentException(Strings.ErrorBlankFilename, "fileName");

			if (!File.Exists(fileName))
				throw new FileNotFoundException(Strings.ErrorFileNotFound);

			XmlDoreplacedent doreplacedent = new XmlDoreplacedent();
			try
			{
				doreplacedent.Load(fileName);
			}
			catch (Exception ex)
			{
				throw new IOException(Strings.ErrorCouldNotLoadFile, ex);
			}

			XmlElement root = doreplacedent["Project"];
			if (root == null)
			{
				root = doreplacedent["ClreplacedProject"]; // Old file format
				if (root == null)
				{
					throw new InvalidDataException(Strings.ErrorCorruptSaveFile);
				}
				else
				{
					Project oldProject = LoadWithPreviousFormat(root);
					oldProject.FilePath = fileName;
					oldProject.name = Path.GetFileNameWithoutExtension(fileName);
					oldProject.isUnreplacedled = false;
					return oldProject;
				}
			}

			Project project = new Project();
			project.loading = true;
			try
			{
				project.Deserialize(root);
			}
			catch (Exception ex)
			{
				throw new InvalidDataException(Strings.ErrorCorruptSaveFile, ex);
			}
			project.loading = false;
			project.FilePath = fileName;
			project.isReadOnly = project.projectFile.IsReadOnly;

			return project;
		}

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

[OneTimeSetUp]
		public void Setup()
		{
			this.serverConnection = Subsreplacedute.For<IServerConnection>();
			this.innovator = new Innovator(this.serverConnection);

			this.authManager = new AuthenticationManagerProxy(this.serverConnection, innovator, new InnovatorUser(), Subsreplacedute.For<IIOMWrapper>());
			this.dialogFactory = Subsreplacedute.For<IDialogFactory>();
			IProjectConfiguraiton projectConfiguration = Subsreplacedute.For<IProjectConfiguraiton>();
			this.projectConfigurationManager = Subsreplacedute.For<IProjectConfigurationManager>();
			projectConfigurationManager.CurrentProjectConfiguraiton.Returns(projectConfiguration);
			this.messageManager = Subsreplacedute.For<MessageManager>();
			this.packageManager = new PackageManager(authManager, messageManager);
			this.arasDataProvider = Subsreplacedute.For<IArasDataProvider>();
			this.methodInformation = new MethodInfo()
			{
				Package = new PackageInfo(string.Empty)
			};

			XmlDoreplacedent methodItemTypeXmlDoreplacedent = new XmlDoreplacedent();
			methodItemTypeXmlDoreplacedent.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml"));

			Item methodItem = this.innovator.newItem();
			methodItem.loadAML(methodItemTypeXmlDoreplacedent.OuterXml);
			MethodItemTypeInfo methodItemTypeInfo = new MethodItemTypeInfo(methodItem, messageManager);

			arasDataProvider.GetMethodItemTypeInfo().Returns(methodItemTypeInfo);

			List<ConnectionInfo> connectionInfos = new List<ConnectionInfo>()
			{
				new ConnectionInfo()
				{
					Login = "userName",
					Database = "testDataBase",
					ServerUrl = "testServerUrl",
					LastConnection = true
				}
			};

			projectConfiguration.Connections.Returns(connectionInfos);

			saveMethodViewModel = new SaveMethodViewModel(this.authManager,
				this.dialogFactory,
				this.projectConfigurationManager,
				this.packageManager,
				this.arasDataProvider,
				this.methodInformation,
				this.messageManager,
				"methodCode",
				"projectConfPath",
				"projectName",
				"projectFullName");
		}

19 View Source File : Serialize.cs
License : MIT License
Project Creator : aoso3

public static T DeSerializeObject<T>(string fileName)
        {
            if (string.IsNullOrEmpty(fileName)) { return default(T); }

            T objectOut = default(T);

            try
            {
                XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
                xmlDoreplacedent.Load(fileName);
                string xmlString = xmlDoreplacedent.OuterXml;

                using (StringReader read = new StringReader(xmlString))
                {
                    Type outType = typeof(T);

                    XmlSerializer serializer = new XmlSerializer(outType);
                    using (XmlReader reader = new XmlTextReader(read))
                    {
                        objectOut = (T)serializer.Deserialize(reader);
                        reader.Close();
                    }

                    read.Close();
                }
            }
            catch (Exception ex)
            {
                //Log exception here
            }

            return objectOut;
        }

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

private string LoadMethodType()
		{
			if (this.methodFile == null)
			{
				this.methodFile = new XmlDoreplacedent();
				this.methodFile.Load(this.fullName);
			}

			XmlNode methodTypeNode = this.methodFile.SelectSingleNode("//method_type");
			return methodTypeNode.InnerText;
		}

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

public XmlDoreplacedent XmlDoreplacedentLoad(string path)
		{
			var xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(path);
			return xmlDoreplacedent;
		}

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 : GlobalConfigurationTest.cs
License : MIT License
Project Creator : arasplm

[Test]
		public void GetUserCodeTemplatesPaths_Should()
		{
			//Arange
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string configFilePath = Path.Combine(currentPath, @"Configurations\TestData\config.xml");
			MockConfigFilePath(configFilePath);
			this.iOWrapper.FileExists(configFilePath).Returns(File.Exists(configFilePath));

			XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(configFilePath);
			this.iOWrapper.XmlDoreplacedentLoad(configFilePath).Returns(xmlDoreplacedent);
			GlobalConfigurationTestProxy globalConfigurationTest = new GlobalConfigurationTestProxy(this.iOWrapper);

			//Act
			List<string> actualUserCodeTemlates = globalConfigurationTest.GetUserCodeTemplatesPaths();

			//replacedert
			replacedert.AreEqual(2, actualUserCodeTemlates.Count);
			foreach (var actualUserCodeTemlate in actualUserCodeTemlates)
			{
				XmlNode userCodeTemlate = xmlDoreplacedent.SelectSingleNode($"//userCodeTemplate[text()=\"{actualUserCodeTemlate}\"]");
				replacedert.IsNotNull(userCodeTemlate);
			}
		}

19 View Source File : Settings.xaml.cs
License : MIT License
Project Creator : Alkl58

private void LoadSettingsTab()
        {
            if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "settings.xml")))
            {
                string language = "English";
                try
                {
                    XmlDoreplacedent doc = new XmlDoreplacedent();
                    doc.Load(Path.Combine(Directory.GetCurrentDirectory(), "settings.xml"));
                    XmlNodeList node = doc.GetElementsByTagName("Settings");
                    foreach (XmlNode n in node[0].ChildNodes)
                    {
                        switch (n.Name)
                        {
                            case "DeleteTempFiles":
                                ToggleSwitchDeleteTempFiles.IsOn = n.InnerText == "True";
                                break;
                            case "PlaySound":
                                ToggleSwitchUISounds.IsOn = n.InnerText == "True";
                                break;
                            case "Logging":
                                ToggleSwitchLogging.IsOn = n.InnerText == "True";
                                break;
                            case "ShowDialog":
                                ToggleSwitchShowWindow.IsOn = n.InnerText == "True";
                                break;
                            case "Shutdown":
                                ToggleSwitchShutdownAfterEncode.IsOn = n.InnerText == "True";
                                break;
                            case "TempPathActive":
                                ToggleSwitchTempFolder.IsOn = n.InnerText == "True";
                                break;
                            case "TempPath":
                                TextBoxCustomTempPath.Text = n.InnerText;
                                break;
                            case "Terminal":
                                ToggleSwitchHideTerminal.IsOn = n.InnerText == "True";
                                break;
                            case "ThemeAccent":
                                ComboBoxAccentTheme.SelectedIndex = int.Parse(n.InnerText);
                                break;
                            case "ThemeBase":
                                ComboBoxBaseTheme.SelectedIndex = int.Parse(n.InnerText);
                                break;
                            case "BatchContainer":
                                ComboBoxContainerBatchEncoding.SelectedIndex = int.Parse(n.InnerText);
                                break;
                            case "SkipSubreplacedles":
                                ToggleSkipSubreplacedleExtraction.IsOn = n.InnerText == "True";
                                break;
                            case "Language":
                                language = n.InnerText;
                                break;
                            case "OverrideWorkerCount":
                                ToggleOverrideWorkerCount.IsOn = n.InnerText == "True";
                                break;
                            default: break;
                        }
                    }
                }
                catch { }

                ThemeManager.Current.ChangeTheme(this, ComboBoxBaseTheme.Text + "." + ComboBoxAccentTheme.Text);

                switch (language)
                {
                    case "Deutsch":
                        ComboBoxUILanguage.SelectedIndex = 1;
                        break;
                    case "Français":
                        ComboBoxUILanguage.SelectedIndex = 2;
                        break;
                    default:
                        ComboBoxUILanguage.SelectedIndex = 0;
                        break;
                }
            }
        }

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 : OpenFromPackageTreeViewModel.cs
License : MIT License
Project Creator : arasplm

private void OnSelectDirectoryItem(string fullPath)
		{
			this.rootFolderPath = Path.GetDirectoryName(fullPath);

			var localPackages = new Dictionary<string, string>();
			var extension = Path.GetExtension(fullPath);
			if (string.Equals(extension, importFileName))
			{
				var xmlDoreplacedent = new XmlDoreplacedent();
				xmlDoreplacedent.Load(fullPath);
				XmlNodeList packageXmlNodes = xmlDoreplacedent.SelectNodes("imports/package");
				foreach (XmlNode packageXmlNode in packageXmlNodes)
				{
					string name = packageXmlNode.Attributes["name"].InnerText;
					string path = packageXmlNode.Attributes["path"].InnerText;
					localPackages.Add(name, path);
				}
			}

			this.Packages = localPackages;
		}

19 View Source File : Save_Load.cs
License : MIT License
Project Creator : Asixa

public static void LoadData()
        {
            string filename= Environment.CurrentDirectory + "/data.xml";
            if (!File.Exists(filename)) return;
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            try
            {
                xmlDoc.Load(filename);
                XmlNode root = xmlDoc.SelectSingleNode("//Data");       
                if (root != null)
                {
                    MainWindow._instance.LanguagePack = root.SelectSingleNode("language").InnerText;
                    MainWindow._instance.user_name=MainWindow._instance.LoginWindow.account.Text= (root.SelectSingleNode("account")).InnerText;
                    MainWindow._instance.Appid =int.Parse((root.SelectSingleNode("appid")).InnerText);
                    MainWindow._instance.AppidInput.Value = MainWindow._instance.Appid;
                   
                }
                else
                {

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }

19 View Source File : MainProgram.cs
License : MIT License
Project Creator : AlbertMN

[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
        [STAThread]
        static void Main(string[] args) {
            Console.WriteLine("Log location; " + logFilePath);
            CheckSettings();

            var config = new NLog.Config.LoggingConfiguration();
            var logfile = new NLog.Targets.FileTarget("logfile") { FileName = logFilePath };
            var logconsole = new NLog.Targets.ConsoleTarget("logconsole");
            config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
            NLog.LogManager.Configuration = config;

            void ActualMain() {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                //Upgrade settings
                if (Properties.Settings.Default.UpdateSettings) {
                    /* Copy old setting-files in case the Evidence type and Evidence Hash has changed (which it does sometimes) - easier than creating a whole new settings system */
                    try {
                        Configuration accConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                        string currentFolder = new DirectoryInfo(accConfiguration.FilePath).Parent.Parent.FullName;
                        string[] directories = Directory.GetDirectories(new DirectoryInfo(currentFolder).Parent.FullName);

                        foreach (string dir in directories) {
                            if (dir != currentFolder.ToString()) {
                                var directoriesInDir = Directory.GetDirectories(dir);
                                foreach (string childDir in directoriesInDir) {
                                    string checkPath = Path.Combine(currentFolder, Path.GetFileName(childDir));
                                    if (!Directory.Exists(checkPath)) {
                                        string checkFile = Path.Combine(childDir, "user.config");
                                        if (File.Exists(checkFile)) {
                                            bool xmlHasError = false;
                                            try {
                                                XmlDoreplacedent xml = new XmlDoreplacedent();
                                                xml.Load(checkFile);

                                                xml.Validate(null);
                                            } catch {
                                                xmlHasError = true;
                                                DoDebug("XML doreplacedent validation failed (is invalid): " + checkFile);
                                            }

                                            if (!xmlHasError) {
                                                Directory.CreateDirectory(checkPath);
                                                File.Copy(checkFile, Path.Combine(checkPath, "user.config"), true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                        Console.WriteLine("Error getting settings from older versions of ACC; " + e.Message);
                    }
                    /* End "copy settings" */

                    try {
                        Properties.Settings.Default.Upgrade();
                        Properties.Settings.Default.UpdateSettings = false;
                        Properties.Settings.Default.Save();
                    } catch {
                        DoDebug("Failed to upgrade from old settings file.");
                    }

                    Console.WriteLine("Upgraded settings to match last version");
                }

                if (Properties.Settings.Default.LastUpdated == DateTime.MinValue) {
                    Properties.Settings.Default.LastUpdated = DateTime.Now;
                }

                //Create action mod path
                if (!Directory.Exists(actionModsPath)) {
                    Directory.CreateDirectory(actionModsPath);
                }

                //Translator
                string tempDir = Path.Combine(currentLocation, "Translations");
                if (Directory.Exists(tempDir)) {
                    Translator.translationFolder = Path.Combine(currentLocation, "Translations");
                    Translator.languagesArray = Translator.GetLanguages();
                } else {
                    MessageBox.Show("Missing the translations folder. Reinstall the software to fix this issue.", messageBoxreplacedle);
                }

                string lang = Properties.Settings.Default.ActiveLanguage;
                if (Array.Exists(Translator.languagesArray, element => element == lang)) {
                    DoDebug("ACC running with language \"" + lang + "\"");

                    Translator.SetLanguage(lang);
                } else {
                    DoDebug("Invalid language chosen (" + lang + ")");

                    Properties.Settings.Default.ActiveLanguage = "English";
                    Translator.SetLanguage("English");
                }
                //End translator
                sysIcon = new SysTrayIcon();

                Properties.Settings.Default.TimesOpened += 1;
                Properties.Settings.Default.Save();

                SetupDataFolder();
                if (File.Exists(logFilePath)) {
                    try {
                        File.WriteAllText(logFilePath, string.Empty);
                    } catch {
                        // Don't let this being DENIED crash the software
                        Console.WriteLine("Failed to empty the log");
                    }
                } else {
                    Console.WriteLine("Trying to create log");
                    CreateLogFile();
                }

                //Check if software already runs, if so kill this instance
                var otherACCs = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(currentLocationFull));
                if (otherACCs.Length > 1) {
                    //Try kill the _other_ process instead
                    foreach (Process p in otherACCs) {
                        if (p.Id != Process.GetCurrentProcess().Id) {
                            try {
                                p.Kill();
                                DoDebug("Other ACC instance was running. Killed it.");
                            } catch {
                                DoDebug("Could not kill other process of ACC; access denied");
                            }
                        }
                    }
                }

                Application.EnableVisualStyles();

                DoDebug("[ACC begun (v" + softwareVersion + ")]");

                if (Properties.Settings.Default.CheckForUpdates) {
                    if (HasInternet()) {
                        new Thread(() => {
                            new SoftwareUpdater().Check();
                        }).Start();
                    } else {
                        DoDebug("Couldn't check for new update as PC does not have access to the internet");
                    }
                }

                //On console close: hide NotifyIcon
                Application.ApplicationExit += new EventHandler(OnApplicationExit);
                handler = new ConsoleEventDelegate(ConsoleEventCallback);
                SetConsoleCtrlHandler(handler, true);

                //Create shortcut folder if doesn't exist
                if (!Directory.Exists(shortcutLocation)) {
                    Directory.CreateDirectory(shortcutLocation);
                }
                if (!File.Exists(Path.Combine(shortcutLocation, @"example.txt"))) {
                    //Create example-file
                    try {
                        using (StreamWriter sw = File.CreateText(Path.Combine(shortcutLocation, @"example.txt"))) {
                            sw.WriteLine("This is an example file.");
                            sw.WriteLine("If you haven't already, make your replacedistant open this file!");
                        }
                    } catch {
                        DoDebug("Could not create or write to example file");
                    }
                }

                //Delete all old action files
                if (Directory.Exists(CheckPath())) {
                    DoDebug("Deleting all files in action folder");
                    foreach (string file in Directory.GetFiles(CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension)) {
                        int timeout = 0;

                        if (File.Exists(file)) {
                            while (ActionChecker.FileInUse(file) && timeout < 5) {
                                timeout++;
                                Thread.Sleep(500);
                            }
                            if (timeout >= 5) {
                                DoDebug("Failed to delete file at " + file + " as file appears to be in use (and has been for 2.5 seconds)");
                            } else {
                                try {
                                    File.Delete(file);
                                } catch (Exception e) {
                                    DoDebug("Failed to delete file at " + file + "; " + e.Message);
                                }
                            }
                        }
                    }
                    DoDebug("Old action files removed - moving on...");
                }

                //SetupListener();
                watcher = new FileSystemWatcher() {
                    Path = CheckPath(),
                    NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                        | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                    Filter = "*." + Properties.Settings.Default.ActionFileExtension,
                    EnableRaisingEvents = true
                };
                watcher.Changed += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Created += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Renamed += new RenamedEventHandler(new ActionChecker().FileFound);
                watcher.Deleted += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Error += delegate { DoDebug("Something wen't wrong"); };

                DoDebug("\n[" + messageBoxreplacedle + "] Initiated. \nListening in: \"" + CheckPath() + "\" for \"." + Properties.Settings.Default.ActionFileExtension + "\" extensions");

                sysIcon.TrayIcon.Icon = Properties.Resources.ACC_icon_light;

                RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
                if (Registry.GetValue(key.Name + @"\replacedistantComputerControl", "FirstTime", null) == null) {
                    SetStartup(true);

                    key.CreateSubKey("replacedistantComputerControl");
                    key = key.OpenSubKey("replacedistantComputerControl", true);
                    key.SetValue("FirstTime", false);

                    ShowGettingStarted();

                    DoDebug("Starting setup guide (first time opening ACC - wuhu!)");
                } else {
                    if (!Properties.Settings.Default.HasCompletedTutorial) {
                        ShowGettingStarted();
                        DoDebug("Didn't finish setup guide last time, opening again");
                    }
                }
                SetRegKey("ActionFolder", CheckPath());
                SetRegKey("ActionExtension", Properties.Settings.Default.ActionFileExtension);

                testActionWindow = new TestActionWindow();

                //If newly updated
                if (Properties.Settings.Default.LastKnownVersion != softwareVersion) {
                    //Up(or down)-grade, display version notes
                    DoDebug("ACC has been updated");

                    if (Properties.Settings.Default.LastKnownVersion != "" && new System.Version(Properties.Settings.Default.LastKnownVersion) < new System.Version("1.4.3")) {
                        //Had issues before; fixed now
                        DoDebug("Upgraded to 1.4.3, fixed startup - now starting with Windows");

                        try {
                            RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                            rk.DeleteValue(appName, false);
                        } catch {
                            DoDebug("Failed to remove old start with win run");
                        }

                        SetStartup(true);
                    } else {
                        if (ACCStartsWithWindows()) {
                            SetStartup(true);
                        }
                    }

                    Properties.Settings.Default.LastUpdated = DateTime.Now;
                    if (gettingStarted != null) {
                        DoDebug("'AboutVersion' window awaits, as 'Getting Started' is showing");
                        aboutVersionAwaiting = true;
                    } else {
                        Properties.Settings.Default.LastKnownVersion = softwareVersion;
                        new NewVersion().Show();
                    }
                    Properties.Settings.Default.Save();
                }

                //Check if software starts with Windows
                if (!ACCStartsWithWindows())
                    sysIcon.AddOpenOnStartupMenu();

                /* 'Evalufied' user feedback implementation */
                if ((DateTime.Now - Properties.Settings.Default.LastUpdated).TotalDays >= 7 && Properties.Settings.Default.TimesOpened >= 7
                    && gettingStarted == null
                    && !Properties.Settings.Default.HasPromptedFeedback) {
                    //User has had the software/update for at least 7 days, and has opened the software more than 7 times - time to ask for feedback
                    //(also the "getting started" window is not showing)
                    if (HasInternet()) {
                        try {
                            WebRequest request = WebRequest.Create("https://evalufied.dk/");
                            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                            if (response == null || response.StatusCode != HttpStatusCode.OK) {
                                DoDebug("'Evalufied' is down - won't show faulty feedback window");
                            } else {
                                DoDebug("Showing 'User Feedback' window");
                                Properties.Settings.Default.HasPromptedFeedback = true;
                                Properties.Settings.Default.Save();
                                new UserFeedback().Show();
                            }
                        } catch {
                            DoDebug("Failed to check for 'Evalufied'-availability");
                        }
                    } else {
                        DoDebug("No internet connection, not showing user feedback window");
                    }
                }

                //Action mods implementation
                ActionMods.CheckMods();
                TaskSchedulerSetup();

                hreplacedtarted = true;
                SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch); //On wake up from sleep

                Application.Run();
            }

            if (sentryToken != "super_secret") {
                //Tracking issues with Sentry.IO - not forked from GitHub (official version)
                bool sentryOK = false;
                try {
                    if (Properties.Settings.Default.UID != "") {
                        Properties.Settings.Default.UID = Guid.NewGuid().ToString();
                        Properties.Settings.Default.Save();
                    }

                    if (Properties.Settings.Default.UID != "") {
                        SentrySdk.ConfigureScope(scope => {
                            scope.User = new Sentry.Protocol.User {
                                Id = Properties.Settings.Default.UID
                            };
                        });
                    }

                    using (SentrySdk.Init(sentryToken)) {
                        sentryOK = true;
                    }
                } catch {
                    //Sentry failed. Error sentry's side or invalid key - don't let this stop the app from running
                    DoDebug("Sentry initiation failed");
                    ActualMain();
                }

                if (sentryOK) {
                    try {
                        using (SentrySdk.Init(sentryToken)) {
                            DoDebug("Sentry initiated");
                            ActualMain();
                        }
                    } catch {
                        ActualMain();
                    }
                }
            } else {
                //Code is (most likely) forked - skip issue tracking
                ActualMain();
            }
        }

19 View Source File : GlobalAppHelper.cs
License : MIT License
Project Creator : aspose-pdf

private void initResources(string ResourcesFile, string SessionID)
		{
			SessionID = "R" + SessionID;
			if (AsposePdfContext.Current.Cache[SessionID] == null)
			{
				// Added to solve the file not found problem, the wait is one time only when the application initializes or replacedociated files are modified
				//System.Threading.Thread.Sleep(500);
				Dictionary<string, string> resources = new Dictionary<string, string>();
				XmlDoreplacedent xd = new XmlDoreplacedent();
				// TextWriter tr = (TextWriter)File.CreateText("F:\\replacedets\\my.log");tr.WriteLine(ResourcesFile);
				// tr.WriteLine(File.Exists(ResourcesFile)); tr.Close();
				if (ResourcesFile.Trim() != "")
				{
					xd.Load(ResourcesFile);
				}
				XmlNodeList xl = xd.SelectNodes("resources/res"); // use xpath to reach the res tag within resources
				foreach (XmlNode n in xl) // read the name attribute for key name and values from in between the tags
					resources.Add(n.Attributes["name"].Value, n.InnerText);

				// Add this dictionary into the cache with no expiration and replacedociate a reload method in case of file change

				
				AsposePdfContext.Current.Cache.Add(
				   SessionID,
					resources,
					new CacheDependency(ResourcesFile),
					Cache.NoAbsoluteExpiration,
					Cache.NoSlidingExpiration,
					CacheItemPriority.NotRemovable,
					delegate (string key, object value, CacheItemRemovedReason reason) { initResources(ResourcesFile, SessionID); });
			}
		}

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

[Test]
		public void SelectedIdenreplacedyCommandExecute_ShouldFillExpected()
		{
			//Arange
			IItemSearchView view = Subsreplacedute.For<IItemSearchView>();
			ISearcher iSearcher = Subsreplacedute.For<ISearcher>();

			ItemSearchPresenterResult searchPresenterResult = new ItemSearchPresenterResult()
			{
				DialogResult = System.Windows.Forms.DialogResult.OK,
				ItemId = "A73B655731924CD0B027E4F4D5FCC0A9",
				ItemType = "Idenreplacedy",
				LastSavedSearch = new List<PropertyInfo>()
			};

			ItemSearchPresenter itemSearchPresenter = Subsreplacedute.ForPartsOf<ItemSearchPresenter>(view, iSearcher);
			itemSearchPresenter.When(x => x.Run(Arg.Any<ItemSearchPresenterArgs>())).DoNotCallBase();
			itemSearchPresenter.Run(Arg.Any<ItemSearchPresenterArgs>()).Returns(searchPresenterResult);

			this.dialogFactory.GereplacedemSearchPresenter("Idenreplacedy", "Idenreplacedy").Returns(itemSearchPresenter);

			this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is<XmlDoreplacedent>(doc => doc.DoreplacedentElement.Attributes["type"].Value == "Idenreplacedy"), Arg.Any<XmlDoreplacedent>()))
								.Do(x =>
								{
									(x[2] as XmlDoreplacedent).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\WorldItenreplacedyItem.xml"));
								});

			//Act
			this.createMethodViewModel.SelectedIdenreplacedyCommand.Execute(null);

			//replacedert
			replacedert.AreEqual("World", this.createMethodViewModel.SelectedIdenreplacedyKeyedName);
			replacedert.AreEqual("A73B655731924CD0B027E4F4D5FCC0A9", this.createMethodViewModel.SelectedIdenreplacedyId);
			replacedert.AreEqual(1, this.projectConfiguration.LastSavedSearch.Count);
		}

19 View Source File : ModHandler.cs
License : MIT License
Project Creator : AstroTechies

private void SetInstalledAstroBuild()
        {
            InstalledAstroBuild = null;

            // Steam
            try
            {
                string buildVersionPath = Path.Combine(GamePath, "build.version");
                if (File.Exists(buildVersionPath))
                {
                    using (StreamReader f = new StreamReader(buildVersionPath))
                    {
                        string fullBuildData = f.ReadToEnd();
                        Match m = AstroBuildRegex.Match(fullBuildData);
                        if (m.Groups.Count == 2) InstalledAstroBuild = new Version(m.Groups[1].Value);
                    }
                }
            }
            catch
            {
                InstalledAstroBuild = null;
            }

            if (InstalledAstroBuild != null) return;

            // Win10
            try
            {
                string buildVersionPath = Path.Combine(GamePath, "AppxManifest.xml");
                if (File.Exists(buildVersionPath))
                {
                    XmlDoreplacedent doc = new XmlDoreplacedent();
                    doc.Load(buildVersionPath);

                    if (doc != null)
                    {
                        XmlNodeList idenreplacedyList = doc.GetElementsByTagName("Idenreplacedy");
                        if (idenreplacedyList != null && idenreplacedyList.Count > 0)
                        {
                            var verAttr = idenreplacedyList[0].Attributes["Version"];
                            if (verAttr != null) Version.TryParse(verAttr.Value, out InstalledAstroBuild);
                        }
                    }
                }
            }
            catch
            {
                InstalledAstroBuild = null;
            }
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : ameyer505

private void ExportSecurityToCode(string inputFilePath, string outputFolderPath)
        {
            List<SecurityLayerGridObject> securityLayerList = ConvertGridToObjects();
            string rootFolderPath = outputFolderPath + @"\D365FOCustomizedSecurity";
            string roleFolderPath = rootFolderPath + @"\AxSecurityRole";
            string dutyFolderPath = rootFolderPath + @"\AxSecurityDuty";
            string privFolderPath = rootFolderPath + @"\AxSecurityPrivilege";

            Directory.CreateDirectory(rootFolderPath);
            Directory.CreateDirectory(roleFolderPath);
            Directory.CreateDirectory(dutyFolderPath);
            Directory.CreateDirectory(privFolderPath);

            XmlDoreplacedent xDoc = new XmlDoreplacedent();
            xDoc.Load(inputFilePath);

            string xml = xDoc.OuterXml;
            foreach (var securityLayer in securityLayerList)
            {
                xml = ReplaceSecurityLayerParameters(xml, securityLayer);
            }

            XmlDoreplacedent renamedXDoc = new XmlDoreplacedent();
            TextReader tr = new StringReader(xml);
            renamedXDoc.Load(tr);

            IEnumerable<string> selectedRoles = securityLayerList.Where(sl => sl.Selected == true && sl.Type == "Role").Select(x => x.Name);
            IEnumerable<string> selectedDuties = securityLayerList.Where(sl => sl.Selected == true && sl.Type == "Duty").Select(x => x.Name);
            IEnumerable<string> selectedPrivs = securityLayerList.Where(sl => sl.Selected == true && sl.Type == "Privilege").Select(x => x.Name);

            XmlNodeList roles = renamedXDoc.GetElementsByTagName("AxSecurityRole");
            foreach (XmlNode role in roles)
            {
                string roleName = role["Name"]?.InnerText;
                if (selectedRoles.Contains(roleName))
                {
                    string fileName = roleFolderPath + @"\" + roleName + @".xml";
                    File.WriteAllText(fileName, role.OuterXml);
                }
            }

            XmlNodeList duties = renamedXDoc.GetElementsByTagName("AxSecurityDuty");
            foreach (XmlNode duty in duties)
            {
                string dutyName = duty["Name"]?.InnerText;
                if (selectedDuties.Contains(dutyName))
                {
                    string fileName = dutyFolderPath + @"\" + dutyName + @".xml";
                    File.WriteAllText(fileName, duty.OuterXml);
                }
            }

            XmlNodeList privileges = renamedXDoc.GetElementsByTagName("AxSecurityPrivilege");
            foreach (XmlNode privilege in privileges)
            {
                string privilegeName = privilege["Name"]?.InnerText;
                if (selectedPrivs.Contains(privilegeName))
                {
                    string fileName = privFolderPath + @"\" + privilegeName + @".xml";
                    File.WriteAllText(fileName, privilege.OuterXml);
                }
            }
        }

19 View Source File : Generator.cs
License : Apache License 2.0
Project Creator : aws

public void Execute(GeneratorOptions options)
        {
            // this is just to record the run duration, so we can monitor and optimize 
            // build-time perf
            _startTimeTicks = DateTime.Now.Ticks;

            if (options.Tasks == null || options.Tasks.Count == 0)
                throw new Exception("No tasks specified for the generator to run");

            if (options.Verbose)
            {
                // todo: echo out generator options
            }

#if DEBUG
            var configuration = "Debug";
#else
            var configuration = "Release";
#endif
            BinSubFolder = Path.Combine("bin", configuration, options.TargetFramework);

            var fqRootPath = options.RootPath;

            var sdkreplacedembliesFolder = options.SdkreplacedembliesFolder;
            var awsPowerShellSourcePath = Path.Combine(fqRootPath, ModulesSubFolder, AWSPowerShellModuleName);

            var deploymentArtifactsPath = Path.Combine(fqRootPath, options.GetEditionOutputFolder(DeploymentArtifactsSubFolder));

            if (options.ShouldRunTask(GeneratorTasknames.GenerateCmdlets))
            {
                Console.WriteLine("Executing task 'GenerateCmdlets'");

                var cmdletGenerator = new CmdletGenerator
                {
                    SdkreplacedembliesFolder = sdkreplacedembliesFolder,
                    OutputFolder = awsPowerShellSourcePath,
                    Options = options
                };
                cmdletGenerator.Generate();

                // Note: the remaining tasks rely on having a built copy of the AWSPowerShell module,
                // so we exit so that a build can take place and the generator then re-run with the
                // new tasks
                Console.WriteLine("Task 'GenerateCmdlets' complete, exiting...");
                return;
            }

            var basePath = string.IsNullOrEmpty(options.BuiltModulesLocation) ? Path.Combine(awsPowerShellSourcePath, BinSubFolder)
                                                                              : options.BuiltModulesLocation;

            var awsPsXmlPath = Path.Combine(basePath, options.replacedemblyName + ".XML");
            var awsPsDllPath = Path.Combine(basePath, options.replacedemblyName + ".dll");

            var awsPowerShellreplacedembly = replacedembly.LoadFrom(awsPsDllPath);

            if (options.ShouldRunTask(GeneratorTasknames.GenerateFormats))
            {
                Console.WriteLine("Executing task 'GenerateFormats'");

                bool includeCore = options.replacedemblyName.Equals(AWSPowerShellDllName, StringComparison.OrdinalIgnoreCase) ||
                                   options.replacedemblyName.Equals(AWSPowerShellCommonDllName, StringComparison.OrdinalIgnoreCase);

                var targetreplacedemblies = new List<replacedembly> { awsPowerShellreplacedembly };
                var sdkreplacedemblies = awsPowerShellreplacedembly.GetReferencedreplacedemblies()
                    .Where(replacedembly => replacedembly.Name.StartsWith("AWSSDK.", StringComparison.OrdinalIgnoreCase) &&
                                       (includeCore || !replacedembly.Name.Equals("AWSSDK.Core", StringComparison.OrdinalIgnoreCase)))
                    .ToArray();
                targetreplacedemblies.AddRange(sdkreplacedemblies.Select(replacedembly => replacedembly.LoadFrom(Path.Combine(sdkreplacedembliesFolder, GenerationSources.DotNetPlatformNetStandard20, replacedembly.Name + ".dll"))));
                targetreplacedemblies.AddRange(AppDomain.CurrentDomain.Getreplacedemblies().Where(replacedembly => sdkreplacedemblies.Contains(replacedembly.GetName())));

                var formatsGenerator = new FormatGenerator
                {
                    OutputFolder = basePath,
                    Name = options.replacedemblyName,
                    Targetreplacedemblies = targetreplacedemblies,
                    Options = options
                };
                formatsGenerator.Generate();
            }

            if (options.ShouldRunTask(GeneratorTasknames.GeneratePsHelp))
            {
                Console.WriteLine("Executing task 'GeneratePshelp'");

                var cmdletDoreplacedentation = new XmlDoreplacedent();
                cmdletDoreplacedentation.Load(awsPsXmlPath);
                var pshelpGenerator = new PsHelpGenerator
                {
                    Cmdletreplacedembly = awsPowerShellreplacedembly,
                    replacedemblyDoreplacedentation = cmdletDoreplacedentation,
                    Name = options.replacedemblyName,
                    OutputFolder = basePath,
                    Options = options
                };
                pshelpGenerator.Generate();
            }

            if (options.ShouldRunTask(GeneratorTasknames.GenerateWebHelp))
            {
                Console.WriteLine("Executing task 'GenerateWebhelp'");

                var cmdletDoreplacedentation = new XmlDoreplacedent();
                cmdletDoreplacedentation.Load(awsPsXmlPath);

                string docOutputFolder;
                if (string.IsNullOrEmpty(options.DocOutputFolder))
                    docOutputFolder = Path.Combine(fqRootPath, DocBuildOutputSubFolder);
                else
                    docOutputFolder = options.DocOutputFolder;

                var webhelpGenerator = new WebHelpGenerator
                {
                    Cmdletreplacedembly = awsPowerShellreplacedembly,
                    replacedemblyDoreplacedentation = cmdletDoreplacedentation,
                    Name = AWSPowerShellModuleName,
                    OutputFolder = docOutputFolder,
                    CNNorth1RegionDocsDomain = options.CNNorth1RegionDocsDomain,
                    Options = options
                };
                webhelpGenerator.Generate();
            }
        }

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

public void Load(string configFilePath)
		{
			try
			{
				XmlDoreplacedent doc = new XmlDoreplacedent();
				doc.Load(configFilePath);

				this.CurrentProjectConfiguraiton.CleanUp();

				MapXmlDocToProjectConfig(this.CurrentProjectConfiguraiton, doc);
			}
			catch (Exception ex)
			{
				throw new Exception(this.messageManager.GetMessage("errorWhileLoadingProjectConfigFile"), ex);
			}
		}

19 View Source File : ConfigModel.cs
License : Apache License 2.0
Project Creator : aws

internal IEnumerable<XmlDoreplacedent> LoadCustomFormatDoreplacedents(string configurationsFolderRoot, string filter)
        {
            if (_customFormatDoreplacedents == null)
            {
                _customFormatDoreplacedents = new List<XmlDoreplacedent>();
                var customFormatsFolder = Path.Combine(configurationsFolderRoot, "CustomFormats");
                if (filter != null)
                {
                    customFormatsFolder = Path.Combine(customFormatsFolder, filter);
                }
                if (Directory.Exists(customFormatsFolder))
                {
                    var customFormatFiles = Directory.GetFiles(customFormatsFolder, "*.ps1xml", SearchOption.AllDirectories);
                    foreach (var customFormatFile in customFormatFiles)
                    {
                        var doc = new XmlDoreplacedent();
                        doc.Load(customFormatFile);
                        _customFormatDoreplacedents.Add(doc);
                    }
                }
            }

            return CustomFormatDoreplacedents;
        }

19 View Source File : HotKeys.cs
License : MIT License
Project Creator : 3RD-Dimension

public static void UpdateHotkey(string keyfunction, string newSetting)
        {
            var root = new XmlDoreplacedent();
            root.Load(@HotKeyFile);

            foreach (XmlNode e in root.GetElementsByTagName("bind"))
            {
                if (e.Attributes["keyfunction"].Value.Equals(keyfunction))
                {
                    e.Attributes["keycode"].Value = newSetting; // FirstChild because the inner node is actually the inner text, yeah XmlNode is weird.
                    MainWindow.Logger.Info($"Added Keycode {newSetting} for KeyFunction {keyfunction}");
                    break;
                }
            }
            root.Save(@HotKeyFile);
        }

19 View Source File : HelpGeneratorBase.cs
License : Apache License 2.0
Project Creator : aws

private void LoadLinksCache()
        {
            var linkLibrariesPath = Path.Combine(Options.RootPath, "generator", "AWSPSGeneratorLib", "HelpMaterials", "LinkLibraries");
            Console.WriteLine("Loading link files from {0}", Path.GetFullPath(linkLibrariesPath));

            LinksCache = new Dictionary<string, XmlDoreplacedent>();
            var linkFiles = Directory.GetFiles(linkLibrariesPath, "*.xml");
            foreach (var linkFile in linkFiles)
            {
                if (Path.GetFileNameWithoutExtension(linkFile).Equals("Template", StringComparison.OrdinalIgnoreCase))
                    continue;

                var doreplacedent = new XmlDoreplacedent {PreserveWhitespace = true};
                doreplacedent.Load(linkFile);
                var servicePrefix = Path.GetFileNameWithoutExtension(linkFile);
                LinksCache[servicePrefix] = doreplacedent;
                Console.WriteLine("...loaded links library for {0}", servicePrefix);
            }

            Console.WriteLine();
        }

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

[Test]
		public void RemoveUserCodeTemplatePath_Should()
		{
			//Arange
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string configFilePath = Path.Combine(currentPath, @"Configurations\TestData\config.xml");
			MockConfigFilePath(configFilePath);
			this.iOWrapper.FileExists(configFilePath).Returns(File.Exists(configFilePath));

			XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(configFilePath);
			this.iOWrapper.XmlDoreplacedentLoad(configFilePath).Returns(xmlDoreplacedent);

			GlobalConfigurationTestProxy globalConfigurationTest = new GlobalConfigurationTestProxy(this.iOWrapper);

			//Act
			globalConfigurationTest.RemoveUserCodeTemplatePath("testUserCodeTemplatePath2");

			//replacedert
			replacedert.AreEqual(1, globalConfigurationTest.ConfigXmlDoreplacedent.SelectNodes("//userCodeTemplate").Count);
		}

19 View Source File : Main.cs
License : MIT License
Project Creator : ameyer505

private List<ParentToChildreplacedociation> ProcessSecurityLayerreplacedociations(string inputFilePath)
        {
            List<ParentToChildreplacedociation> securityLayerreplacedociations = new List<ParentToChildreplacedociation>();
            XmlDoreplacedent xDoc = new XmlDoreplacedent();
            xDoc.Load(inputFilePath);

            XmlNodeList roles = xDoc.GetElementsByTagName("AxSecurityRole");
            foreach (XmlNode role in roles)
            {
                XmlNodeList roleSubRoles = role.SelectNodes("SubRoles//AxSecurityRoleReference");
                foreach (XmlNode roleSubRole in roleSubRoles)
                {
                    ParentToChildreplacedociation pca = new ParentToChildreplacedociation();
                    pca.ParentSystemName = role["Name"]?.InnerText;
                    pca.ParentType = LayerType.Role;
                    pca.ChildSystemName = roleSubRole["Name"]?.InnerText;
                    pca.ChildType = LayerType.Role;
                    securityLayerreplacedociations.Add(pca);
                }

                XmlNodeList roleDuties = role.SelectNodes("Duties//AxSecurityDutyReference");
                foreach (XmlNode roleDuty in roleDuties)
                {
                    ParentToChildreplacedociation pca = new ParentToChildreplacedociation();
                    pca.ParentSystemName = role["Name"]?.InnerText;
                    pca.ParentType = LayerType.Role;
                    pca.ChildSystemName = roleDuty["Name"]?.InnerText;
                    pca.ChildType = LayerType.Duty;
                    securityLayerreplacedociations.Add(pca);
                }

                XmlNodeList rolePrivs = role.SelectNodes("Privileges//AxSecurityPrivilegeReference");
                foreach (XmlNode rolePriv in rolePrivs)
                {
                    ParentToChildreplacedociation pca = new ParentToChildreplacedociation();
                    pca.ParentSystemName = role["Name"]?.InnerText;
                    pca.ParentType = LayerType.Role;
                    pca.ChildSystemName = rolePriv["Name"]?.InnerText;
                    pca.ChildType = LayerType.Privilege;
                    securityLayerreplacedociations.Add(pca);
                }
            }

            XmlNodeList duties = xDoc.GetElementsByTagName("AxSecurityDuty");
            foreach (XmlNode duty in duties)
            {
                XmlNodeList dutyPrivs = duty.SelectNodes("Privileges//AxSecurityPrivilegeReference");
                foreach (XmlNode dutyPriv in dutyPrivs)
                {
                    ParentToChildreplacedociation pca = new ParentToChildreplacedociation();
                    pca.ParentSystemName = duty["Name"]?.InnerText;
                    pca.ParentType = LayerType.Duty;
                    pca.ChildSystemName = dutyPriv["Name"]?.InnerText;
                    pca.ChildType = LayerType.Privilege;
                    securityLayerreplacedociations.Add(pca);
                }
            }

            return securityLayerreplacedociations;
        }

19 View Source File : XMLParser.cs
License : GNU General Public License v3.0
Project Creator : 0x2b00b1e5

public static XmlDoreplacedent LoadDoreplacedent(string path)
        {
            //First check if file exists
            if (!File.Exists(path))
            {
                throw new FileNotFoundException("XML Doreplacedent wasn't found at path!");
            }
            XmlDoreplacedent d = new XmlDoreplacedent();
            d.Load(path);
            return d;
        }

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 : PersistentSettings.cs
License : MIT License
Project Creator : AlexGyver

public void Load(string fileName) {
      XmlDoreplacedent doc = new XmlDoreplacedent();
      try {
        doc.Load(fileName);
      } catch {
        try {
          File.Delete(fileName);
        } catch { }

        string backupFileName = fileName + ".backup";
        try {
          doc.Load(backupFileName);
        } catch {
          try {
            File.Delete(backupFileName);
          } catch { }

          return;
        }
      }

      XmlNodeList list = doc.GetElementsByTagName("appSettings");
      foreach (XmlNode node in list) {
        XmlNode parent = node.ParentNode;
        if (parent != null && parent.Name == "configuration" && 
          parent.ParentNode is XmlDoreplacedent) {
          foreach (XmlNode child in node.ChildNodes) {
            if (child.Name == "add") {
              XmlAttributeCollection attributes = child.Attributes;
              XmlAttribute keyAttribute = attributes["key"];
              XmlAttribute valueAttribute = attributes["value"];
              if (keyAttribute != null && valueAttribute != null && 
                keyAttribute.Value != null) {
                settings.Add(keyAttribute.Value, valueAttribute.Value);
              }
            }
          }
        }
      }
    }

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 : 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);
		}

See More Examples