[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Resources Makefile, N
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Resources Makefile, NONE, 1.1 ResXFileRef.cs, NONE, 1.1 ResXResourceReader.cs, NONE, 1.1 ResXResourceSet.cs, NONE, 1.1 ResXResourceWriter.cs, NONE, 1.1 |
Date: |
Sat, 11 Oct 2003 05:56:01 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Resources
In directory subversions:/tmp/cvs-serv27076/System.Windows.Forms/Resources
Added Files:
Makefile ResXFileRef.cs ResXResourceReader.cs
ResXResourceSet.cs ResXResourceWriter.cs
Log Message:
Stub out the "ResX" classes and add "System.Xml" to the assembly
dependencies for Winforms.
--- NEW FILE: ResXFileRef.cs ---
/*
* ResXFileRef.cs - Implementation of the
* "System.Resources.ResXFileRef" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Resources
{
#if !ECMA_COMPAT
using System;
using System.Globalization;
using System.ComponentModel;
[Serializable]
#if CONFIG_COMPONENT_MODEL
[TypeConverter(typeof(ResXFileRef.Converter))]
#endif
public class ResXFileRef
{
// Internal state.
private String fileName;
private String typeName;
// Constructor.
public ResXFileRef(String fileName, String typeName)
{
this.fileName = fileName;
this.typeName = typeName;
}
// Convert this object into a string.
public override String ToString()
{
return fileName + ";" + typeName;
}
#if CONFIG_COMPONENT_MODEL
// Type converter for "ResXFileRef" instances.
public class Converter : TypeConverter
{
// Constructor.
public Converter() {}
// Determine if we can convert from a specific type to this one.
public override bool CanConvertFrom
(ITypeDescriptorContext context, Type
sourceType)
{
return (sourceType == typeof(String));
}
// Determine if we can convert from this type to a specific
type.
public override bool CanConvertTo
(ITypeDescriptorContext context, Type
destinationType)
{
return (destinationType ==
typeof(String));
}
// Convert from another type to the one represented by this
class.
[TODO]
public override Object ConvertFrom(ITypeDescriptorContext
context,
CultureInfo culture,
Object value)
{
// TODO
return null;
}
// Convert this object into another type.
public override Object ConvertTo(ITypeDescriptorContext context,
CultureInfo culture,
Object value, Type destinationType)
{
if(destinationType == typeof(String))
{
return
((ResXFileRef)value).ToString();
}
else
{
return base.ConvertTo(context,
culture, value,
destinationType);
}
}
}; // class Converter
#endif // CONFIG_COMPONENT_MODEL
}; // class ResXFileRef
#endif // !ECMA_COMPAT
}; // namespace System.Resources
--- NEW FILE: ResXResourceWriter.cs ---
/*
* ResXResourceWriter.cs - Implementation of the
* "System.Resources.ResXResourceWriter" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Resources
{
#if !ECMA_COMPAT
using System;
using System.IO;
public class ResXResourceWriter : IResourceWriter, IDisposable
{
// Internal state.
private Stream stream;
private String fileName;
private TextWriter writer;
// Version of the resource format.
public static readonly String Version = "1.3";
// Constructors.
public ResXResourceWriter(Stream stream)
{
this.stream = stream;
}
public ResXResourceWriter(String fileName)
{
this.fileName = fileName;
}
public ResXResourceWriter(TextWriter writer)
{
this.writer = writer;
}
// Destructor.
~ResXResourceWriter()
{
Dispose(false);
}
// Implement the IResourceWriter interface.
[TODO]
public void AddResource(String name, byte[] value)
{
// TODO
}
[TODO]
public void AddResource(String name, Object value)
{
// TODO
}
[TODO]
public void AddResource(String name, String value)
{
// TODO
}
public void Close()
{
Dispose();
}
[TODO]
public void Generate()
{
// TODO
}
// Dispose of this object.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
[TODO]
protected virtual void Dispose(bool disposing)
{
// TODO
}
}; // class ResXResourceWriter
#endif // !ECMA_COMPAT
}; // namespace System.Resources
--- NEW FILE: ResXResourceSet.cs ---
/*
* ResXResourceSet.cs - Implementation of the
* "System.Resources.ResXResourceSet" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Resources
{
#if !ECMA_COMPAT
using System;
using System.IO;
using System.Collections;
public class ResXResourceSet : ResourceSet
{
// Constructors.
public ResXResourceSet(Stream stream)
{
Reader = new ResXResourceReader(stream);
Table = new Hashtable();
ReadResources();
}
public ResXResourceSet(String fileName)
{
Reader = new ResXResourceReader(fileName);
Table = new Hashtable();
ReadResources();
}
// Get the preferred reader and writer classes for this kind of set.
public override Type GetDefaultReader()
{
return typeof(ResXResourceReader);
}
public override Type GetDefaultWriter()
{
return typeof(ResXResourceWriter);
}
}; // class ResXResourceSet
#endif // !ECMA_COMPAT
}; // namespace System.Resources
--- NEW FILE: Makefile ---
all:
(cd ..; make)
clean:
(cd ..; make clean)
--- NEW FILE: ResXResourceReader.cs ---
/*
* ResXResourceReader.cs - Implementation of the
* "System.Resources.ResXResourceReader" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Resources
{
#if !ECMA_COMPAT
using System;
using System.IO;
using System.Collections;
using System.ComponentModel.Design;
using System.Xml;
public class ResXResourceReader : IResourceReader, IEnumerable, IDisposable
{
// Internal state.
private Stream stream;
private TextReader reader;
private String fileName;
private Hashtable loadedData;
#if CONFIG_COMPONENT_MODEL_DESIGN
private ITypeResolutionService typeResolver;
#endif
// Constructors.
public ResXResourceReader(Stream stream)
{
this.stream = stream;
}
public ResXResourceReader(String fileName)
{
this.fileName = fileName;
}
public ResXResourceReader(TextReader reader)
{
this.reader = reader;
}
#if CONFIG_COMPONENT_MODEL_DESIGN
public ResXResourceReader(Stream stream,
ITypeResolutionService typeResolver)
: this(stream)
{
this.typeResolver = typeResolver;
}
public ResXResourceReader(String fileName,
ITypeResolutionService typeResolver)
: this(fileName)
{
this.typeResolver = typeResolver;
}
public ResXResourceReader(TextReader reader,
ITypeResolutionService typeResolver)
: this(reader)
{
this.typeResolver = typeResolver;
}
#endif
// Destructor.
~ResXResourceReader()
{
Dispose(false);
}
// Implement the IResourceReader interface.
public void Close()
{
((IDisposable)this).Dispose();
}
public IDictionaryEnumerator GetEnumerator()
{
if(loadedData == null)
{
loadedData = new Hashtable();
XmlTextReader xmlReader;
TextReader fileReader = null;
if(fileName != null)
{
fileReader = new
StreamReader(fileName);
xmlReader = new
XmlTextReader(fileReader);
}
else if(stream != null)
{
xmlReader = new
XmlTextReader(stream);
}
else
{
xmlReader = new
XmlTextReader(reader);
}
try
{
Load(xmlReader);
}
finally
{
xmlReader.Close();
if(fileReader != null)
{
fileReader.Close();
}
}
}
return loadedData.GetEnumerator();
}
// Implement the IDisposable interface.
void IDisposable.Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// Implement the IEnumerable interface.
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
// Dispose of this resource reader.
protected virtual void Dispose(bool disposing)
{
if(stream != null)
{
stream.Close();
stream = null;
}
if(reader != null)
{
reader.Close();
reader = null;
}
}
// Load resources from a file contents string.
public static ResXResourceReader FromFileContents(String fileContents)
{
return new ResXResourceReader
(new StringReader(fileContents));
}
#if CONFIG_COMPONENT_MODEL_DESIGN
public static ResXResourceReader FromFileContents
(String fileContents, ITypeResolutionService
typeResolver)
{
return new ResXResourceReader
(new StringReader(fileContents),
typeResolver);
}
#endif
// Load the contents of an XML resource stream.
[TODO]
private void Load(XmlTextReader reader)
{
// TODO
}
}; // class ResXResourceReader
#endif // !ECMA_COMPAT
}; // namespace System.Resources
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Resources Makefile, NONE, 1.1 ResXFileRef.cs, NONE, 1.1 ResXResourceReader.cs, NONE, 1.1 ResXResourceSet.cs, NONE, 1.1 ResXResourceWriter.cs, NONE, 1.1,
Rhys Weatherley <address@hidden> <=