예제 #1
0
 protected void WriteInt32List(SubStream outstream, List <int> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (int val in data)
     {
         outstream.WriteInt32(val);
     }
 }
예제 #2
0
 protected void WriteList(SubStream outstream, IList data)
 {
     outstream.WriteInt32(data.Count);
     foreach (object val in data)
     {
         WriteValue(outstream, val);
     }
 }
예제 #3
0
 protected void WriteStringList(SubStream outstream, List <string> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (string val in data)
     {
         outstream.WriteString(val);
     }
 }
예제 #4
0
 protected void WriteSingleList(SubStream outstream, List <float> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (float val in data)
     {
         outstream.WriteSingle(val);
     }
 }
예제 #5
0
 protected void WriteValue(SubStream outstream, object data)
 {
     if (data == null)
     {
         outstream.WriteByte((byte)'.');
     }
     else if (data is string)
     {
         outstream.WriteByte((byte)'s');
         outstream.WriteString((string)data);
     }
     else if (data is float)
     {
         outstream.WriteByte((byte)'f');
         outstream.WriteSingle((float)data);
     }
     else if (data is int)
     {
         outstream.WriteByte((byte)'i');
         outstream.WriteInt32((int)data);
     }
     else if (data is byte[])
     {
         outstream.WriteByte((byte)'R');
         WriteRawBinary(outstream, (byte[])data);
     }
     else if (data is List <string> )
     {
         outstream.WriteByte((byte)'S');
         WriteStringList(outstream, (List <string>)data);
     }
     else if (data is List <float> )
     {
         outstream.WriteByte((byte)'F');
         WriteSingleList(outstream, (List <float>)data);
     }
     else if (data is List <int> )
     {
         outstream.WriteByte((byte)'I');
         WriteInt32List(outstream, (List <int>)data);
     }
     else if (data is IList)
     {
         outstream.WriteByte((byte)'M');
         WriteList(outstream, (IList)data);
     }
     else if (data is IDictionary)
     {
         outstream.WriteByte((byte)'T');
         WriteKeyValuePairs(outstream, (IDictionary)data);
     }
     else
     {
         throw new InvalidOperationException(String.Format("Unable to write value of type {0}", data.GetType().ToString()));
     }
 }
예제 #6
0
 protected void WriteValue(SubStream outstream, object data)
 {
     if (data == null)
     {
         outstream.WriteByte((byte)'.');
     }
     else if (data is string)
     {
         outstream.WriteByte((byte)'s');
         outstream.WriteString((string)data);
     }
     else if (data is float)
     {
         outstream.WriteByte((byte)'f');
         outstream.WriteSingle((float)data);
     }
     else if (data is int)
     {
         outstream.WriteByte((byte)'i');
         outstream.WriteInt32((int)data);
     }
     else if (data is byte[])
     {
         outstream.WriteByte((byte)'R');
         WriteRawBinary(outstream, (byte[])data);
     }
     else if (data is List<string>)
     {
         outstream.WriteByte((byte)'S');
         WriteStringList(outstream, (List<string>)data);
     }
     else if (data is List<float>)
     {
         outstream.WriteByte((byte)'F');
         WriteSingleList(outstream, (List<float>)data);
     }
     else if (data is List<int>)
     {
         outstream.WriteByte((byte)'I');
         WriteInt32List(outstream, (List<int>)data);
     }
     else if (data is IList)
     {
         outstream.WriteByte((byte)'M');
         WriteList(outstream, (IList)data);
     }
     else if (data is IDictionary)
     {
         outstream.WriteByte((byte)'T');
         WriteKeyValuePairs(outstream, (IDictionary)data);
     }
     else
     {
         throw new InvalidOperationException(String.Format("Unable to write value of type {0}", data.GetType().ToString()));
     }
 }
예제 #7
0
 protected void WriteStringList(SubStream outstream, List<string> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (string val in data)
     {
         outstream.WriteString(val);
     }
 }
예제 #8
0
 protected void WriteSingleList(SubStream outstream, List<float> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (float val in data)
     {
         outstream.WriteSingle(val);
     }
 }
예제 #9
0
 protected void WriteRawBinary(SubStream outstream, byte[] data)
 {
     outstream.WriteInt32(data.Length);
     outstream.WriteBytes(data.Length, data);
 }
예제 #10
0
 protected void WriteList(SubStream outstream, IList data)
 {
     outstream.WriteInt32(data.Count);
     foreach (object val in data)
     {
         WriteValue(outstream, val);
     }
 }
예제 #11
0
 protected void WriteInt32List(SubStream outstream, List<int> data)
 {
     outstream.WriteInt32(data.Count);
     foreach (int val in data)
     {
         outstream.WriteInt32(val);
     }
 }
예제 #12
0
 protected void WriteRawBinary(SubStream outstream, byte[] data)
 {
     outstream.WriteInt32(data.Length);
     outstream.WriteBytes(data.Length, data);
 }