当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationSaveMode类代码示例

本文整理汇总了C#中ConfigurationSaveMode的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationSaveMode类的具体用法?C# ConfigurationSaveMode怎么用?C# ConfigurationSaveMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurationSaveMode类属于命名空间,在下文中一共展示了ConfigurationSaveMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Unmerge

 protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
 {
     RootProfilePropertySettingsCollection settingss = parentElement as RootProfilePropertySettingsCollection;
     RootProfilePropertySettingsCollection settingss2 = sourceElement as RootProfilePropertySettingsCollection;
     base.Unmerge(sourceElement, parentElement, saveMode);
     this.GroupSettings.InternalUnMerge(settingss2.GroupSettings, (settingss != null) ? settingss.GroupSettings : null, saveMode);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:RootProfilePropertySettingsCollection.cs

示例2: SerializeSection

        protected internal virtual string SerializeSection(ConfigurationElement parentElement, string name,
            ConfigurationSaveMode saveMode)
        {
            if ((CurrentConfiguration != null) &&
                (CurrentConfiguration.TargetFramework != null) &&
                !ShouldSerializeSectionInTargetVersion(CurrentConfiguration.TargetFramework))
                return string.Empty;

            ValidateElement(this, null, true);

            ConfigurationElement tempElement = CreateElement(GetType());
            tempElement.Unmerge(this, parentElement, saveMode);

            StringWriter strWriter = new StringWriter(CultureInfo.InvariantCulture);
            XmlTextWriter writer = new XmlTextWriter(strWriter)
            {
                Formatting = Formatting.Indented,
                Indentation = 4,
                IndentChar = ' '
            };

            tempElement.DataToWriteInternal = saveMode != ConfigurationSaveMode.Minimal;

            if ((CurrentConfiguration != null) && (CurrentConfiguration.TargetFramework != null))
                _configRecord.SectionsStack.Push(this);

            tempElement.SerializeToXmlElement(writer, name);

            if ((CurrentConfiguration != null) && (CurrentConfiguration.TargetFramework != null))
                _configRecord.SectionsStack.Pop();

            writer.Flush();
            return strWriter.ToString();
        }
开发者ID:chcosta,项目名称:corefx,代码行数:34,代码来源:ConfigurationSection.cs

示例3: SerializeSection

 protected override string SerializeSection(
     ConfigurationElement parentElement,
     string name, ConfigurationSaveMode saveMode)
 {
     string s =
         base.SerializeSection(parentElement,name, saveMode);
     return s;
 }
开发者ID:cleciusjm,项目名称:db4oanalyzer,代码行数:8,代码来源:Db4oAnalyzerSection.cs

示例4: SerializeSection

 protected override string SerializeSection(
     ConfigurationElement parentElement,
     string name, ConfigurationSaveMode saveMode)
 {
     string s = base.SerializeSection(parentElement, name, saveMode);
     // You can add custom processing code here.
     return s;
 }
开发者ID:Allen-Zhou,项目名称:AF,代码行数:8,代码来源:PLGroup.cs

示例5: SerializeSection

 protected override string SerializeSection(ConfigurationElement parentElement, 
     string name, 
     ConfigurationSaveMode saveMode)
 {
     StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
     XmlTextWriter textWriter = new XmlTextWriter(stringWriter);
     serializer.Serialize(textWriter, Settings);
     return stringWriter.ToString();
 }
开发者ID:bszafko,项目名称:TracAssistant,代码行数:9,代码来源:SettingsService.cs

示例6: Unmerge

 protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
 {
     base.Unmerge(sourceElement, parentElement, saveMode);
     SwitchElement element = sourceElement as SwitchElement;
     if ((element != null) && (element._attributes != null))
     {
         this._attributes = element._attributes;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:SwitchElement.cs

示例7: SerializeSection

 protected override string SerializeSection(ConfigurationElement parentElement, string name, ConfigurationSaveMode saveMode)
 {
     StringWriter sWriter = new StringWriter(CultureInfo.InvariantCulture);
     XmlTextWriter xWriter = new XmlTextWriter(sWriter);
     xWriter.Formatting = Formatting.Indented;
     xWriter.Indentation = 4;
     xWriter.IndentChar = ' ';
     SerializeToXmlElement(xWriter, name);
     xWriter.Flush();
     return sWriter.ToString();
 }
开发者ID:rmacdonaldsmith,项目名称:ServiceBroker,代码行数:11,代码来源:IntegrationConfigSection.cs

示例8: Unmerge

        protected internal override void Unmerge(ConfigurationElement sourceElement,
            ConfigurationElement parentElement,
            ConfigurationSaveMode saveMode)
        {
            ProviderSettings parentProviders = parentElement as ProviderSettings;
            parentProviders?.UpdatePropertyCollection(); // before reseting make sure the bag is filled in

            ProviderSettings sourceProviders = sourceElement as ProviderSettings;
            sourceProviders?.UpdatePropertyCollection(); // before reseting make sure the bag is filled in

            base.Unmerge(sourceElement, parentElement, saveMode);
            UpdatePropertyCollection();
        }
开发者ID:chcosta,项目名称:corefx,代码行数:13,代码来源:ProviderSettings.cs

示例9: SerializeSection

        protected internal virtual string SerializeSection(ConfigurationElement parentElement, string name, ConfigurationSaveMode saveMode) {
            ValidateElement(this, null, true);

            ConfigurationElement TempElement = CreateElement(this.GetType());
            TempElement.Unmerge(this, parentElement, saveMode);

            StringWriter strWriter = new StringWriter(CultureInfo.InvariantCulture);
            XmlTextWriter writer = new XmlTextWriter(strWriter);
            writer.Formatting = Formatting.Indented;
            writer.Indentation = 4;
            writer.IndentChar = ' ';
            TempElement.DataToWriteInternal = (saveMode != ConfigurationSaveMode.Minimal);
            TempElement.SerializeToXmlElement(writer, name);
            writer.Flush();
            return strWriter.ToString();
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:16,代码来源:configurationsection.cs

示例10: SerializeSection

        /// <summary>
        /// Creates an XML string containing an unmerged view of the <see cref="ConfigurationSection" /> 
        /// object as a single section to write to a file.
        /// </summary>
        /// <param name="parentElement">The <see cref="ConfigurationElement" /> 
        /// instance to use as the parent when performing the un-merge.</param>
        /// <param name="name">The name of the section to create.</param>
        /// <param name="saveMode">The <see cref="ConfigurationSaveMode" /> instance 
        /// to use when writing to a string.</param>
        /// <returns>
        /// An XML string containing an unmerged view of the <see cref="ConfigurationSection" /> object.
        /// </returns>
        protected override string SerializeSection(ConfigurationElement parentElement, string name, 
            ConfigurationSaveMode saveMode)
        {
            IgniteArgumentCheck.NotNull(parentElement, "parentElement");
            IgniteArgumentCheck.NotNullOrEmpty(name, "name");

            if (IgniteConfiguration == null)
                return string.Format("<{0} />", name);

            var sb = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(sb))
            {
                IgniteConfigurationXmlSerializer.Serialize(IgniteConfiguration, xmlWriter, name);

                return sb.ToString();
            }
        }
开发者ID:RazmikMkrtchyan,项目名称:ignite,代码行数:30,代码来源:IgniteConfigurationSection.cs

示例11: ElementUnmerge

		void ElementUnmerge (ConfigurationElement target, ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
		{
			target.GetType ().GetMethod ("Unmerge", BindingFlags.NonPublic | BindingFlags.Instance).Invoke (target, new object [] {sourceElement, parentElement, saveMode});
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:4,代码来源:SettingValueElement.cs

示例12: Unmerge

		protected override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
		{
			if (parentElement != null && sourceElement.GetType() != parentElement.GetType())
				throw new ConfigurationErrorsException ("Can't unmerge two elements of different type");

			bool isMinimalOrModified = saveMode == ConfigurationSaveMode.Minimal ||
				saveMode == ConfigurationSaveMode.Modified;

			foreach (PropertyInformation prop in sourceElement.ElementInformation.Properties)
			{
				if (prop.ValueOrigin == PropertyValueOrigin.Default)
					continue;
				
				PropertyInformation unmergedProp = ElementInformation.Properties [prop.Name];
				
				object sourceValue = prop.Value;
				if (parentElement == null || !HasValue (parentElement, prop.Name)) {
					unmergedProp.Value = sourceValue;
					continue;
				}

				if (sourceValue == null)
					continue;

				object parentValue = GetItem (parentElement, prop.Name);
				if (!PropertyIsElement (prop)) {
					if (!object.Equals (sourceValue, parentValue) || 
					    (saveMode == ConfigurationSaveMode.Full) ||
					    (saveMode == ConfigurationSaveMode.Modified && prop.ValueOrigin == PropertyValueOrigin.SetHere))
						unmergedProp.Value = sourceValue;
					continue;
				}

				var sourceElem = (ConfigurationElement) sourceValue;
				if (isMinimalOrModified && !ElementIsModified (sourceElem))
					continue;
				if (parentValue == null) {
					unmergedProp.Value = sourceValue;
					continue;
				}

				var parentElem = (ConfigurationElement) parentValue;
				ConfigurationElement copy = (ConfigurationElement) unmergedProp.Value;
				ElementUnmerge (copy, sourceElem, parentElem, saveMode);
			}
		}
开发者ID:BrzVlad,项目名称:mono,代码行数:46,代码来源:SettingValueElement.cs

示例13: HasValues

		bool HasValues (ConfigurationSaveMode mode)
		{
			foreach (ConfigurationLocation loc in Locations) {
				if (loc.OpenedConfiguration == null)
					continue;
				if (loc.OpenedConfiguration.HasValues (mode))
					return true;
			}

			return rootGroup.HasValues (this, mode);
		}
开发者ID:rabink,项目名称:mono,代码行数:11,代码来源:Configuration.cs

示例14: Save

		void Save (Stream stream, ConfigurationSaveMode mode, bool forceUpdateAll)
		{
			XmlTextWriter tw = new XmlTextWriter (new StreamWriter (stream));
			tw.Formatting = Formatting.Indented;
			try {
				tw.WriteStartDocument ();
				if (rootNamespace != null)
					tw.WriteStartElement ("configuration", rootNamespace);
				else
					tw.WriteStartElement ("configuration");
				if (rootGroup.HasConfigContent (this)) {
					rootGroup.WriteConfig (this, tw, mode);
				}
				
				foreach (ConfigurationLocation loc in Locations) {
					if (loc.OpenedConfiguration == null) {
						tw.WriteRaw ("\n");
						tw.WriteRaw (loc.XmlContent);
					}
					else {
						tw.WriteStartElement ("location");
						tw.WriteAttributeString ("path", loc.Path); 
						if (!loc.AllowOverride)
							tw.WriteAttributeString ("allowOverride", "false");
						loc.OpenedConfiguration.SaveData (tw, mode, forceUpdateAll);
						tw.WriteEndElement ();
					}
				}
				
				SaveData (tw, mode, forceUpdateAll);
				tw.WriteEndElement ();
				ResetModified ();
			}
			finally {
				tw.Flush ();
				tw.Close ();
			}
		}
开发者ID:rabink,项目名称:mono,代码行数:38,代码来源:Configuration.cs

示例15: SaveAs

		public void SaveAs (string filename, ConfigurationSaveMode mode)
		{
			SaveAs (filename, mode, false);
		}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:Configuration.cs


注:本文中的ConfigurationSaveMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。