You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="AppSettings.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace System.Xml.Serialization {
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Security.Permissions;
|
||||
|
||||
internal static class AppSettings {
|
||||
private const string UseLegacySerializerGenerationAppSettingsString = "System:Xml:Serialization:UseLegacySerializerGeneration";
|
||||
private static bool? useLegacySerializerGeneration;
|
||||
private static volatile bool settingsInitalized = false;
|
||||
private static object appSettingsLock = new object();
|
||||
|
||||
internal static bool? UseLegacySerializerGeneration {
|
||||
get {
|
||||
EnsureSettingsLoaded();
|
||||
return useLegacySerializerGeneration;
|
||||
}
|
||||
}
|
||||
|
||||
static void EnsureSettingsLoaded() {
|
||||
#if CONFIGURATION_DEP
|
||||
if (!settingsInitalized) {
|
||||
lock (appSettingsLock) {
|
||||
if (!settingsInitalized) {
|
||||
NameValueCollection appSettingsSection = null;
|
||||
try {
|
||||
appSettingsSection = ConfigurationManager.AppSettings;
|
||||
}
|
||||
catch (ConfigurationErrorsException) {
|
||||
}
|
||||
finally {
|
||||
bool tempUseLegacySerializerGeneration;
|
||||
if ((appSettingsSection == null) || !bool.TryParse(appSettingsSection[UseLegacySerializerGenerationAppSettingsString], out tempUseLegacySerializerGeneration)) {
|
||||
useLegacySerializerGeneration = null;
|
||||
}
|
||||
else {
|
||||
useLegacySerializerGeneration = (bool?)tempUseLegacySerializerGeneration;
|
||||
}
|
||||
|
||||
settingsInitalized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user