HasStreamer() public method

public HasStreamer ( Type type ) : bool
type System.Type
return bool
示例#1
0
        public override void Write(BinaryWriter writer, object obj)
        {
            var list = (ParameterList)obj;
            var ps   = list.Parameters().Select(p => StreamerManager.HasStreamer(p.Value.GetType()));

            writer.Write(list.Name);
            writer.Write(ps.Count());
            writer.Write(list.Methods.Count);
            foreach (var p in ps)
            {
                StreamerManager.Serialize(writer, p);
            }
            foreach (string m in list.Methods)
            {
                writer.Write(m);
            }
        }
示例#2
0
        public override void Write(BinaryWriter writer, object obj)
        {
            var data = (AccountData)obj;

            writer.Write(data.DateTime.Ticks);
            writer.Write((int)data.Type);
            writer.Write(data.Account);
            writer.Write(data.ProviderId);
            writer.Write(data.Route);
            var list = new List <AccountDataField>();

            foreach (AccountDataField field in data.Fields)
            {
                var type = field.Value.GetType();
                if (StreamerManager.HasStreamer(type))
                {
                    list.Add(field);
                }
                else if (type == typeof(object[]))
                {
                    var array = (object[])field.Value;
                    for (int i = 0; i < array.Length; i++)
                    {
                        StreamerManager.HasStreamer(array[i].GetType());
                    }
                    list.Add(field);
                }
            }
            writer.Write(list.Count);
            foreach (var field in list)
            {
                writer.Write(field.Name);
                writer.Write(field.Currency);
                StreamerManager.Serialize(writer, field.Value);
            }
        }