示例#1
0
文件: Encoder.cs 项目: zentarul/krpc
        static void WriteList(object value, CodedOutputStream stream)
        {
            var encodedList = new KRPC.Schema.KRPC.List();
            var list        = (IList)value;

            using (var internalBuffer = new MemoryStream()) {
                var internalStream = new CodedOutputStream(internalBuffer);
                foreach (var item in list)
                {
                    encodedList.Items.Add(EncodeObject(item, internalBuffer, internalStream));
                }
            }
            encodedList.WriteTo(stream);
        }
示例#2
0
文件: Encoder.cs 项目: zentarul/krpc
        static void WriteList(object value, Type type, Stream stream)
        {
            var encodedList = new KRPC.Schema.KRPC.List();
            var list        = (IList)value;
            var valueType   = type.GetGenericArguments().Single();

            using (var internalBuffer = new MemoryStream()) {
                var internalStream = new CodedOutputStream(internalBuffer);
                foreach (var item in list)
                {
                    encodedList.Items.Add(EncodeObject(item, valueType, internalBuffer, internalStream));
                }
            }
            encodedList.WriteTo(stream);
        }
示例#3
0
文件: Encoder.cs 项目: paperclip/krpc
 static void WriteList (object value, Type type, Stream stream)
 {
     var encodedList = new KRPC.Schema.KRPC.List ();
     var list = (IList)value;
     var valueType = type.GetGenericArguments ().Single ();
     using (var internalBuffer = new MemoryStream ()) {
         var internalStream = new CodedOutputStream (internalBuffer);
         foreach (var item in list)
             encodedList.Items.Add (EncodeObject (item, valueType, internalBuffer, internalStream));
     }
     encodedList.WriteTo (stream);
 }
示例#4
0
文件: Encoder.cs 项目: paperclip/krpc
 static void WriteList (object value, CodedOutputStream stream)
 {
     var encodedList = new KRPC.Schema.KRPC.List ();
     var list = (IList)value;
     using (var internalBuffer = new MemoryStream ()) {
         var internalStream = new CodedOutputStream (internalBuffer);
         foreach (var item in list)
             encodedList.Items.Add (EncodeObject (item, internalBuffer, internalStream));
     }
     encodedList.WriteTo (stream);
 }