Esempio n. 1
0
        public static NetRoot <T> Connect(BinaryReader reader)
        {
            NetRoot <T> netRoot = new NetRoot <T>();

            netRoot.ReadConnectionPacket(reader);
            return(netRoot);
        }
Esempio n. 2
0
        public void Add(TKey key, TValue value)
        {
            NetRoot <TValue> root = new NetRoot <TValue>(value);

            root.Serializer = Serializer;
            Roots.Add(key, root);
        }
Esempio n. 3
0
        public void CloneInto(NetRef <T> netref)
        {
            NetRoot <T> netRoot = Clone();
            T           copy    = netRoot.Value;

            netRoot.Value = null;
            netref.Value  = copy;
        }
Esempio n. 4
0
 public virtual NetRoot <T> Clone()
 {
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter writer = new BinaryWriter(stream))
         {
             using (BinaryReader reader = new BinaryReader(stream))
             {
                 WriteFull(writer);
                 stream.Seek(0L, SeekOrigin.Begin);
                 NetRoot <T> netRoot = new NetRoot <T>();
                 netRoot.Serializer = Serializer;
                 netRoot.ReadFull(reader, Clock.netVersion);
                 netRoot.reassigned.Set(default(NetVersion));
                 netRoot.MarkClean();
                 return(netRoot);
             }
         }
     }
 }