Exemplo n.º 1
0
 public override void write(POxOPrimitiveEncoder encoder, Object value)
 {
     try
     {
         if (canBeNull)
         {
             if (value == null)
             {
                 encoder.WriteByte(0x00);
                 return;
             }
             else
             {
                 encoder.WriteByte(0x01);
             }
         }
         encoder.writeString((String)value);
     }
     catch (ObjectDisposedException e)
     {
         throw new POxOSerializerException("Error during String serializing.", e);
     }
     catch (NotSupportedException e)
     {
         throw new POxOSerializerException("Error during String serializing.", e);
     }
 }
Exemplo n.º 2
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);
     }
 }
Exemplo 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);
     }
 }