dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Serialization


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Serialization/Formatters/Binary BinaryValueReader.cs, NONE, 1.1 BinaryFormatter.cs, 1.8, 1.9 BinaryValueWriter.cs, 1.3, 1.4
Date: Tue, 05 Aug 2003 18:44:29 -0400

Update of 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Serialization/Formatters/Binary
In directory 
subversions:/tmp/cvs-serv1231/runtime/System/Runtime/Serialization/Formatters/Binary

Modified Files:
        BinaryFormatter.cs BinaryValueWriter.cs 
Added Files:
        BinaryValueReader.cs 
Log Message:


Begin adding the infrastructure for binary serialization readers.


--- NEW FILE ---
/*
 * BinaryValueReader.cs - Implementation of the
 *      "System.Runtime.Serialization.Formatters.Binary.BinaryValueReader" 
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.Runtime.Serialization.Formatters.Binary
{

#if CONFIG_SERIALIZATION

using System.IO;
using System.Reflection;
using System.Collections;

internal abstract class BinaryValueReader
{
        // Builtin writers.
        private static BinaryValueReader booleanReader = new BooleanReader();
        private static BinaryValueReader byteReader = new ByteReader();
        private static BinaryValueReader sbyteReader = new SByteReader();
        private static BinaryValueReader charReader = new CharReader();
        private static BinaryValueReader int16Reader = new Int16Reader();
        private static BinaryValueReader uint16Reader = new UInt16Reader();
        private static BinaryValueReader int32Reader = new Int32Reader();
        private static BinaryValueReader uint32Reader = new UInt32Reader();
        private static BinaryValueReader int64Reader = new Int64Reader();
        private static BinaryValueReader uint64Reader = new UInt64Reader();
        private static BinaryValueReader singleReader = new SingleReader();
        private static BinaryValueReader doubleReader = new DoubleReader();
        private static BinaryValueReader decimalReader = new DecimalReader();
        private static BinaryValueReader dateTimeReader = new DateTimeReader();
        private static BinaryValueReader timeSpanReader = new TimeSpanReader();
        private static BinaryValueReader stringReader = new StringReader();
        private static BinaryValueReader objectReader = new ObjectReader();
        private static BinaryValueReader infoReader = new SurrogateReader(null);
#if false
        // TODO
        private static BinaryValueReader arrayOfObjectReader
                        = new 
ArrayReader(BinaryPrimitiveTypeCode.ArrayOfObject);
        private static BinaryValueReader arrayOfStringReader
                        = new 
ArrayReader(BinaryPrimitiveTypeCode.ArrayOfString);
#endif

        // Context information for reading binary values.
        public class BinaryValueContext
        {
                public BinaryFormatter formatter;
                public BinaryReader reader;
                public ObjectManager mgr;

                // Constructor.
                public BinaryValueContext(BinaryFormatter formatter,
                                                                  BinaryReader 
reader)
                                {
                                        this.formatter = formatter;
                                        this.reader = reader;
                                        this.mgr = new 
ObjectManager(formatter.SurrogateSelector,
                                                                                
                 formatter.Context);
                                }

        }; // class BinaryValueContext

        // Constructor.
        protected BinaryValueReader() {}

        // Read the inline form of values for a type.
        public abstract Object ReadInline(BinaryValueContext context,
                                                                          Type 
type, Type fieldType);

        // Read the object form of values for a type.
        public abstract Object ReadObject(BinaryValueContext context, Type 
type);

        // Normalize field names for cross-CLR differences.
        public virtual String NormalizeFieldName(String name)
                        {
                                return name;
                        }

        // Determine if a type is visible outside its defining assembly.
        private static bool IsVisibleOutside(Type type)
                        {
                                switch(type.Attributes & 
TypeAttributes.VisibilityMask)
                                {
                                        case TypeAttributes.Public:
                                                return true;

                                        case TypeAttributes.NestedPublic:
                                        case TypeAttributes.NestedFamily:
                                        case TypeAttributes.NestedFamORAssem:
                                                return 
IsVisibleOutside(type.DeclaringType);

                                        default:        return false;
                                }
                        }

        // Map a runtime type name to the actual type.  Returns null if
        // the type name does not correspond to a public serializable type.
        public static Type GetRuntimeType(String name)
                        {
                                // Validate the type name to make sure that it 
doesn't
                                // contain any characters that would be illegal 
in the
                                // name of a runtime type.
                                if(name == null || name == String.Empty)
                                {
                                        return null;
                                }
                                foreach(char ch in name)
                                {
                                        if(ch >= 'A' && ch <= 'Z')
                                        {
                                                continue;
                                        }
                                        if(ch >= 'a' && ch <= 'z')
                                        {
                                                continue;
                                        }
                                        if(ch >= '0' && ch <= '9')
                                        {
                                                continue;
                                        }
                                        if(ch == '_' || ch == '.' || ch == '+')
                                        {
                                                continue;
                                        }
                                        return null;
                                }

                                // Look up the type within the runtime library.
                                Type type = 
Assembly.GetExecutingAssembly().GetType(name);
                                if(type == null)
                                {
                                        return null;
                                }

                                // Make sure that the type is public and 
serializable.
                                if(!IsVisibleOutside(type))
                                {
                                        return null;
                                }
                                if(type.IsSerializable)
                                {
                                        return type;
                                }
                                if(typeof(ISerializable).IsAssignableFrom(type))
                                {
                                        return type;
                                }
                                return null;
                        }

        // Get the value reader for a particular type.
        public static BinaryValueReader GetReader
                                (BinaryValueContext context, Type type)
                        {
                                BinaryPrimitiveTypeCode code;

                                // Handle the primitive types first.
                                code = 
BinaryValueWriter.GetPrimitiveTypeCode(type);
                                switch(code)
                                {
                                        case BinaryPrimitiveTypeCode.Boolean:
                                                return booleanReader;
                                        case BinaryPrimitiveTypeCode.Byte:
                                                return byteReader;
                                        case BinaryPrimitiveTypeCode.Char:
                                                return charReader;
                                        case BinaryPrimitiveTypeCode.Decimal:
                                                return decimalReader;
                                        case BinaryPrimitiveTypeCode.Double:
                                                return doubleReader;
                                        case BinaryPrimitiveTypeCode.Int16:
                                                return int16Reader;
                                        case BinaryPrimitiveTypeCode.Int32:
                                                return int32Reader;
                                        case BinaryPrimitiveTypeCode.Int64:
                                                return int64Reader;
                                        case BinaryPrimitiveTypeCode.SByte:
                                                return sbyteReader;
                                        case BinaryPrimitiveTypeCode.Single:
                                                return singleReader;
                                        case BinaryPrimitiveTypeCode.TimeSpan:
                                                return timeSpanReader;
                                        case BinaryPrimitiveTypeCode.DateTime:
                                                return dateTimeReader;
                                        case BinaryPrimitiveTypeCode.UInt16:
                                                return uint16Reader;
                                        case BinaryPrimitiveTypeCode.UInt32:
                                                return uint32Reader;
                                        case BinaryPrimitiveTypeCode.UInt64:
                                                return uint64Reader;
                                        case BinaryPrimitiveTypeCode.String:
                                                return stringReader;
                                }

                                // Handle special types that we recognize.
                                if(type == typeof(Object))
                                {
                                        return objectReader;
                                }
#if false
// TODO
                                if(type == typeof(Object[]))
                                {
                                        return arrayOfObjectReader;
                                }
                                if(type == typeof(String[]))
                                {
                                        return arrayOfStringReader;
                                }
                                if(type.IsArray && type.GetArrayRank() == 1)
                                {
                                        code = 
GetPrimitiveTypeCode(type.GetElementType());
                                        if(code != (BinaryPrimitiveTypeCode)0)
                                        {
                                                return new ArrayReader
                                                        
(BinaryTypeTag.ArrayOfPrimitiveType, code);
                                        }
                                }
#endif

                                // Check for surrogates.
                                ISurrogateSelector selector;
                                ISerializationSurrogate surrogate;
                                selector = context.formatter.SurrogateSelector;
                                if(selector != null)
                                {
                                        surrogate = selector.GetSurrogate
                                                (type, 
context.formatter.Context, out selector);
                                        if(surrogate != null)
                                        {
                                                return new 
SurrogateReader(surrogate);
                                        }
                                }

                                // Check for types that implement ISerializable.
                                if(typeof(ISerializable).IsAssignableFrom(type))
                                {
                                        return infoReader;
                                }

                                // Bail out if the type is not marked with the
                                // "serializable" flag.
                                if(!type.IsSerializable)
                                {
                                        throw new SerializationException
                                                (String.Format
                                                        
(_("Serialize_CannotSerialize"), type));
                                }

                                // Everything else is handled as an object.
                                return objectReader;
                        }

        // Read object values.
        private class ObjectReader : BinaryValueReader
        {
                // Constructor.
                public ObjectReader() : base() {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return null;
                                #if false
                                        BinaryPrimitiveTypeCode code;
                                        BinaryValueReader vw;
                                        bool firstTime;
                                        long objectID;
                                        long typeID;

                                        if(value == null)
                                        {
                                                // Write a null value.
                                                context.writer.Write
                                                        
((byte)(BinaryElementType.NullValue));
                                                return;
                                        }
                                        else if(type.IsValueType)
                                        {
                                                if(fieldType.IsValueType)
                                                {
                                                        // Expand the value 
instance inline.
                                                        vw = GetReader(context, 
type);
                                                        typeID = 
context.gen.GetIDForType(type);
                                                        objectID = 
context.gen.GetId(value, out firstTime);
                                                        if(typeID == -1)
                                                        {
                                                                
context.gen.RegisterType(type, objectID);
                                                        }
                                                        
vw.WriteObjectHeader(context, value, type,
                                                                                
                 objectID, typeID);
                                                        vw.WriteObject(context, 
value, type);
                                                        return;
                                                }
                                                else if((code = 
GetPrimitiveTypeCode(type)) != 0)
                                                {
                                                        // This is a boxed 
primitive value.
                                                        context.writer.Write
                                                                
((byte)(BinaryElementType.
                                                                                
        BoxedPrimitiveTypeValue));
                                                        vw = GetReader(context, 
type);
                                                        
vw.WriteTypeSpec(context, type);
                                                        vw.WriteInline(context, 
value, type, type);
                                                        return;
                                                }
                                        }

                                        // Queue the object to be expanded 
later.
                                        objectID = context.gen.GetId(value, out 
firstTime);
                                        context.writer.Write
                                                
((byte)(BinaryElementType.ObjectReference));
                                        context.writer.Write((int)objectID);
                                        if(firstTime)
                                        {
                                                context.queue.Enqueue(value);
                                        }
                                #endif
                                }

                // Read the object form of values for a type.
                public override Object ReadObject(BinaryValueContext context,
                                                                              
Type type)
                                {
                                        return null;
                                #if false
                                        MemberInfo[] members =
                                                
FormatterServices.GetSerializableMembers
                                                        (type, 
context.formatter.Context);
                                        Object[] values =
                                                
FormatterServices.GetObjectData(value, members);
                                        int index;
                                        Type fieldType;
                                        Type valueType;
                                        for(index = 0; index < members.Length; 
++index)
                                        {
                                                if(members[index] is FieldInfo)
                                                {
                                                        fieldType = 
((FieldInfo)(members[index]))
                                                                                
        .FieldType;
                                                }
                                                else
                                                {
                                                        fieldType = 
((PropertyInfo)(members[index]))
                                                                                
        .PropertyType;
                                                }
                                                if(values[index] != null)
                                                {
                                                        valueType = 
values[index].GetType();
                                                }
                                                else
                                                {
                                                        valueType = fieldType;
                                                }
                                                GetReader(context, 
fieldType).WriteInline
                                                        (context, 
values[index], valueType, fieldType);
                                        }
                                #endif
                                }

        }; // class ObjectReader

        // Read value type values.
        private class ValueTypeReader : ObjectReader
        {
                // Constructor.
                public ValueTypeReader() : base() {}

        }; // class ValueTypeReader

        // Read object values using serialization surrogates.
        private class SurrogateReader : ObjectReader
        {
                // Internal state.
                private ISerializationSurrogate surrogate;

                // Constructor.
                public SurrogateReader(ISerializationSurrogate surrogate)
                                {
                                        this.surrogate = surrogate;
                                }

                // Read the object form of values for a type.
                public override Object ReadObject(BinaryValueContext context,
                                                                                
  Type type)
                                {
                                        return null;
                                #if false
                                        SerializationInfo info = GetObjectData
                                                (context, value, type);
                                        SerializationInfoEnumerator e = 
info.GetEnumerator();
                                        Type objectType;
                                        Type valueType;
                                        Object fieldValue;
                                        while(e.MoveNext())
                                        {
                                                objectType = e.ObjectType;
                                                fieldValue = e.Value;
                                                if(value == null)
                                                {
                                                        valueType = objectType;
                                                }
                                                else
                                                {
                                                        valueType = 
fieldValue.GetType();
                                                }
                                                GetReader(context, 
objectType).WriteInline
                                                        (context, fieldValue, 
valueType, objectType);
                                        }
                                #endif
                                }

        }; // class SurrogateReader

        // Write primitive values.
        private abstract class PrimitiveReader : BinaryValueReader
        {
                // Internal state.
                private BinaryPrimitiveTypeCode code;

                // Constructor.
                public PrimitiveReader(BinaryPrimitiveTypeCode code)
                                {
                                        this.code = code;
                                }

                // Read the object form of values for a type.
                public override Object ReadObject(BinaryValueContext context,
                                                                                
  Type type)
                                {
                                        // The object field is just the 
primitive value itself.
                                        return ReadInline(context, type, type);
                                }

                // Normalize field names for cross-CLR differences.
                public override String NormalizeFieldName(String name)
                                {
                                        return "value_";
                                }

        }; // class PrimitiveReader

        // Read boolean values.
        private class BooleanReader : PrimitiveReader
        {
                // Construtor.
                public BooleanReader() : base(BinaryPrimitiveTypeCode.Boolean) 
{}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadBoolean();
                                }

        }; // class BooleanReader

        // Read byte values.
        private class ByteReader : PrimitiveReader
        {
                // Construtor.
                public ByteReader() : base(BinaryPrimitiveTypeCode.Byte) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadByte();
                                }

        }; // class ByteReader

        // Read sbyte values.
        private class SByteReader : PrimitiveReader
        {
                // Construtor.
                public SByteReader() : base(BinaryPrimitiveTypeCode.SByte) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadSByte();
                                }

        }; // class SByteReader

        // Read char values.
        private class CharReader : PrimitiveReader
        {
                // Constructor.
                public CharReader() : base(BinaryPrimitiveTypeCode.Char) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return 
(char)(context.reader.ReadUInt16());
                                }

        }; // class CharReader

        // Read short values.
        private class Int16Reader : PrimitiveReader
        {
                // Constructor.
                public Int16Reader() : base(BinaryPrimitiveTypeCode.Int16) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return 
(char)(context.reader.ReadInt16());
                                }

        }; // class Int16Reader

        // Read ushort values.
        private class UInt16Reader : PrimitiveReader
        {
                // Constructor.
                public UInt16Reader() : base(BinaryPrimitiveTypeCode.UInt16) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadUInt16();
                                }

        }; // class UInt16Reader

        // Read int values.
        private class Int32Reader : PrimitiveReader
        {
                // Constructor.
                public Int32Reader() : base(BinaryPrimitiveTypeCode.Int32) {}

                // Write the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadInt32();
                                }

        }; // class Int32Reader

        // Read uint values.
        private class UInt32Reader : PrimitiveReader
        {
                // Constructor.
                public UInt32Reader() : base(BinaryPrimitiveTypeCode.UInt32) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadUInt32();
                                }

        }; // class UInt32Reader

        // Read long values.
        private class Int64Reader : PrimitiveReader
        {
                // Constructor.
                public Int64Reader() : base(BinaryPrimitiveTypeCode.Int64) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadInt64();
                                }

        }; // class Int64Reader

        // Read ulong values.
        private class UInt64Reader : PrimitiveReader
        {
                // Constructor.
                public UInt64Reader() : base(BinaryPrimitiveTypeCode.UInt64) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadUInt64();
                                }

        }; // class UInt64Reader

        // Read float values.
        private class SingleReader : PrimitiveReader
        {
                // Constructor.
                public SingleReader() : base(BinaryPrimitiveTypeCode.Single) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadSingle();
                                }

        }; // class SingleReader

        // Read double values.
        private class DoubleReader : PrimitiveReader
        {
                // Constructor.
                public DoubleReader() : base(BinaryPrimitiveTypeCode.Double) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadDouble();
                                }

        }; // class DoubleReader

        // Read Decimal values.
        private class DecimalReader : ValueTypeReader
        {
                // Constructor.
                public DecimalReader() {}

                // Normalize field names for cross-CLR differences.
                public override String NormalizeFieldName(String name)
                                {
                                        switch(name)
                                        {
                                                // Microsoft CLR.
                                                case "hi":              return 
"high";
                                                case "mid":             return 
"middle";
                                                case "lo":              return 
"low";

                                                // Mono CLR.
                                                case "ss32":    return "flags";
                                                case "hi32":    return "high";
                                                case "mid32":   return "middle";
                                                case "lo32":    return "low";
                                        }
                                        return name;
                                }

        }; // class DecimalReader

        // Read DateTime values.
        private class DateTimeReader : PrimitiveReader
        {
                // Constructor.
                public DateTimeReader() : 
base(BinaryPrimitiveTypeCode.DateTime) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return new 
DateTime(context.reader.ReadInt64());
                                }

        }; // class DateTimeReader

        // Read TimeSpan values.
        private class TimeSpanReader : PrimitiveReader
        {
                // Constructor.
                public TimeSpanReader() : 
base(BinaryPrimitiveTypeCode.TimeSpan) {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return new 
TimeSpan(context.reader.ReadInt64());
                                }

        }; // class TimeSpanReader

        // Read String values.
        private class StringReader : BinaryValueReader
        {
                // Constructor.
                public StringReader() : base() {}

                // Read the inline form of values for a type.
                public override Object ReadInline(BinaryValueContext context,
                                                                                
  Type type, Type fieldType)
                                {
                                        return context.reader.ReadString();
                                }

                // Write the object form of values for a type.
                public override Object ReadObject(BinaryValueContext context,
                                                                                
  Type type)
                                {
                                        return context.reader.ReadString();
                                }

        }; // class StringReader

}; // class BinaryValueReader

#endif // CONFIG_SERIALIZATION

}; // namespace System.Runtime.Serialization.Formatters.Binary

Index: BinaryFormatter.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Serialization/Formatters/Binary/BinaryFormatter.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** BinaryFormatter.cs  5 Aug 2003 01:23:33 -0000       1.8
--- BinaryFormatter.cs  5 Aug 2003 22:44:26 -0000       1.9
***************
*** 67,71 ****
                                                          HeaderHandler handler)
                        {
!                               // TODO
                                return null;
                        }
--- 67,81 ----
                                                          HeaderHandler handler)
                        {
!                               // Validate the parameters.
!                               if(serializationStream == null)
!                               {
!                                       throw new 
ArgumentNullException("serializationStream");
!                               }
! 
!                               // Wrap the stream in a binary reader.
!                               using(BinaryReader reader =
!                                               new 
BinaryReader(serializationStream))
!                               {
!                               }
                                return null;
                        }

Index: BinaryValueWriter.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Serialization/Formatters/Binary/BinaryValueWriter.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** BinaryValueWriter.cs        5 Aug 2003 01:23:33 -0000       1.3
--- BinaryValueWriter.cs        5 Aug 2003 22:44:26 -0000       1.4
***************
*** 134,138 ****
  
        // Get the primitive type code for a type.
!       private static BinaryPrimitiveTypeCode GetPrimitiveTypeCode(Type type)
                        {
                                if(type == typeof(bool))
--- 134,138 ----
  
        // Get the primitive type code for a type.
!       internal static BinaryPrimitiveTypeCode GetPrimitiveTypeCode(Type type)
                        {
                                if(type == typeof(bool))
***************
*** 774,778 ****
        private class BooleanWriter : PrimitiveWriter
        {
!               // Construtor.
                public BooleanWriter() : base(BinaryPrimitiveTypeCode.Boolean) 
{}
  
--- 774,778 ----
        private class BooleanWriter : PrimitiveWriter
        {
!               // Constructor.
                public BooleanWriter() : base(BinaryPrimitiveTypeCode.Boolean) 
{}
  
***************
*** 790,794 ****
        private class ByteWriter : PrimitiveWriter
        {
!               // Construtor.
                public ByteWriter() : base(BinaryPrimitiveTypeCode.Byte) {}
  
--- 790,794 ----
        private class ByteWriter : PrimitiveWriter
        {
!               // Constructor.
                public ByteWriter() : base(BinaryPrimitiveTypeCode.Byte) {}
  
***************
*** 806,810 ****
        private class SByteWriter : PrimitiveWriter
        {
!               // Construtor.
                public SByteWriter() : base(BinaryPrimitiveTypeCode.SByte) {}
  
--- 806,810 ----
        private class SByteWriter : PrimitiveWriter
        {
!               // Constructor.
                public SByteWriter() : base(BinaryPrimitiveTypeCode.SByte) {}
  
***************
*** 822,826 ****
        private class CharWriter : PrimitiveWriter
        {
!               // Construtor.
                public CharWriter() : base(BinaryPrimitiveTypeCode.Char) {}
  
--- 822,826 ----
        private class CharWriter : PrimitiveWriter
        {
!               // Constructor.
                public CharWriter() : base(BinaryPrimitiveTypeCode.Char) {}
  
***************
*** 830,834 ****
                                                                                
 Type fieldType)
                                {
!                                       context.writer.Write((char)value);
                                }
  
--- 830,834 ----
                                                                                
 Type fieldType)
                                {
!                                       
context.writer.Write((ushort)(char)value);
                                }
  
***************
*** 838,842 ****
        private class Int16Writer : PrimitiveWriter
        {
!               // Construtor.
                public Int16Writer() : base(BinaryPrimitiveTypeCode.Int16) {}
  
--- 838,842 ----
        private class Int16Writer : PrimitiveWriter
        {
!               // Constructor.
                public Int16Writer() : base(BinaryPrimitiveTypeCode.Int16) {}
  
***************
*** 854,858 ****
        private class UInt16Writer : PrimitiveWriter
        {
!               // Construtor.
                public UInt16Writer() : base(BinaryPrimitiveTypeCode.UInt16) {}
  
--- 854,858 ----
        private class UInt16Writer : PrimitiveWriter
        {
!               // Constructor.
                public UInt16Writer() : base(BinaryPrimitiveTypeCode.UInt16) {}
  
***************
*** 870,874 ****
        private class Int32Writer : PrimitiveWriter
        {
!               // Construtor.
                public Int32Writer() : base(BinaryPrimitiveTypeCode.Int32) {}
  
--- 870,874 ----
        private class Int32Writer : PrimitiveWriter
        {
!               // Constructor.
                public Int32Writer() : base(BinaryPrimitiveTypeCode.Int32) {}
  
***************
*** 886,890 ****
        private class UInt32Writer : PrimitiveWriter
        {
!               // Construtor.
                public UInt32Writer() : base(BinaryPrimitiveTypeCode.UInt32) {}
  
--- 886,890 ----
        private class UInt32Writer : PrimitiveWriter
        {
!               // Constructor.
                public UInt32Writer() : base(BinaryPrimitiveTypeCode.UInt32) {}
  
***************
*** 902,906 ****
        private class Int64Writer : PrimitiveWriter
        {
!               // Construtor.
                public Int64Writer() : base(BinaryPrimitiveTypeCode.Int64) {}
  
--- 902,906 ----
        private class Int64Writer : PrimitiveWriter
        {
!               // Constructor.
                public Int64Writer() : base(BinaryPrimitiveTypeCode.Int64) {}
  
***************
*** 918,922 ****
        private class UInt64Writer : PrimitiveWriter
        {
!               // Construtor.
                public UInt64Writer() : base(BinaryPrimitiveTypeCode.UInt64) {}
  
--- 918,922 ----
        private class UInt64Writer : PrimitiveWriter
        {
!               // Constructor.
                public UInt64Writer() : base(BinaryPrimitiveTypeCode.UInt64) {}
  
***************
*** 934,938 ****
        private class SingleWriter : PrimitiveWriter
        {
!               // Construtor.
                public SingleWriter() : base(BinaryPrimitiveTypeCode.Single) {}
  
--- 934,938 ----
        private class SingleWriter : PrimitiveWriter
        {
!               // Constructor.
                public SingleWriter() : base(BinaryPrimitiveTypeCode.Single) {}
  
***************
*** 950,954 ****
        private class DoubleWriter : PrimitiveWriter
        {
!               // Construtor.
                public DoubleWriter() : base(BinaryPrimitiveTypeCode.Double) {}
  
--- 950,954 ----
        private class DoubleWriter : PrimitiveWriter
        {
!               // Constructor.
                public DoubleWriter() : base(BinaryPrimitiveTypeCode.Double) {}
  
***************
*** 966,970 ****
        private class DecimalWriter : PrimitiveWriter
        {
!               // Construtor.
                public DecimalWriter() : base(BinaryPrimitiveTypeCode.Decimal) 
{}
  
--- 966,970 ----
        private class DecimalWriter : PrimitiveWriter
        {
!               // Constructor.
                public DecimalWriter() : base(BinaryPrimitiveTypeCode.Decimal) 
{}
  
***************
*** 1023,1027 ****
        private class DateTimeWriter : PrimitiveWriter
        {
!               // Construtor.
                public DateTimeWriter()
                        : base(BinaryPrimitiveTypeCode.DateTime, "ticks") {}
--- 1023,1027 ----
        private class DateTimeWriter : PrimitiveWriter
        {
!               // Constructor.
                public DateTimeWriter()
                        : base(BinaryPrimitiveTypeCode.DateTime, "ticks") {}
***************
*** 1040,1044 ****
        private class TimeSpanWriter : PrimitiveWriter
        {
!               // Construtor.
                public TimeSpanWriter()
                        : base(BinaryPrimitiveTypeCode.TimeSpan, "_ticks") {}
--- 1040,1044 ----
        private class TimeSpanWriter : PrimitiveWriter
        {
!               // Constructor.
                public TimeSpanWriter()
                        : base(BinaryPrimitiveTypeCode.TimeSpan, "_ticks") {}
***************
*** 1057,1061 ****
        private class StringWriter : BinaryValueWriter
        {
!               // Construtor.
                public StringWriter() : base() {}
  
--- 1057,1061 ----
        private class StringWriter : BinaryValueWriter
        {
!               // Constructor.
                public StringWriter() : base() {}
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]