Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
//
// System.Configuration.AppSettingsReader
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CONFIGURATION_DEP && !TARGET_JVM
extern alias PrebuiltSystem;
using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
#endif
using System.Reflection;
using System.Collections.Specialized;
namespace System.Configuration
{
public class AppSettingsReader
{
NameValueCollection appSettings;
public AppSettingsReader ()
{
appSettings = ConfigurationSettings.AppSettings;
}
public object GetValue (string key, Type type)
{
if (key == null)
throw new ArgumentNullException ("key");
if (type == null)
throw new ArgumentNullException ("type");
string value = appSettings [key];
if (value == null)
throw new InvalidOperationException ("'" + key + "' could not be found.");
if (type == typeof (string))
return value;
MethodInfo parse = type.GetMethod ("Parse", new Type [] {typeof (string)});
if (parse == null)
throw new InvalidOperationException ("Type " + type + " does not have a Parse method");
object result = null;
try {
result = parse.Invoke (null, new object [] {value});
} catch (Exception e) {
throw new InvalidOperationException ("Parse error.", e);
}
return result;
}
}
}

View File

@@ -0,0 +1,39 @@
//
// System.Web.UI.WebControls.ApplicationScopedSettingAttribute.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Configuration
{
[AttributeUsageAttribute(AttributeTargets.Property)]
public sealed class ApplicationScopedSettingAttribute : SettingAttribute
{
}
}

View File

@@ -0,0 +1,441 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (C) 2005, 2006 Novell, Inc (http://www.novell.com)
//
#if CONFIGURATION_DEP && !TARGET_JVM
extern alias PrebuiltSystem;
using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
#endif
#if CONFIGURATION_DEP
using System.IO;
using System.Xml.Serialization;
#endif
using System.ComponentModel;
using System.Reflection;
using System.Threading;
using System.Collections.Specialized;
namespace System.Configuration {
public abstract class ApplicationSettingsBase : SettingsBase, INotifyPropertyChanged
{
protected ApplicationSettingsBase ()
{
Initialize (Context, Properties, Providers);
}
protected ApplicationSettingsBase (IComponent owner)
: this (owner, String.Empty)
{
}
protected ApplicationSettingsBase (string settingsKey)
{
this.settingsKey = settingsKey;
Initialize (Context, Properties, Providers);
}
protected ApplicationSettingsBase (IComponent owner,
string settingsKey)
{
if (owner == null)
throw new ArgumentNullException ();
#if (CONFIGURATION_DEP)
providerService = (ISettingsProviderService)owner.Site.GetService(typeof (ISettingsProviderService));
#endif
this.settingsKey = settingsKey;
Initialize (Context, Properties, Providers);
}
public event PropertyChangedEventHandler PropertyChanged;
public event SettingChangingEventHandler SettingChanging;
public event SettingsLoadedEventHandler SettingsLoaded;
public event SettingsSavingEventHandler SettingsSaving;
public object GetPreviousVersion (string propertyName)
{
throw new NotImplementedException ();
}
public void Reload ()
{
#if (CONFIGURATION_DEP)
foreach (SettingsProvider provider in Providers) {
// IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider;
CacheValuesByProvider(provider);
}
#endif
}
public void Reset()
{
#if (CONFIGURATION_DEP)
Reload ();
foreach (SettingsPropertyValue pv in PropertyValues)
pv.PropertyValue = pv.Reset();
#endif
}
public override void Save()
{
#if (CONFIGURATION_DEP)
Context.CurrentSettings = this;
/* ew.. this needs to be more efficient */
foreach (SettingsProvider provider in Providers) {
SettingsPropertyValueCollection cache = new SettingsPropertyValueCollection ();
foreach (SettingsPropertyValue val in PropertyValues) {
if (val.Property.Provider == provider)
cache.Add (val);
}
if (cache.Count > 0)
provider.SetPropertyValues (Context, cache);
}
Context.CurrentSettings = null;
#endif
}
public virtual void Upgrade()
{
}
protected virtual void OnPropertyChanged (object sender,
PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
PropertyChanged (sender, e);
}
protected virtual void OnSettingChanging (object sender,
SettingChangingEventArgs e)
{
if (SettingChanging != null)
SettingChanging (sender, e);
}
protected virtual void OnSettingsLoaded (object sender,
SettingsLoadedEventArgs e)
{
if (SettingsLoaded != null)
SettingsLoaded (sender, e);
}
protected virtual void OnSettingsSaving (object sender,
CancelEventArgs e)
{
if (SettingsSaving != null)
SettingsSaving (sender, e);
}
[Browsable (false)]
public override SettingsContext Context {
get {
if (IsSynchronized)
Monitor.Enter (this);
try {
if (context == null) {
context = new SettingsContext ();
context ["SettingsKey"] = "";
Type type = GetType ();
context ["GroupName"] = type.FullName;
context ["SettingsClassType"] = type;
}
return context;
} finally {
if (IsSynchronized)
Monitor.Exit (this);
}
}
}
void CacheValuesByProvider (SettingsProvider provider)
{
SettingsPropertyCollection col = new SettingsPropertyCollection ();
foreach (SettingsProperty p in Properties) {
if (p.Provider == provider)
col.Add (p);
}
if (col.Count > 0) {
SettingsPropertyValueCollection vals = provider.GetPropertyValues (Context, col);
foreach (SettingsPropertyValue prop in vals) {
if (PropertyValues [prop.Name] != null)
PropertyValues [prop.Name].PropertyValue = prop.PropertyValue;
else
PropertyValues.Add (prop);
}
}
OnSettingsLoaded (this, new SettingsLoadedEventArgs (provider));
}
void InitializeSettings (SettingsPropertyCollection settings)
{
}
object GetPropertyValue (string propertyName)
{
SettingsProperty prop = Properties [ propertyName ];
if (prop == null)
throw new SettingsPropertyNotFoundException (propertyName);
if (propertyValues == null)
InitializeSettings (Properties);
if (PropertyValues [ propertyName ] == null)
CacheValuesByProvider (prop.Provider);
return PropertyValues [ propertyName ].PropertyValue;
}
[MonoTODO]
public override object this [ string propertyName ] {
get {
if (IsSynchronized) {
lock (this) {
return GetPropertyValue (propertyName);
}
}
return GetPropertyValue (propertyName);
}
set {
SettingsProperty prop = Properties [ propertyName ];
if (prop == null)
throw new SettingsPropertyNotFoundException (propertyName);
if (prop.IsReadOnly)
throw new SettingsPropertyIsReadOnlyException (propertyName);
/* XXX check the type of the property vs the type of @value */
if (value != null &&
!prop.PropertyType.IsAssignableFrom (value.GetType()))
throw new SettingsPropertyWrongTypeException (propertyName);
if (PropertyValues [ propertyName ] == null)
CacheValuesByProvider (prop.Provider);
SettingChangingEventArgs changing_args = new SettingChangingEventArgs (propertyName,
GetType().FullName,
settingsKey,
value,
false);
OnSettingChanging (this, changing_args);
if (changing_args.Cancel == false) {
/* actually set the value */
PropertyValues [ propertyName ].PropertyValue = value;
/* then emit PropertyChanged */
OnPropertyChanged (this, new PropertyChangedEventArgs (propertyName));
}
}
}
#if (CONFIGURATION_DEP)
[Browsable (false)]
public override SettingsPropertyCollection Properties {
get {
if (IsSynchronized)
Monitor.Enter (this);
try {
if (properties == null) {
SettingsProvider local_provider = null;
properties = new SettingsPropertyCollection ();
Type this_type = GetType();
SettingsProviderAttribute[] provider_attrs = (SettingsProviderAttribute[])this_type.GetCustomAttributes (typeof (SettingsProviderAttribute), false);;
if (provider_attrs != null && provider_attrs.Length != 0) {
Type provider_type = Type.GetType (provider_attrs[0].ProviderTypeName);
SettingsProvider provider = (SettingsProvider) Activator.CreateInstance (provider_type);
provider.Initialize (null, null);
if (provider != null && Providers [provider.Name] == null) {
Providers.Add (provider);
local_provider = provider;
}
}
PropertyInfo[] type_props = this_type.GetProperties ();
foreach (PropertyInfo prop in type_props) { // only public properties
SettingAttribute[] setting_attrs = (SettingAttribute[])prop.GetCustomAttributes (typeof (SettingAttribute), false);
if (setting_attrs == null || setting_attrs.Length == 0)
continue;
CreateSettingsProperty (prop, properties, ref local_provider);
}
}
return properties;
} finally {
if (IsSynchronized)
Monitor.Exit (this);
}
}
}
void CreateSettingsProperty (PropertyInfo prop, SettingsPropertyCollection properties, ref SettingsProvider local_provider)
{
SettingsAttributeDictionary dict = new SettingsAttributeDictionary ();
SettingsProvider provider = null;
object defaultValue = null;
SettingsSerializeAs serializeAs = SettingsSerializeAs.String;
bool explicitSerializeAs = false;
foreach (Attribute a in prop.GetCustomAttributes (false)) {
/* the attributes we handle natively here */
if (a is SettingsProviderAttribute) {
Type provider_type = Type.GetType (((SettingsProviderAttribute)a).ProviderTypeName);
provider = (SettingsProvider) Activator.CreateInstance (provider_type);
provider.Initialize (null, null);
}
else if (a is DefaultSettingValueAttribute) {
defaultValue = ((DefaultSettingValueAttribute)a).Value;
}
else if (a is SettingsSerializeAsAttribute) {
serializeAs = ((SettingsSerializeAsAttribute)a).SerializeAs;
explicitSerializeAs = true;
}
else if (a is ApplicationScopedSettingAttribute ||
a is UserScopedSettingAttribute) {
dict.Add (a.GetType(), a);
}
else {
dict.Add (a.GetType(), a);
}
}
if (!explicitSerializeAs) {
// DefaultValue is a string and if we can't convert from string to the
// property type then the only other option left is for the string to
// be XML.
//
TypeConverter converter = TypeDescriptor.GetConverter (prop.PropertyType);
if (converter != null &&
(!converter.CanConvertFrom (typeof (string)) ||
!converter.CanConvertTo (typeof (string))))
serializeAs = SettingsSerializeAs.Xml;
}
SettingsProperty setting =
new SettingsProperty (prop.Name, prop.PropertyType, provider, false /* XXX */,
defaultValue /* XXX always a string? */, serializeAs, dict,
false, false);
if (providerService != null)
setting.Provider = providerService.GetSettingsProvider (setting);
if (provider == null) {
if (local_provider == null) {
local_provider = new LocalFileSettingsProvider () as SettingsProvider;
local_provider.Initialize (null, null);
}
setting.Provider = local_provider;
// .NET ends up to set this to providers.
provider = local_provider;
}
if (provider != null) {
/* make sure we're using the same instance of a
given provider across multiple properties */
SettingsProvider p = Providers[provider.Name];
if (p != null)
setting.Provider = p;
}
properties.Add (setting);
if (setting.Provider != null && Providers [setting.Provider.Name] == null)
Providers.Add (setting.Provider);
}
#endif
[Browsable (false)]
public override SettingsPropertyValueCollection PropertyValues {
get {
if (IsSynchronized)
Monitor.Enter (this);
try {
if (propertyValues == null) {
propertyValues = new SettingsPropertyValueCollection ();
}
return propertyValues;
} finally {
if (IsSynchronized)
Monitor.Exit (this);
}
}
}
[Browsable (false)]
public override SettingsProviderCollection Providers {
get {
if (IsSynchronized)
Monitor.Enter (this);
try {
if (providers == null)
providers = new SettingsProviderCollection ();
return providers;
} finally {
if (IsSynchronized)
Monitor.Exit (this);
}
}
}
[Browsable (false)]
public string SettingsKey {
get {
return settingsKey;
}
set {
settingsKey = value;
}
}
string settingsKey;
SettingsContext context;
#if (CONFIGURATION_DEP)
SettingsPropertyCollection properties;
ISettingsProviderService providerService;
#endif
SettingsPropertyValueCollection propertyValues;
SettingsProviderCollection providers;
}
}

View File

@@ -0,0 +1,42 @@
//
// ApplicationSettingsGroup.cs
//
// Author:
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (C) 2006 Novell, Inc. (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Configuration
{
public sealed class ApplicationSettingsGroup : ConfigurationSectionGroup
{
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
//
// ClientSettingsSection.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// (C) 2006 Novell, Inc. (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Configuration
{
public sealed class ClientSettingsSection : ConfigurationSection
{
#region Fields
static ConfigurationPropertyCollection properties;
static ConfigurationProperty settings_prop;
#endregion // Fields
#region Constructors
static ClientSettingsSection ()
{
settings_prop = new ConfigurationProperty (
"",
typeof (SettingElementCollection),
null,
ConfigurationPropertyOptions.IsDefaultCollection);
properties = new ConfigurationPropertyCollection ();
properties.Add (settings_prop);
}
public ClientSettingsSection ()
{
}
#endregion // Constructors
#region Properties
[ConfigurationProperty ("", Options = ConfigurationPropertyOptions.IsDefaultCollection)]
public SettingElementCollection Settings {
get { return (SettingElementCollection) base [settings_prop]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
#endregion // Properties
}
}
#endif

View File

@@ -0,0 +1,245 @@
//
// System.Configuration.ConfigHelper
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Specialized;
#if (XML_DEP)
using System.Xml;
#endif
namespace System.Configuration
{
class ConfigHelper
{
class CollectionWrapper
{
IDictionary dict;
NameValueCollection collection;
bool isDict;
public CollectionWrapper (IDictionary dict)
{
this.dict = dict;
isDict = true;
}
public CollectionWrapper (NameValueCollection collection)
{
this.collection = collection;
isDict = false;
}
public void Remove (string s)
{
if (isDict)
dict.Remove (s);
else
collection.Remove (s);
}
public void Clear ()
{
if (isDict)
dict.Clear ();
else
collection.Clear ();
}
public string this [string key]
{
set {
if (isDict)
dict [key] = value;
else
collection [key] = value;
}
}
public object UnWrap ()
{
if (isDict)
return dict;
else
return collection;
}
}
#if (XML_DEP)
internal static IDictionary GetDictionary (IDictionary prev,
XmlNode region,
string nameAtt,
string valueAtt)
{
Hashtable hash;
if (prev == null)
hash = new Hashtable (CaseInsensitiveHashCodeProvider.Default,
CaseInsensitiveComparer.Default);
else {
Hashtable aux = (Hashtable) prev;
hash = (Hashtable) aux.Clone ();
}
CollectionWrapper result = new CollectionWrapper (hash);
result = GoGetThem (result, region, nameAtt, valueAtt);
if (result == null)
return null;
return result.UnWrap () as IDictionary;
}
internal static ConfigNameValueCollection GetNameValueCollection (NameValueCollection prev,
XmlNode region,
string nameAtt,
string valueAtt)
{
ConfigNameValueCollection coll =
new ConfigNameValueCollection (CaseInsensitiveHashCodeProvider.Default,
CaseInsensitiveComparer.Default);
if (prev != null)
coll.Add (prev);
CollectionWrapper result = new CollectionWrapper (coll);
result = GoGetThem (result, region, nameAtt, valueAtt);
if (result == null)
return null;
return result.UnWrap () as ConfigNameValueCollection;
}
private static CollectionWrapper GoGetThem (CollectionWrapper result,
XmlNode region,
string nameAtt,
string valueAtt)
{
if (region.Attributes != null && region.Attributes.Count != 0) {
if (region.Attributes.Count != 1 || region.Attributes[0].Name != "xmlns") {
throw new ConfigurationException ("Unknown attribute", region);
}
}
XmlNode keyNode;
XmlNode valueNode;
XmlNodeList childs = region.ChildNodes;
foreach (XmlNode node in childs) {
XmlNodeType ntype = node.NodeType;
if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
continue;
if (ntype != XmlNodeType.Element)
throw new ConfigurationException ("Only XmlElement allowed", node);
string nodeName = node.Name;
if (nodeName == "clear") {
if (node.Attributes != null && node.Attributes.Count != 0)
throw new ConfigurationException ("Unknown attribute", node);
result.Clear ();
} else if (nodeName == "remove") {
keyNode = null;
if (node.Attributes != null)
keyNode = node.Attributes.RemoveNamedItem (nameAtt);
if (keyNode == null)
throw new ConfigurationException ("Required attribute not found",
node);
if (keyNode.Value == String.Empty)
throw new ConfigurationException ("Required attribute is empty",
node);
if (node.Attributes.Count != 0)
throw new ConfigurationException ("Unknown attribute", node);
result.Remove (keyNode.Value);
} else if (nodeName == "add") {
keyNode = null;
if (node.Attributes != null)
keyNode = node.Attributes.RemoveNamedItem (nameAtt);
if (keyNode == null)
throw new ConfigurationException ("Required attribute not found",
node);
if (keyNode.Value == String.Empty)
throw new ConfigurationException ("Required attribute is empty",
node);
valueNode = node.Attributes.RemoveNamedItem (valueAtt);
if (valueNode == null)
throw new ConfigurationException ("Required attribute not found",
node);
if (node.Attributes.Count != 0)
throw new ConfigurationException ("Unknown attribute", node);
result [keyNode.Value] = valueNode.Value;
} else {
throw new ConfigurationException ("Unknown element", node);
}
}
return result;
}
#endif
}
internal class ConfigNameValueCollection: NameValueCollection
{
bool modified;
public ConfigNameValueCollection ()
{
}
public ConfigNameValueCollection (ConfigNameValueCollection col)
: base (col.Count, col)
{
}
public ConfigNameValueCollection (IHashCodeProvider hashProvider, IComparer comparer)
: base(hashProvider, comparer)
{
}
public void ResetModified ()
{
modified = false;
}
public bool IsModified {
get { return modified; }
}
public override void Set (string name, string value)
{
base.Set (name, value);
modified = true;
}
}
}

View File

@@ -0,0 +1,318 @@
//
// System.Configuration.ConfigXmlDocument
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CONFIGURATION_DEP
using System.Configuration.Internal;
#endif
using System.IO;
using System.Security;
using System.Security.Permissions;
#if (XML_DEP)
using System.Xml;
namespace System.Configuration
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
public sealed class ConfigXmlDocument : XmlDocument, IConfigXmlNode
#if CONFIGURATION_DEP
, IConfigErrorInfo
#endif
{
XmlTextReader reader;
string fileName;
int lineNumber;
public override XmlAttribute CreateAttribute (string prefix,
string localName,
string namespaceUri)
{
return new ConfigXmlAttribute (this, prefix, localName, namespaceUri);
}
public override XmlCDataSection CreateCDataSection (string data)
{
return new ConfigXmlCDataSection (this, data);
}
public override XmlComment CreateComment (string comment)
{
return new ConfigXmlComment (this, comment);
}
public override XmlElement CreateElement (string prefix, string localName, string namespaceUri)
{
return new ConfigXmlElement (this, prefix, localName, namespaceUri);
}
public override XmlSignificantWhitespace CreateSignificantWhitespace (string data)
{
return base.CreateSignificantWhitespace (data);
}
public override XmlText CreateTextNode (string text)
{
return new ConfigXmlText (this, text);
}
public override XmlWhitespace CreateWhitespace (string data)
{
return base.CreateWhitespace (data);
}
public override void Load (string filename)
{
XmlTextReader rd = new XmlTextReader (filename);
try {
rd.MoveToContent ();
LoadSingleElement (filename, rd);
} finally {
rd.Close ();
}
}
public void LoadSingleElement (string filename, XmlTextReader sourceReader)
{
fileName = filename;
lineNumber = sourceReader.LineNumber;
string xml = sourceReader.ReadOuterXml();
reader = new XmlTextReader (new StringReader (xml), sourceReader.NameTable);
Load (reader);
reader.Close ();
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
#if CONFIGURATION_DEP
string System.Configuration.Internal.IConfigErrorInfo.Filename {
get { return Filename; }
}
int System.Configuration.Internal.IConfigErrorInfo.LineNumber {
get { return LineNumber; }
}
#endif
string IConfigXmlNode.Filename {
get { return Filename; }
}
int IConfigXmlNode.LineNumber {
get { return LineNumber; }
}
//
// Wrappers for Xml* that just provide file name and line number addition
//
class ConfigXmlAttribute : XmlAttribute, IConfigXmlNode
#if CONFIGURATION_DEP
, IConfigErrorInfo
#endif
{
string fileName;
int lineNumber;
public ConfigXmlAttribute (ConfigXmlDocument document,
string prefix,
string localName,
string namespaceUri)
: base (prefix, localName, namespaceUri, document)
{
fileName = document.fileName;
lineNumber = document.LineNumber;
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
}
class ConfigXmlCDataSection : XmlCDataSection, IConfigXmlNode
#if CONFIGURATION_DEP
, IConfigErrorInfo
#endif
{
string fileName;
int lineNumber;
public ConfigXmlCDataSection (ConfigXmlDocument document, string data)
: base (data, document)
{
fileName = document.fileName;
lineNumber = document.LineNumber;
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
}
class ConfigXmlComment : XmlComment, IConfigXmlNode
{
string fileName;
int lineNumber;
public ConfigXmlComment (ConfigXmlDocument document, string comment)
: base (comment, document)
{
fileName = document.fileName;
lineNumber = document.LineNumber;
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
}
class ConfigXmlElement : XmlElement, IConfigXmlNode
#if CONFIGURATION_DEP
, IConfigErrorInfo
#endif
{
string fileName;
int lineNumber;
public ConfigXmlElement (ConfigXmlDocument document,
string prefix,
string localName,
string namespaceUri)
: base (prefix, localName, namespaceUri, document)
{
fileName = document.fileName;
lineNumber = document.LineNumber;
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
}
class ConfigXmlText : XmlText, IConfigXmlNode
#if CONFIGURATION_DEP
, IConfigErrorInfo
#endif
{
string fileName;
int lineNumber;
public ConfigXmlText (ConfigXmlDocument document, string data)
: base (data, document)
{
fileName = document.fileName;
lineNumber = document.LineNumber;
}
public string Filename
{
get {
if ((fileName != null) && (fileName.Length > 0) && SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, fileName).Demand ();
}
return fileName;
}
}
public int LineNumber
{
get {
return lineNumber;
}
}
}
}
}
#endif

View File

@@ -0,0 +1,171 @@
//
// System.Configuration.ConfigurationException.cs
//
// Author:
// Duncan Mak (duncan@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Globalization;
using System.Runtime.Serialization;
#if (XML_DEP)
using System.Xml;
#endif
namespace System.Configuration
{
[Serializable]
public class ConfigurationException : SystemException
{
// Fields
readonly string filename;
readonly int line;
//
// Constructors
//
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException () : this (null)
{
filename = null;
line = 0;
}
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message)
: base (message)
{
}
protected ConfigurationException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
filename = info.GetString ("filename");
line = info.GetInt32 ("line");
}
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message, Exception inner)
: base (message, inner)
{
}
#if (XML_DEP)
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message, XmlNode node)
: base (message)
{
filename = GetXmlNodeFilename(node);
line = GetXmlNodeLineNumber(node);
}
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message, Exception inner, XmlNode node)
: base (message, inner)
{
filename = GetXmlNodeFilename (node);
line = GetXmlNodeLineNumber (node);
}
#endif
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message, string filename, int line)
: base (message)
{
this.filename = filename;
this.line= line;
}
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public ConfigurationException (string message, Exception inner, string filename, int line)
: base (message, inner)
{
this.filename = filename;
this.line = line;
}
//
// Properties
//
public virtual string BareMessage {
get { return base.Message; }
}
public virtual string Filename {
get { return filename; }
}
public virtual int Line {
get { return line; }
}
public override string Message {
get {
string msg;
if (filename != null && filename.Length != 0) {
if (line != 0)
msg = BareMessage + " (" + filename + " line " + line + ")";
else
msg = BareMessage + " (" + filename + ")";
} else {
if (line != 0)
msg = BareMessage + " (line " + line + ")";
else
msg = BareMessage;
}
return msg;
}
}
//
// Methods
//
#if (XML_DEP)
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public static string GetXmlNodeFilename (XmlNode node)
{
if (!(node is IConfigXmlNode))
return String.Empty;
return ((IConfigXmlNode) node).Filename;
}
[Obsolete ("This class is obsolete. Use System.Configuration.ConfigurationErrorsException")]
public static int GetXmlNodeLineNumber (XmlNode node)
{
if (!(node is IConfigXmlNode))
return 0;
return ((IConfigXmlNode) node).LineNumber;
}
#endif
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
base.GetObjectData (info, context);
info.AddValue ("filename", filename);
info.AddValue ("line", line);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
//
// System.Web.UI.WebControls.DefaultValueSettingAttribute.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Configuration
{
[AttributeUsageAttribute(AttributeTargets.Property)]
public sealed class DefaultSettingValueAttribute : Attribute
{
string value;
public DefaultSettingValueAttribute (string value)
{
this.value = value;
}
public string Value {
get {
return value;
}
}
}
}

View File

@@ -0,0 +1,86 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// System.Configuration.DictionarySectionHandler.cs
//
// Author:
// Christopher Podurgiel (cpodurgiel@msn.com)
//
// (C) Chris Podurgiel
//
using System;
using System.Collections;
using System.Collections.Specialized;
#if (XML_DEP)
using System.Xml;
#else
using XmlNode = System.Object;
#endif
namespace System.Configuration
{
/// <summary>
/// Summary description for DictionarySectionHandler.
/// </summary>
public class DictionarySectionHandler : IConfigurationSectionHandler
{
/// <summary>
/// Creates a new DictionarySectionHandler object and adds the object to the collection.
/// </summary>
/// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
/// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
/// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
/// <returns></returns>
public virtual object Create(object parent, object context, XmlNode section)
{
#if (XML_DEP)
return ConfigHelper.GetDictionary (parent as IDictionary, section,
KeyAttributeName, ValueAttributeName);
#else
return null;
#endif
}
/// <summary>
/// Gets the name of the key attribute tag. This property is overidden by derived classes to change
/// the name of the key attribute tag. The default is "key".
/// </summary>
protected virtual string KeyAttributeName
{
get {
return "key";
}
}
/// <summary>
/// Gets the name of the value tag. This property may be overidden by derived classes to change
/// the name of the value tag. The default is "value".
/// </summary>
protected virtual string ValueAttributeName
{
get {
return "value";
}
}
}
}

View File

@@ -0,0 +1,46 @@
//
// System.Web.UI.WebControls.IApplicationSettingsProvider.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Configuration
{
public interface IApplicationSettingsProvider
{
SettingsPropertyValue GetPreviousVersion (SettingsContext context,
SettingsProperty property);
void Reset (SettingsContext context);
void Upgrade (SettingsContext context,
SettingsPropertyCollection properties);
}
}

View File

@@ -0,0 +1,39 @@
//
// System.Configuration.IConfigXmlNode
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Configuration
{
interface IConfigXmlNode
{
string Filename { get; }
int LineNumber { get; }
}
}

View File

@@ -0,0 +1,53 @@
//
// System.Configuration.IConfigurationSectionHandler.cs
//
// Author:
// Christopher Podurgiel (cpodurgiel@msn.com)
//
// (C) Chris Podurgiel
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
#if (XML_DEP)
using System.Xml;
#else
using XmlNode = System.Object;
#endif
namespace System.Configuration
{
/// <summary>
/// Summary description for IConfigurationSectionHandler.
/// </summary>
public interface IConfigurationSectionHandler
{
/// <summary>
/// Creates a new configuration handler and adds the specified configuration object to the collection.
/// </summary>
/// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
/// <param name="configContext">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
/// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
/// <returns></returns>
object Create(object parent, object configContext, XmlNode section);
}
}

View File

@@ -0,0 +1,42 @@
//
// System.Configuration.IConfigurationSystem
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Configuration
{
[ComVisible (false)]
public interface IConfigurationSystem
{
object GetConfig (string configKey);
void Init ();
}
}

View File

@@ -0,0 +1,42 @@
//
// System.Configuration.IPersistComponentSettings
//
// Authors:
// Chris Tosok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Configuration
{
public interface IPersistComponentSettings
{
bool SaveSettings { get; set; }
string SettingsKey { get; set; }
void LoadComponentSettings ();
void ResetComponentSettings ();
void SaveComponentSettings ();
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Web.UI.WebControls.ISettingsProviderService.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Configuration
{
public interface ISettingsProviderService {
SettingsProvider GetSettingsProvider (SettingsProperty property);
}
}

View File

@@ -0,0 +1,79 @@
//
// System.Configuration.IdnElement.cs
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// (c) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if CONFIGURATION_DEP
using System;
namespace System.Configuration
{
public sealed class IdnElement : ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty enabled_prop;
static IdnElement ()
{
enabled_prop = new ConfigurationProperty ("enabled", typeof (UriIdnScope), UriIdnScope.None, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
properties = new ConfigurationPropertyCollection ();
properties.Add (enabled_prop);
}
public IdnElement ()
{
}
[ConfigurationPropertyAttribute("enabled", DefaultValue = UriIdnScope.None,
Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
public UriIdnScope Enabled {
get { return (UriIdnScope) base [enabled_prop]; }
set { base [enabled_prop] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
public override bool Equals (object o)
{
IdnElement e = o as IdnElement;
if (e == null)
return false;
return e.Enabled == Enabled;
}
public override int GetHashCode ()
{
return (int) Enabled ^ 0x7F;
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More