Ejemplo n.º 1
0
 public override void write(POxOPrimitiveEncoder encoder, Object value)
 {
     IList list;
     try
     {
         list = (IList)value;
         if (canBeNull)
         {
             if (list == null)
             {
                 encoder.WriteByte(0x00);
                 return;
             }
             else
             {
                 encoder.WriteByte(0x01);
             }
         }
         encoder.writeVarInt(list.Count, true);
         foreach (Object o in list)
         {
             nestedSerializer.write(encoder, o);
         }
     }
     catch (ObjectDisposedException e)
     {
         throw new POxOSerializerException("Error during List serializing.", e);
     }
     catch (NotSupportedException e)
     {
         throw new POxOSerializerException("Error during List serializing.", e);
     }
 }
Ejemplo n.º 2
0
 public override void write(POxOPrimitiveEncoder encoder, Object value)
 {
     try
     {
         if (canBeNull)
         {
             if (value == null)
             {
                 encoder.writeByte(0x00);
                 return;
             }
             else
             {
                 encoder.writeByte(0x01);
             }
         }
         encoder.writebool((bool)value);
     }
     catch (NotSupportedException e)
     {
         throw new POxOSerializerException("Error during Date serializing.", e);
     }
     catch (ObjectDisposedException e)
     {
         throw new POxOSerializerException("Error during Date serializing.", e);
     }
 }
Ejemplo n.º 3
0
 public override void write(POxOPrimitiveEncoder encoder, Object value)
 {
     IDictionary map;
     try
     {
         map = (IDictionary)value;
         if (canBeNull)
         {
             if (map == null)
             {
                 encoder.WriteByte(0x00);
                 return;
             }
             else
             {
                 encoder.WriteByte(0x01);
             }
         }
         encoder.writeVarInt(map.Count, true);
         foreach (Object key in map.Keys)
         {
             keyNestedSerializer.write(encoder, key);
             valueNestedSerializer.write(encoder, map[key]);
         }
     }
     catch (ObjectDisposedException e)
     {
         throw new POxOSerializerException("Error during List serializing.", e);
     }
     catch (NotSupportedException e)
     {
         throw new POxOSerializerException("Error during List serializing.", e);
     }
 }
Ejemplo n.º 4
0
    public override void write(POxOPrimitiveEncoder encoder, Object value)
    {
        try
        {
            if (canBeNull)
            {
                if (value == null)
                {
                    encoder.writeByte(0x00);
                    return;
                }
                else
                {
                    encoder.writeByte(0x01);
                }
            }

            long longValue = ((DateTime)value).ToFileTime();
            encoder.writeLong(longValue, true);
        }
        catch (ObjectDisposedException e)
        {
            throw new POxOSerializerException("Error during Date serializing.", e);
        }
        catch (NotSupportedException e)
        {
            throw new POxOSerializerException("Error during Date serializing.", e);
        }
    }
Ejemplo n.º 5
0
 public void write(POxOPrimitiveEncoder encoder, ObjectSerializer serializer, Object obj)
 {
     try
     {
         FieldSerializerUtil[] fieldsSerializerList = objectSerializer.getFieldsSerializers(type);
         for (int i = 0, n = fieldsSerializerList.Length; i < n; i++)
             fieldsSerializerList[i].Serializer.write(encoder,
                 fieldsSerializerList[i].Field.GetValue(obj));
     }
     catch (Exception e)
     {
         throw new POxOSerializerException("Error during fields serializing. ", e);
     }
 }
Ejemplo n.º 6
0
 public override void write(POxOPrimitiveEncoder encoder, Object obj)
 {
     try
     {
         encoder.writeVarInt(((int)Convert.ChangeType(obj, ((Enum)obj).GetTypeCode()) + 1), true);
     }
     catch (ObjectDisposedException e)
     {
         throw new POxOSerializerException("Error during Enum serializing.", e);
     }
     catch (NotSupportedException e)
     {
         throw new POxOSerializerException("Error during Enum serializing.", e);
     }
 }
 public abstract void write(POxOPrimitiveEncoder encoder, Object value);