* *.cs: convert to Miguel's brace style.
svn path=/trunk/mcs/; revision=2032
-2002-1-17 Duncan Mak <duncan@192.168.10-120.masq>
+2002-1-17 Duncan Mak <duncan@duncan@ximian.com>
* ResourceSet.cs: Implemented GetObject (string, bool) and GetString
(string, bool). ResourceSet has no more MonoTODOs! Also added in the
Serializable attribute.
+
+ * *.cs: convert to Miguel's brace style.
2002-01-17 Duncan Mak <duncan@ximian.com>
using System;
using System.Collections;
-namespace System.Resources {
+namespace System.Resources
+{
- public interface IResourceReader : IEnumerable, IDisposable {
+ public interface IResourceReader : IEnumerable, IDisposable
+ {
void Close();
new IDictionaryEnumerator GetEnumerator();
}
using System;
-namespace System.Resources {
+namespace System.Resources
+{
- public interface IResourceWriter : IDisposable {
+ public interface IResourceWriter : IDisposable
+ {
void AddResource (string name, byte[] value);
void AddResource (string name, object value);
void AddResource (string name, string value);
using System.Globalization;
using System.Runtime.Serialization;
-namespace System.Resources {
+namespace System.Resources
+{
- public class MissingManifestResourceException: Exception {
+ public class MissingManifestResourceException: Exception
+ {
private string param;
// Constructors
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
-namespace System.Resources {
+namespace System.Resources
+{
[AttributeUsage (AttributeTargets.Assembly)]
- public sealed class NeutralResourcesLanguageAttribute : Attribute {
+ public sealed class NeutralResourcesLanguageAttribute : Attribute
+ {
string culture;
// Constructors
- public NeutralResourcesLanguageAttribute (string cultureName) {
+ public NeutralResourcesLanguageAttribute (string cultureName)
+ {
culture = cultureName;
}
- public string CultureName {
+ public string CultureName
+ {
get { return culture; }
}
}
using System.Reflection;
using System.Globalization;
-namespace System.Resources {
-
- [Serializable]
- public class ResourceManager {
+namespace System.Resources
+{
+ [Serializable]
+ public class ResourceManager
+ {
public static readonly int HeaderVersionNumber;
// public static readonly int MagicNumber = 0xBEEFCACE;
// constructors
public ResourceManager () {}
- public ResourceManager (Type resourceSource) {
+ public ResourceManager (Type resourceSource)
+ {
if (resourceSource == null)
throw new ArgumentNullException ("resourceSource is null.");
resourceSetType = resourceSource;
}
- public ResourceManager (string baseName, Assembly assembly) {
+ public ResourceManager (string baseName, Assembly assembly)
+ {
if (baseName == null || assembly == null)
throw new ArgumentNullException ("The arguments are null.");
resourceSetType = typeof (ResourceSet);
}
- public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet) {
+ public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet)
+ {
if (baseName == null || assembly == null)
throw new ArgumentNullException ("The arguments are null.");
[MonoTODO]
public static ResourceManager CreateFileBasedResourceManager (string baseName,
string resourceDir,
- Type usingResourceSet) {
+ Type usingResourceSet)
+ {
return null;
}
- public virtual string BaseName { get { return BaseNameField; }}
+ public virtual string BaseName
+ {
+ get { return BaseNameField; }
+ }
- public virtual bool IgnoreCase {
+ public virtual bool IgnoreCase
+ {
get { return ignoreCase; }
set { ignoreCase = value; }
}
- public virtual Type ResourceSetType {
+ public virtual Type ResourceSetType
+ {
get { return resourceSetType; }
}
[MonoTODO]
public virtual ResourceSet GetResourceSet (CultureInfo culture,
bool createIfNotExists,
- bool tryParents) {
+ bool tryParents)
+ {
if (culture == null)
throw new ArgumentNullException ("CultureInfo is a null reference.");
return null;
}
[MonoTODO]
- public virtual string GetString (string name) {
+ public virtual string GetString (string name)
+ {
if (name == null)
throw new ArgumentNullException ("Name is null.");
if (ResourceSets.Contains (name)) {
}
[MonoTODO]
- public virtual string GetString (string name, CultureInfo culture) {
+ public virtual string GetString (string name, CultureInfo culture)
+ {
if (name == null)
throw new ArgumentNullException ("Name is null.");
return null;
}
- protected virtual string GetResourceFileName (CultureInfo culture) {
+ protected virtual string GetResourceFileName (CultureInfo culture)
+ {
return culture.Name + ".resources";
}
[MonoTODO]
protected virtual ResourceSet InternalGetResourceSet (CultureInfo culture,
bool Createifnotexists,
- bool tryParents) {
+ bool tryParents)
+ {
return null;
}
- public virtual void ReleaseAllResources () {
+ public virtual void ReleaseAllResources ()
+ {
foreach (ResourceSet r in ResourceSets)
r.Close();
}
- protected static CultureInfo GetNeutralResourcesLanguage (Assembly a) {
+ protected static CultureInfo GetNeutralResourcesLanguage (Assembly a)
+ {
foreach (Attribute attribute in a.GetCustomAttributes (false)) {
if (attribute is NeutralResourcesLanguageAttribute)
return new CultureInfo ((attribute as NeutralResourcesLanguageAttribute).CultureName);
return null;
}
- protected static Version GetSatelliteContractVersion (Assembly a) {
+ protected static Version GetSatelliteContractVersion (Assembly a)
+ {
foreach (Attribute attribute in a.GetCustomAttributes (false)) {
if (attribute is SatelliteContractVersionAttribute)
return new Version ((attribute as SatelliteContractVersionAttribute).Version);
using System.Collections;
using System.IO;
-namespace System.Resources {
- public sealed class ResoureReader : IResourceReader, IDisposable {
+namespace System.Resources
+{
+ public sealed class ResoureReader : IResourceReader, IDisposable
+ {
Stream stream;
// Constructors
}
- internal class DictionaryEnumerator : IDictionaryEnumerator {
+ internal class DictionaryEnumerator : IDictionaryEnumerator
+ {
protected DictionaryEntry entry;
protected object key;
protected object value;
- public DictionaryEntry Entry {
+ public DictionaryEntry Entry
+ {
get { return entry; }
}
- public object Key {
+ public object Key
+ {
get { return key; }
}
- public object Value {
+ public object Value
+ {
get { return value; }
}
[MonoTODO]
- public object Current {
+ public object Current
+ {
get { return null; }
}
[MonoTODO]
- public bool MoveNext () {
+ public bool MoveNext ()
+ {
return false;
}
using System.Collections;
using System.IO;
-namespace System.Resources {
+namespace System.Resources
+{
[Serializable]
- public class ResourceSet : IDisposable {
+ public class ResourceSet : IDisposable
+ {
protected IResourceReader Reader;
- protected ResourceHashtable Table;
+ protected Hashtable Table;
// Constructors
protected ResourceSet () {}
- protected ResourceSet (IResourceReader reader) {
+ protected ResourceSet (IResourceReader reader)
+ {
if (reader == null)
throw new ArgumentNullException ("The reader is null.");
Reader = reader;
}
- protected ResourceSet (Stream stream) {
+ protected ResourceSet (Stream stream)
+ {
Reader = new ResourceReader (stream);
}
- protected ResourceSet (String fileName) {
+ protected ResourceSet (String fileName)
+ {
Reader = new ResourceReader (fileName);
}
- public virtual void Close () {
+ public virtual void Close ()
+ {
Dispose (true);
}
- public void Dispose() {
+ public void Dispose()
+ {
Dispose (true);
}
- public void Dispose (bool disposing) {
+ public void Dispose (bool disposing)
+ {
if (disposing) {
Reader = null;
Table = null;
}
}
- public virtual Type GetDefaultReader () {
+ public virtual Type GetDefaultReader ()
+ {
return (typeof (ResourceReader));
}
- public virtual Type GetDefaultWriter () {
+ public virtual Type GetDefaultWriter ()
+ {
return (typeof (ResourceWriter));
}
- public virtual object GetObject (string name) {
+ public virtual object GetObject (string name)
+ {
if (name == null)
throw new ArgumentNullException ("The name parameter is null.");
if (Reader == null)
}
if (Table != null)
return Table[name];
- return null;
}
- public virtual object GetObject (string name, bool ignoreCase) {
+ public virtual object GetObject (string name, bool ignoreCase)
+ {
if (name == null)
throw new ArgumentNullException ("The name parameter is null.");
if (Reader == null)
throw new InvalidOperationException ("ResourceSet has been closed.");
if (Table == null)
ReadResources ();
-
- if (Table != null && ignoreCase == false)
- return Table[name];
-
if (ignoreCase) {
- IComparer c = new CaseInsensitiveComparer ();
- Table.comparer (c);
- return Table[name];
- }
-
- else { // Comparer is the default, case sensitive
- IComparer c = new Comparer ();
- Table.comparer (c);
- return Table[name];
- }
+ foreach (DictionaryEntry de in Table) {
+ string key = (string) de.Key;
+
+ if (String.Compare (key, name, true))
+ return de.Value;
+ }
+ } else
+ return Table[name]
}
- public virtual string GetString (string name) {
+ public virtual string GetString (string name)
+ {
Object o = GetObject (name);
if (o is string)
return (string) o;
return null;
}
- public virtual string GetString (string name, bool ignoreCase) {
+ public virtual string GetString (string name, bool ignoreCase)
+ {
Object o = GetObject (name, ignoreCase);
if (o is string)
return (string) o;
return null;
}
- public virtual void ReadResources () {
+ public virtual void ReadResources ()
+ {
IDictionaryEnumerator i = Reader.GetEnumerator();
if (Table == null)
Table.Add (i.Key, i.Value);
}
}
- public class ResourceHashtable : Hashtable {}
}
using System.IO;
-namespace System.Resources {
- public sealed class ResourceWriter : IResourceWriter {
-
+namespace System.Resources
+{
+ public sealed class ResourceWriter : IResourceWriter
+ {
[MonoTODO]
- public ResourceWriter (Stream stream) {
+ public ResourceWriter (Stream stream)
+ {
if (stream == null)
throw new ArgumentNullException ("stream is null");
if (stream.CanWrite == false)
}
[MonoTODO]
- public ResourceWriter (String fileName) {
+ public ResourceWriter (String fileName)
+ {
if (fileName == null)
throw new ArgumentNullException ("fileName is null.");
}
[MonoTODO]
- public void AddResource (string name, byte[] value) {
+ public void AddResource (string name, byte[] value)
+ {
if (name == null || value == null)
throw new ArgumentNullException ("Parameter is a null reference.");
}
[MonoTODO]
- public void AddResource (string name, object value) {
+ public void AddResource (string name, object value)
+ {
if (name == null || value == null)
throw new ArgumentNullException ("Parameter is a null reference.");
}
[MonoTODO]
- public void AddResource (string name, string value) {
+ public void AddResource (string name, string value)
+ {
if (name == null || value == null)
throw new ArgumentNullException ("Parameter is a null reference.");
}
public void Close () {}
- public void Dispose () {
+ public void Dispose ()
+ {
Close();
}
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
-namespace System.Resources {
-
+namespace System.Resources
+{
[AttributeUsage (AttributeTargets.Assembly)]
- public sealed class SatelliteContractVersionAttribute : Attribute {
-
+ public sealed class SatelliteContractVersionAttribute : Attribute
+ {
private Version ver;
// Constructor
- public SatelliteContractVersionAttribute (string version) {
+ public SatelliteContractVersionAttribute (string version)
+ {
ver = new Version(version);
}
- public string Version {
+ public string Version
+ {
get { return ver.ToString(); }
}
}