/// <summary> /// Update RunTimeData custom configuration sections /// Edit an existing key's value /// </summary> /// <param name="key"></param> /// <param name="value"></param> public static void UpdateKeyConfigSectionData(string key, string value) { //First get the current environment from the appSettings section var environment = AppConfig.GetAppSettingsValue("Environment"); // Update custom configuration sections - Edit an existing key's value ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); //this dir accesses the \bin runtime location //not the project app.config file //xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); //var projectDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; //var fileDir = projectDir + @"\AcceptanceTests\DataFiles\"; //var xmlDir = fileDir + "RunTimeData.xml"; //Replace with get xmlDir Method() xmlDoc.Load(xmlDir); //Update the key value //xmlDoc.SelectSingleNode("//Local/add[@key='Test']").Attributes["value"].Value = "New Value6"; var node = "//" + environment + "/add[@key='" + key + "']"; xmlDoc.SelectSingleNode(node).Attributes["value"].Value = value; //xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); xmlDoc.Save(xmlDir); ConfigurationManager.RefreshSection("//" + environment); }
public static bool SaveSection(string fileName, string name, MailerConfiguration section) { System.Configuration.ConfigXmlDocument doc = new ConfigXmlDocument(); try { doc.Load(fileName); XmlNode configNode = doc.ChildNodes[1]; foreach (XmlNode node in configNode.ChildNodes) { if (node.Name == name) { configNode.RemoveChild(node); } } XmlNode newNode = section.CreateNode(doc, name); configNode.AppendChild(newNode); doc.Save(fileName); return(true); } catch { return(false); } }
private void CreateAddInConfigurationFile(string serviceDirectory) { string addInConfigurationFile; System.Configuration.Configuration config; System.Configuration.ConfigXmlDocument xml = new ConfigXmlDocument( ); XmlNodeList nodes; addInConfigurationFile = Path.Combine(serviceDirectory, "service.config"); config = ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); config.SaveAs(addInConfigurationFile); xml.Load(addInConfigurationFile); nodes = xml.GetElementsByTagName("appSettings"); if (nodes.Count > 0) { nodes [0].ParentNode.RemoveChild(nodes [0]); xml.Save(addInConfigurationFile); } }
XmlDocument GetDocumentForSection(string sectionName) { ConfigXmlDocument doc = new ConfigXmlDocument(); if (pending == null) { return(doc); } string [] sectionPath = sectionName.Split('/'); string outerxml = pending [sectionPath [0]] as string; if (outerxml == null) { return(doc); } StringReader reader = new StringReader(outerxml); XmlTextReader rd = new XmlTextReader(reader); rd.MoveToContent(); doc.LoadSingleElement(fileName, rd); return(GetInnerDoc(doc, 0, sectionPath)); }
private void LoadWorlds() { try { GLSDatacenterInfoServer svc = new GLSDatacenterInfoServer(); Datacenter[] dc = svc.GetDatacenters(Settings.Game); List <Datacenter> dataCenters = dc.ToList(); worlds = dataCenters[0].Worlds.ToList(); cbServer.DataSource = worlds; if (!string.IsNullOrEmpty(Settings.DefaultServer)) { cbServer.SelectedIndex = cbServer.FindStringExact(Settings.DefaultServer); } ConfigXmlDocument cxd = new ConfigXmlDocument(); cxd.Load(dataCenters[0].LauncherConfigurationServer); dataCenterSettings = new Dictionary <string, string>(); foreach (XmlNode node in cxd["configuration"]["appSettings"].ChildNodes) { if (node.Attributes != null) { dataCenterSettings.Add(node.Attributes["key"].Value, node.Attributes["value"].Value); } } } catch (Exception ex) { MessageBox.Show("Error getting datacenters\n" + ex.Message); } GetServerStatuses(); }
/// <summary> /// Загрузить конфиг-файл. /// </summary> internal static void LoadXmlConfig() { string fileName = DefaultFormFullFileName; bool create = false; if (File.Exists(fileName)) { try { programParams.Load(fileName); } catch (Exception) { create = true; } } if (create) { programParams = new ConfigXmlDocument(); XmlDeclaration declaration = programParams.CreateXmlDeclaration("1.0", "utf-8", "yes"); programParams.AppendChild(declaration); XmlNode root = programParams.CreateElement(trainerRootNodeName); programParams.AppendChild(root); } }
XmlDocument GetInnerDoc(XmlDocument doc, int i, string [] sectionPath) { if (++i >= sectionPath.Length) { return(doc); } if (doc.DocumentElement == null) { return(null); } XmlNode node = doc.DocumentElement.FirstChild; while (node != null) { if (node.Name == sectionPath [i]) { ConfigXmlDocument result = new ConfigXmlDocument(); result.Load(new StringReader(node.OuterXml)); return(GetInnerDoc(result, i, sectionPath)); } node = node.NextSibling; } return(null); }
/// <summary> /// Update RunTimeData custom configuration sections /// Delete an existing key /// </summary> /// <param name="key"></param> public static void DeleteKeyConfigSectionData(string key) { //First get the current environment from the appSettings section var environment = AppConfig.GetAppSettingsValue("Environment"); //Update custom configuration sections - Add a new key ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); //var projectDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; //var fileDir = projectDir + @"\AcceptanceTests\DataFiles\"; //var xmlDir = fileDir + "RunTimeData.xml"; //Replace with get xmlDir Method() xmlDoc.Load(xmlDir); //XmlNode node = xmlDoc.SelectSingleNode("//Dev/add[@key='Key1']"); var nodeString = "//" + environment + "/add[@key='" + key + "']"; XmlNode node = xmlDoc.SelectSingleNode(nodeString); node.ParentNode.RemoveChild(node); //xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); xmlDoc.Save(xmlDir); ConfigurationManager.RefreshSection("//" + environment); }
public void GetLineNumber2() { XmlNode node; int line; string xmlfile = Path.Combine(foldername, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); node = new XmlDocument(); line = ConfigurationErrorsException.GetLineNumber(node); Assert.AreEqual(0, line, "#1"); doc = new XmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; line = ConfigurationErrorsException.GetLineNumber(node); Assert.AreEqual(0, line, "#2"); doc = new ConfigXmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; line = ConfigurationErrorsException.GetLineNumber(node); Assert.AreEqual(1, line, "#3"); }
public LauncherData(string workingDir) { dataCenterConfig = new ConfigXmlDocument(); dataCenterConfig.Load(System.IO.Path.Combine(workingDir, "TurbineLauncher.exe.config")); gameName = GetAppSetting(dataCenterConfig, "DataCenter.GameName"); dataCenterServer = GetAppSetting(dataCenterConfig, "Launcher.DataCenterService.GLS"); GLSDatacenterInfoServer svc = new GLSDatacenterInfoServer(); svc.Url = dataCenterServer; Datacenter[] dc = svc.GetDatacenters(gameName); dataCenter = dc[0]; dataCenterConfig = new ConfigXmlDocument(); dataCenterConfig.Load(dataCenter.LauncherConfigurationServer); dataCenterSettings = new Dictionary <string, string>(); foreach (XmlNode node in dataCenterConfig["configuration"]["appSettings"].ChildNodes) { if (node.Attributes != null) { dataCenterSettings.Add(node.Attributes["key"].Value, node.Attributes["value"].Value); } } worlds = dataCenter.Worlds.ToDictionary(w => w.Name, w => w); }
private static XmlNode BuildConfigurationSection(string xml) { var doc = new ConfigXmlDocument(); doc.LoadXml(xml); return(doc.DocumentElement); }
public Tease LoadTease(string scriptFileName) { Tease result = null; string fileContents = File.ReadAllText(scriptFileName); if (fileContents.StartsWith("<?xml")) { var xmldoc = new ConfigXmlDocument(); xmldoc.LoadXml(fileContents); if (xmldoc.DocumentElement != null) { if (xmldoc.DocumentElement.LocalName == "Tease") { // Current file format. if (xmldoc.DocumentElement.SelectSingleNode(String.Format("/Tease[@scriptVersion='{0}']", SupportedScriptVersion)) != null) { using (var reader = new StreamReader(scriptFileName)) { result = new XmlSerializer(typeof(Tease)).Deserialize(reader) as Tease; } } } } } if (result != null) { result.ScriptDirectory = new FileInfo(scriptFileName).DirectoryName; Environment.CurrentDirectory = result.ScriptDirectory; } return(result); }
[Fact] // GetFilename (XmlNode) // Doesn't pass on Mono // [Category("NotWorking")] public void GetFilename2() { using (var temp = new TempDirectory()) { XmlNode node; string filename; string xmlfile = Path.Combine(temp.Path, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); node = new XmlDocument(); filename = ConfigurationErrorsException.GetFilename(node); Assert.Null(filename); doc = new XmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; filename = ConfigurationErrorsException.GetFilename(node); Assert.Null(filename); doc = new ConfigXmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; filename = ConfigurationErrorsException.GetFilename(node); Assert.Equal(xmlfile, filename); } }
private void ModifyAppInsightsConfigFile(bool removeSettings = false) { var configFile = Server.MapPath("~/ApplicationInsights.config"); if (!File.Exists(configFile)) { File.Copy(Server.MapPath("~/DesktopModules/AppInsights/ApplicationInsights.config"), configFile); } // Load the ApplicationInsights.config file var config = new ConfigXmlDocument(); config.Load(configFile); var key = removeSettings ? string.Empty : ModuleSettings.GetValueOrDefault("InstrumentationKey", string.Empty); const string namespaceUri = "http://schemas.microsoft.com/ApplicationInsights/2013/Settings"; var nsmgr = new XmlNamespaceManager(config.NameTable); nsmgr.AddNamespace("nr", namespaceUri); // Change instrumentation key var keyNode = config.SelectSingleNode("//nr:InstrumentationKey", nsmgr); if (keyNode != null) { keyNode.InnerText = key; } // Save the modifications config.Save(configFile); }
[Fact] // GetLineNumber (XmlNode) // Doesn't pass on Mono // [Category("NotWorking")] public void GetLineNumber2() { using (var temp = new TempDirectory()) { XmlNode node; int line; string xmlfile = Path.Combine(temp.Path, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); node = new XmlDocument(); line = ConfigurationErrorsException.GetLineNumber(node); Assert.Equal(0, line); doc = new XmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; line = ConfigurationErrorsException.GetLineNumber(node); Assert.Equal(0, line); doc = new ConfigXmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; line = ConfigurationErrorsException.GetLineNumber(node); Assert.Equal(1, line); } }
public void GetFilename2() { XmlNode node; string filename; string xmlfile = Path.Combine(foldername, "test.xml"); XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("test")); doc.Save(xmlfile); node = new XmlDocument(); filename = ConfigurationErrorsException.GetFilename(node); Assert.IsNull(filename, "#1"); doc = new XmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; filename = ConfigurationErrorsException.GetFilename(node); Assert.IsNull(filename, "#2"); doc = new ConfigXmlDocument(); doc.Load(xmlfile); node = doc.DocumentElement; filename = ConfigurationErrorsException.GetFilename(node); Assert.AreEqual(xmlfile, filename, "#3"); }
/// <summary> /// Update RunTimeData appSettings sections /// Add a new key /// </summary> /// <param name="key"></param> /// <param name="value"></param> public static void AddKeyAppSettings(string key, string value) { //Update custom configuration sections - Add a new key ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); //var projectDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; //var fileDir = projectDir + @"\AcceptanceTests\DataFiles\"; //var xmlDir = fileDir + "RunTimeData.xml"; //Replace with get xmlDir Method() xmlDoc.Load(xmlDir); // create new node <add key="New Key" value="New Key Value1" /> var node = xmlDoc.CreateElement("add"); //node.SetAttribute("key", "New Key"); //node.SetAttribute("value", "New Key Value1"); node.SetAttribute("key", key); node.SetAttribute("value", value); xmlDoc.SelectSingleNode("//appSettings").AppendChild(node); //xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); xmlDoc.Save(xmlDir); ConfigurationManager.RefreshSection("//appSettings"); }
public registerReader() { if (cfgDom == null) { cfgDom = new ConfigXmlDocument(); } cfgDom.Load(string.Format("{0}{1}", System.AppDomain.CurrentDomain.BaseDirectory, CFG_FILE)); }
public static string GetFormattedXml(this ConfigXmlDocument config, string indent = " ") { const string newline = "\n"; var lastElement = ""; var stack = new Stack <string>(); var builder = new StringBuilder(); var elements = config.InnerXml.Split(new[] { '<' }, StringSplitOptions.RemoveEmptyEntries) .Where(n => !string.IsNullOrWhiteSpace(n)) .Select(n => string.Format("<{0}", n).Trim()) .ToArray(); foreach (var element in elements) { // append newline only when last line ends with > if (builder.ToString().EndsWith(">")) { builder.Append(newline); } // append element to builder builder.Append(element); // push non-closing element onto builder if (!element.StartsWith("</")) { stack.Push(element); } // when there is only 1 element in the stack, continue if (stack.Count == 1) { continue; } // apply indentation if (string.IsNullOrWhiteSpace(lastElement) || lastElement.EndsWith(">")) { for (var i = 0; i < stack.Count - 1; i++) { builder.Insert(builder.Length - element.Length, indent); } } // self-closing elements and comments get popped off the stack if (element.StartsWith("</") || element.StartsWith("<!--") || stack.First().EndsWith("/>")) { stack.Pop(); } lastElement = element; } var result = builder.ToString(); return(result); }
public virtual JsonResult Decrypt(DecryptRequestModel model) { ThrowWhenModelStateIsInvalid(); var config = CreateConfigXmlDocument(model.Thumbprint, model.XmlInput); InitializeProvider(model.Thumbprint); // decrypt var decryptedSections = new StringBuilder(); foreach (var node in GetEligibleCryptoNodes(config)) { XmlNode decryptedNode; try { // sometimes the content may not be decryptable using the provided thumbprint decryptedNode = _provider.Decrypt(node); } catch (CryptographicException ex) { // when decryption fails with this thumbprint, display message to the user return(Json(new { error = ex.Message.Trim() })); } // when the decrypted node already has a configProtectionProvider attribute, push it into the builder if (decryptedNode.Attributes != null && decryptedNode.Attributes["configProtectionProvider"] != null) { // the decrypted node wraps the decrypted xml, so only push its inner xml decryptedSections.Append(decryptedNode.InnerXml.Trim()); } // otherwise, find the decryption target else { var cryptoNode = FindNestedCryptoNode(decryptedNode); Debug.Assert(cryptoNode.ParentNode != null); // get rid of the crypto node when decrypting cryptoNode.ParentNode.InnerXml = cryptoNode.InnerXml; decryptedSections.Append(decryptedNode.OuterXml); } } // create a brand new config document after decryption is complete config = new ConfigXmlDocument { InnerXml = "<configuration></configuration>", DocumentElement = { InnerXml = decryptedSections.ToString() }, }; // format and return the decrypted xml var decrypted = config.GetFormattedXml(); return(Json(decrypted)); }
public Tease LoadTease(string scriptFileName) { Tease result = null; string fileContents = File.ReadAllText(scriptFileName); if (fileContents.StartsWith("<?xml")) { var xmldoc = new ConfigXmlDocument(); xmldoc.LoadXml(fileContents); if (xmldoc.DocumentElement != null) { if (xmldoc.DocumentElement.LocalName == "Tease") { // Current file format. if (xmldoc.DocumentElement.SelectSingleNode(String.Format("/Tease[@scriptVersion='{0}']", SupportedScriptVersion)) != null) { using (var reader = new StreamReader(scriptFileName)) { result = new XmlSerializer(typeof(Tease)).Deserialize(reader) as Tease; } } } if (xmldoc.DocumentElement.LocalName == "pages") { // Previous file format. var converter = new OldScriptConverter(fileContents); if (converter.CanConvert()) { result = converter.ConvertToTease(); var sourceFileName = new FileInfo(scriptFileName); var destFileName = sourceFileName.Name.BeforeLast(sourceFileName.Extension) + "-v0_0_5" + sourceFileName.Extension; string message = "The tease you selected is made for a previous version of this application. " + "Do you want to convert it to the current file format?\n" + "\n" + "Your old file will be renamed to " + destFileName; if (DialogResult.Yes == MessageBox.Show(message, "Save tease in new file format?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { File.Move(scriptFileName, Path.Combine(sourceFileName.DirectoryName, destFileName)); SaveTease(result, sourceFileName.FullName); } } } } } if (result != null) { result.ScriptDirectory = new FileInfo(scriptFileName).DirectoryName; Environment.CurrentDirectory = result.ScriptDirectory; } return(result); }
public void InsideLoop() { ConfigXmlDocument doc; while (true) { doc = new ConfigXmlDocument(); doc.XmlResolver = new XmlPreloadedResolver(); // Noncompliant } }
private static IEnumerable <XmlNode> GetEligibleCryptoNodes(ConfigXmlDocument config) { // ignore configProtectedData and whitespace nodes when crypting var configRoot = config.DocumentElement; Debug.Assert(configRoot != null); return(configRoot.ChildNodes.Cast <XmlNode>() .Where(n => n.Name != "configProtectedData" && n.Name != "#whitespace") .ToArray()); }
private void LocalFunction() { var doc = new ConfigXmlDocument(); LocalFunction(); void LocalFunction() { doc.XmlResolver = new XmlPreloadedResolver(); // Noncompliant } }
protected static Process Start <T>(string executableFileName, T parameter, SubprocessConfiguration configuration, Uri address) { var configPath = Path.Combine(TempDir, "C" + Interlocked.Increment(ref _AssemblyCount) + ".T" + DateTime.Now.Ticks + ".config"); var configDocument = new ConfigXmlDocument(); AppendConfig(configDocument, ConfigurationUserLevel.None); AppendConfig(configDocument, ConfigurationUserLevel.PerUserRoaming); AppendConfig(configDocument, ConfigurationUserLevel.PerUserRoamingAndLocal); if (configuration.ShouldCreateConfig) { if (configDocument.DocumentElement == null) { configDocument.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<configuration></configuration>"); } configDocument.Save(configPath); configuration.RaiseConfigCreated(new ConfigCreatedEventArgs(configPath)); } else if (configDocument.DocumentElement != null) { configDocument.Save(configPath); } var psi = new ProcessStartInfo(executableFileName); var spp = new SubprocessArgument <T>(); spp.TemporaryDirectory = TempDir; spp.Address = address; spp.Parameter = parameter; spp.ParentProcessId = Process.GetCurrentProcess().Id; spp.IsStandalone = configuration.IsStandalone; if (configuration.AttachDebugger) { spp.DebuggerInfo = DebuggerInfoProvider.GetCurrent(); } var argFilePath = Path.Combine(TempDir, "A" + Interlocked.Increment(ref _AssemblyCount) + ".T" + DateTime.Now.Ticks + ".xml"); using (var fs = new FileStream(argFilePath, FileMode.Create)) { new DataContractSerializer(spp.GetType()).WriteObject(fs, spp); } psi.Arguments = configDocument.DocumentElement != null ? (argFilePath + " \"" + configPath + "\"") : argFilePath; var p = Process.Start(psi); return(p); }
protected void btnGetTheatres_Click(object sender, EventArgs e) { //haetaan FinnKinon teatterit listboxiin ConfigXmlDocument doc = new ConfigXmlDocument(); doc.Load(urlToTheatres); XmlNodeList nodes = doc.DocumentElement.SelectNodes("TheatreArea"); foreach (XmlNode node in nodes) { ListItem li = new ListItem(node["Name"].InnerText,node["ID"].InnerText); myListBox.Items.Add(li); } }
private void change_net_settings_Click(object sender, EventArgs e) { //Tomo los valores de ambos cuadros de texto string IPstr = new_IP_txt.Text.Trim(); string PORTstr = new_PORT_txt.Text.Trim(); if (IPstr == "") { string message = "Changes cannot be applied - IP Address empty"; string title = "Error"; MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); return; } if (PORTstr == "") { string message = "Changes cannot be applied - PORT empty"; string title = "Error"; MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); return; } //Editar el App.config ConfigXmlDocument xmlDoc = new ConfigXmlDocument(); xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); foreach (System.Xml.XmlElement el in xmlDoc.DocumentElement) { if (el.Name.Equals("appSettings")) { foreach (System.Xml.XmlNode node in el.ChildNodes) { if (node.Attributes[0].Value == "IP_address") { node.Attributes[1].Value = IPstr; } if (node.Attributes[0].Value == "PORT") { node.Attributes[1].Value = PORTstr; } } } xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); ConfigurationManager.RefreshSection("appSettings"); } MessageBox.Show("Changes applied successfully"); this.Close(); }
public void CanLoadSchemaImportingOtherSchemaByRelativePath() { string schemaLocation = TestResourceLoader.GetAssemblyResourceUri(this.GetType(), "NamespaceParserRegistryTests_TestSchema.xsd"); NamespaceParserRegistry.RegisterParser(new TestNamespaceParser(), "http://www.example.com/brief", schemaLocation); XmlReader vr = XmlUtils.CreateValidatingReader(new StringResource( @"<?xml version='1.0' encoding='UTF-8' ?> <brief class='foo' /> ").InputStream, NamespaceParserRegistry.GetSchemas(), null); ConfigXmlDocument newDoc = new ConfigXmlDocument(); newDoc.Load(vr); }
private ConfigXmlDocument LoadConfigDocument(string configPath) { try { ConfigXmlDocument configXmlDocument = new ConfigXmlDocument(); configXmlDocument.Load(configPath); return(configXmlDocument); } catch (Exception ex) { throw new Exception("目录下的配置文件有异常,请检查!"); } }
public void InsideTryCatch() { ConfigXmlDocument doc; try { doc = new ConfigXmlDocument(); doc.XmlResolver = new XmlPreloadedResolver(); // Noncompliant } catch { } }
/// <summary> /// 描画後に文字列を埋める処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WindowGeneralBase_ContentRendered(object sender, EventArgs e) { bool lcflag = false; string lcuser = string.Empty; string lcpass = string.Empty; try { FileInfo fi = new System.IO.FileInfo(GetLocalConfigFilePath()); if (fi.Exists) { ConfigXmlDocument cdoc = new ConfigXmlDocument(); cdoc.Load(fi.FullName); var cfgs = cdoc.SelectNodes("/configuration/settings/add"); foreach (var item in cfgs) { var key = (item as XmlElement).Attributes.GetNamedItem("key").Value; var val = (item as XmlElement).Attributes.GetNamedItem("value").Value; switch (key) { case "LoginCheck": lcflag = string.IsNullOrWhiteSpace(val) ? false : Convert.ToBoolean(val); break; case "TextUr": lcuser = Utility.Decrypt(val); break; case "TextLr": lcpass = Utility.Decrypt(val); break; } } } } catch (Exception) { } finally { this.ライセンス情報記憶 = lcflag; if (lcflag) { this.ユーザーID = lcuser; if (lcpass.Trim() != string.Empty) { this.PASSWORD.SetPassword(lcpass); } } } }
public static string GetSiteSetting(System.Web.HttpServerUtility server, string name) { ConfigXmlDocument cfxd = new ConfigXmlDocument(); cfxd.Load(server.MapPath(SiteConfigPath)); try { string value = cfxd.GetElementsByTagName(name)[0].InnerText; return value; } catch { return ""; } }