本文整理汇总了C#中ConfigurationSaveMode类的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationSaveMode类的具体用法?C# ConfigurationSaveMode怎么用?C# ConfigurationSaveMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationSaveMode类属于命名空间,在下文中一共展示了ConfigurationSaveMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UnMergeLockList
internal ConfigurationLockCollection UnMergeLockList(ConfigurationLockCollection sourceLockList, ConfigurationLockCollection parentLockList, ConfigurationSaveMode saveMode)
{
if (!sourceLockList.ExceptionList)
{
switch (saveMode)
{
case ConfigurationSaveMode.Modified:
{
ConfigurationLockCollection locks = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string str in sourceLockList)
{
if (!parentLockList.Contains(str) || sourceLockList.IsValueModified(str))
{
locks.Add(str, ConfigurationValueFlags.Default);
}
}
return locks;
}
case ConfigurationSaveMode.Minimal:
{
ConfigurationLockCollection locks2 = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string str2 in sourceLockList)
{
if (!parentLockList.Contains(str2))
{
locks2.Add(str2, ConfigurationValueFlags.Default);
}
}
return locks2;
}
}
return sourceLockList;
}
if ((saveMode == ConfigurationSaveMode.Modified) || (saveMode == ConfigurationSaveMode.Minimal))
{
bool flag = false;
if (sourceLockList.Count == parentLockList.Count)
{
flag = true;
foreach (string str3 in sourceLockList)
{
if (!parentLockList.Contains(str3) || (sourceLockList.IsValueModified(str3) && (saveMode == ConfigurationSaveMode.Modified)))
{
flag = false;
}
}
}
if (flag)
{
return null;
}
}
return sourceLockList;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:ConfigurationElement.cs
示例17: Unmerge
// LAMESPEC: this is missing from MSDN, but is present in the 2.0sp1 version of the
// class
protected internal override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
{
// Why override?
base.Unmerge (sourceElement, parentElement, saveMode);
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:RootProfilePropertySettingsCollection.cs
示例18: Unmerge
protected internal virtual void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
{
if (sourceElement != null)
{
bool flag = false;
this._lockedAllExceptAttributesList = sourceElement._lockedAllExceptAttributesList;
this._lockedAllExceptElementsList = sourceElement._lockedAllExceptElementsList;
this._fItemLocked = sourceElement._fItemLocked;
this._lockedAttributesList = sourceElement._lockedAttributesList;
this._lockedElementsList = sourceElement._lockedElementsList;
this.AssociateContext(sourceElement._configRecord);
if (parentElement != null)
{
if (parentElement._lockedAttributesList != null)
{
this._lockedAttributesList = this.UnMergeLockList(sourceElement._lockedAttributesList, parentElement._lockedAttributesList, saveMode);
}
if (parentElement._lockedElementsList != null)
{
this._lockedElementsList = this.UnMergeLockList(sourceElement._lockedElementsList, parentElement._lockedElementsList, saveMode);
}
if (parentElement._lockedAllExceptAttributesList != null)
{
this._lockedAllExceptAttributesList = this.UnMergeLockList(sourceElement._lockedAllExceptAttributesList, parentElement._lockedAllExceptAttributesList, saveMode);
}
if (parentElement._lockedAllExceptElementsList != null)
{
this._lockedAllExceptElementsList = this.UnMergeLockList(sourceElement._lockedAllExceptElementsList, parentElement._lockedAllExceptElementsList, saveMode);
}
}
ConfigurationPropertyCollection properties = this.Properties;
ConfigurationPropertyCollection propertys2 = null;
for (int i = 0; i < sourceElement.Values.Count; i++)
{
string key = sourceElement.Values.GetKey(i);
object obj2 = sourceElement.Values[i];
ConfigurationProperty property = sourceElement.Properties[key];
if ((property != null) && ((propertys2 == null) || propertys2.Contains(property.Name)))
{
if (property.IsConfigurationElementType)
{
flag = true;
}
else if ((obj2 != s_nullPropertyValue) && !properties.Contains(key))
{
ConfigurationValueFlags valueFlags = sourceElement.Values.RetrieveFlags(key);
this._values.SetValue(key, obj2, valueFlags, null);
properties.Add(property);
}
}
}
foreach (ConfigurationProperty property2 in this.Properties)
{
object defaultValue;
if ((property2 != null) && ((propertys2 == null) || propertys2.Contains(property2.Name)))
{
if (property2.IsConfigurationElementType)
{
flag = true;
}
else
{
object objA = sourceElement.Values[property2.Name];
if (((property2.IsRequired || (saveMode == ConfigurationSaveMode.Full)) && ((objA == null) || (objA == s_nullPropertyValue))) && (property2.DefaultValue != null))
{
objA = property2.DefaultValue;
}
if ((objA != null) && (objA != s_nullPropertyValue))
{
defaultValue = null;
if (parentElement != null)
{
defaultValue = parentElement.Values[property2.Name];
}
if (defaultValue == null)
{
defaultValue = property2.DefaultValue;
}
switch (saveMode)
{
case ConfigurationSaveMode.Modified:
{
bool flag2 = sourceElement.Values.IsModified(property2.Name);
bool flag3 = sourceElement.Values.IsInherited(property2.Name);
if (((property2.IsRequired || flag2) || !flag3) || (((parentElement == null) && flag3) && !object.Equals(objA, defaultValue)))
{
this._values[property2.Name] = objA;
}
break;
}
case ConfigurationSaveMode.Minimal:
if (!object.Equals(objA, defaultValue) || property2.IsRequired)
{
this._values[property2.Name] = objA;
}
break;
case ConfigurationSaveMode.Full:
if ((objA == null) || (objA == s_nullPropertyValue))
{
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ConfigurationElement.cs
示例19: UnMergeLockList
internal ConfigurationLockCollection UnMergeLockList(
ConfigurationLockCollection sourceLockList,
ConfigurationLockCollection parentLockList,
ConfigurationSaveMode saveMode) {
if (sourceLockList.ExceptionList == false) {
switch (saveMode) {
case ConfigurationSaveMode.Modified: {
ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string lockedAttributeName in sourceLockList)
if (!parentLockList.Contains(lockedAttributeName) ||
sourceLockList.IsValueModified(lockedAttributeName)) {
tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
}
return tempLockList;
}
case ConfigurationSaveMode.Minimal: {
ConfigurationLockCollection tempLockList = new ConfigurationLockCollection(this, sourceLockList.LockType);
foreach (string lockedAttributeName in sourceLockList)
if (!parentLockList.Contains(lockedAttributeName)) {
tempLockList.Add(lockedAttributeName, ConfigurationValueFlags.Default);
}
return tempLockList;
}
}
}
else {
// exception list write out the entire collection unless the entire collection
// came from the parent.
if (saveMode == ConfigurationSaveMode.Modified || saveMode == ConfigurationSaveMode.Minimal) {
bool sameAsParent = false;
if (sourceLockList.Count == parentLockList.Count) {
sameAsParent = true;
foreach (string lockedAttributeName in sourceLockList) {
if (!parentLockList.Contains(lockedAttributeName) ||
(sourceLockList.IsValueModified(lockedAttributeName) &&
saveMode == ConfigurationSaveMode.Modified)) {
sameAsParent = false;
}
}
}
if (sameAsParent == true) {
return null;
}
}
}
return sourceLockList;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:47,代码来源:configurationelement.cs
示例20: Unmerge
protected override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
{
throw new NotImplementedException ();
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:SettingValueElement.cs
注:本文中的ConfigurationSaveMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论