Exemple #1
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteDouble(stream, this.Unknown1);
            StreamHelper.WriteDouble(stream, this.Unknown2);
            StreamHelper.WriteDouble(stream, this.Unknown3);
            StreamHelper.WriteFloat(stream, this.Unknown4);
            StreamHelper.WriteInt(stream, Unknown5.Count);

            int i = (int)this.Unknown1;
            int j = (int)this.Unknown2;
            int k = (int)this.Unknown3;
            sbyte j1;
            for (IEnumerator<ChunkPosition> iter = this.Unknown5.GetEnumerator(); iter.MoveNext(); stream.WriteByte(j1))
            {
                ChunkPosition chunkpos = iter.Current;
                int l = chunkpos.X - i;
                int i1 = chunkpos.Y - j;
                j1 = (sbyte)(chunkpos.Z - k);
                stream.WriteByte((byte)l);
                stream.WriteByte((byte)i1);
            }

            stream.Flush();
        }
 public static void Write(ArrayList list, NetworkStream stream)
 {
     list.ToArray().ToList().ForEach(x =>
     {
         WatchableObject obj = (WatchableObject)x;
         int joined = ((obj.Type << 5) | (obj.Lower & 0x1f)) & 0xff;
         stream.WriteByte((byte)joined);
         switch (obj.Type)
         {
             case 0:
                 stream.WriteByte((byte)obj.Value);
                 break;
             case 1:
                 StreamHelper.WriteShort(stream, (short)obj.Value);
                 break;
             case 2:
                 StreamHelper.WriteInt(stream, (int)obj.Value);
                 break;
             case 3:
                 StreamHelper.WriteFloat(stream, (float)obj.Value);
                 break;
             case 4:
                 StreamHelper.WriteString(stream, (string)obj.Value);
                 break;
             case 5:
                 ItemStack stack = (ItemStack)obj.Value;
                 StreamHelper.WriteShort(stream, (short)stack.ItemID);
                 stream.WriteByte((byte)stack.StackSize);
                 StreamHelper.WriteShort(stream, (short)stack.ItemDamage);
                 break;
         }
     });
     stream.WriteByte(127);
 }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowId);

            stream.Flush();
        }
Exemple #4
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
Exemple #5
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            stream.WriteByte(this.Unknown);

            stream.Flush();
        }
Exemple #6
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            stream.WriteByte((Mode ? (byte)1 : (byte)0));

            stream.Flush();
        }
Exemple #7
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteFloat(stream, this.Yaw);
            StreamHelper.WriteFloat(stream, this.Pitch);
            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowID);
            StreamHelper.WriteShort(stream, this.Bar);
            StreamHelper.WriteShort(stream, this.Progress);

            stream.Flush();
        }
Exemple #9
0
 public void Write(ref NetworkStream stream)
 {
     // write all
     stream.Write(BitConverter.GetBytes(this.Year), 0, 2);
     stream.WriteByte(this.Month);
     stream.WriteByte(this.Day);
     stream.WriteByte(this.Hour);
     stream.WriteByte(this.Minute);
     stream.WriteByte(this.Second);
 }
Exemple #10
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowID);
            StreamHelper.WriteShort(stream, this.Token);
            stream.WriteByte((byte)(this.Acknowledged ? 1 : 0));

            stream.Flush();
        }
Exemple #11
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EID);
            StreamHelper.WriteInt(stream, this.Target);
            stream.WriteByte(this.Button);

            stream.Flush();
        }
Exemple #12
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);
            StreamHelper.WriteInt(stream, this.Version); //version
            StreamHelper.WriteString(stream, this.Username); //username
            StreamHelper.WriteString(stream, this.ServerPassword); //server password
            StreamHelper.WriteLong(stream, this.MapSeed); //map seed
            stream.WriteByte(this.Dimension); //not used

            stream.Flush();
        }
Exemple #13
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowId);
            stream.WriteByte((byte)this.WindowType);
            StreamHelper.WriteString(stream, this.Title);
            stream.WriteByte(this.Slots);

            stream.Flush();
        }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            stream.WriteByte(this.VehicleType);
            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);

            stream.Flush();
        }
Exemple #15
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            stream.WriteByte((byte)this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte((byte)this.BlockType);
            stream.WriteByte((byte)this.Metadata);

            stream.Flush();
        }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteDouble(stream, this.X);
            StreamHelper.WriteDouble(stream, this.Y);
            StreamHelper.WriteDouble(stream, this.Stance);
            StreamHelper.WriteDouble(stream, this.Z);
            stream.WriteByte((OnGround ? (byte)1 : (byte)0));

            stream.Flush();
        }
Exemple #17
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte((byte)this.Status);
            StreamHelper.WriteInt(stream, this.X);
            stream.WriteByte((byte)this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte((byte)this.FaceType);

            stream.Flush();
        }
Exemple #18
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.a);
            stream.WriteByte((byte)this.b);
            StreamHelper.WriteInt(stream, this.c);
            stream.WriteByte((byte)this.d);
            StreamHelper.WriteInt(stream, this.e);

            stream.Flush();
        }
Exemple #19
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteShort(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte((byte)Instrument);
            stream.WriteByte(this.Pitch);

            stream.Flush();
        }
Exemple #20
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteShort(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte((byte)(XSize - 1));
            stream.WriteByte((byte)(YSize - 1));
            stream.WriteByte((byte)(ZSize - 1));
            StreamHelper.WriteInt(stream, Chunk.Length);
            stream.Write(Chunk, 0, Chunk.Length);

            stream.Flush();
        }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            StreamHelper.WriteString(stream, this.Name);
            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte(this.Rotation);
            stream.WriteByte(this.Pitch);
            StreamHelper.WriteShort(stream, this.CurrentItem);

            stream.Flush();
        }
Exemple #22
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            stream.WriteByte(this.MobType);
            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte(this.Yaw);
            stream.WriteByte(this.Pitch);
            DataWatcher.Write(this.Metadata, stream);

            stream.Flush();
        }
Exemple #23
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);
            StreamHelper.WriteString(stream, this.Username);

            stream.Flush();
        }
Exemple #24
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            StreamHelper.WriteShort(stream, this.ItemID);
            stream.WriteByte(this.Count);
            StreamHelper.WriteShort(stream, this.Secondary);
            StreamHelper.WriteInt(stream, this.X);
            StreamHelper.WriteInt(stream, this.Y);
            StreamHelper.WriteInt(stream, this.Z);
            stream.WriteByte(this.Rotation);
            stream.WriteByte(this.Pitch);
            stream.WriteByte(this.Roll);

            stream.Flush();
        }
Exemple #25
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteShort(stream, this.PlayerHealth);

            stream.Flush();
        }
Exemple #26
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.CollectedEntityID);
            StreamHelper.WriteInt(stream, this.CollectorEntityID);

            stream.Flush();
        }
        public void Write(ref NetworkStream stream)
        {
            // write Index
            stream.Write(BitConverter.GetBytes(this.Index), 0, 4);

            // write Name
            stream.WriteByte((byte)this.Name.Length);
            byte[] _name = Encoding.ASCII.GetBytes(this.Name);
            stream.Write(_name, 0, _name.Length);
        }
Exemple #28
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EntityID);
            StreamHelper.WriteShort(stream, this.dx);
            StreamHelper.WriteShort(stream, this.dy);
            StreamHelper.WriteShort(stream, this.dz);

            stream.Flush();
        }
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            StreamHelper.WriteInt(stream, this.EID);
            StreamHelper.WriteShort(stream, this.Slot);
            StreamHelper.WriteShort(stream, this.Primary);
            StreamHelper.WriteShort(stream, this.Secondary);

            stream.Flush();
        }
Exemple #30
0
        public void Write(NetworkStream stream)
        {
            stream.WriteByte((byte)this.Type);

            stream.WriteByte(this.WindowID);
            StreamHelper.WriteShort(stream, this.Slot);
            if (Items == null)
            {
                StreamHelper.WriteShort(stream, -1);
            }
            else
            {
                StreamHelper.WriteShort(stream, (short)this.Items.ItemID);
                stream.WriteByte((byte)this.Items.StackSize);
                StreamHelper.WriteShort(stream, (short)this.Items.ItemDamage);

            }

            stream.Flush();
        }
        public static string GetNetworkPath(System.Net.Sockets.NetworkStream nstm, string host)
        {
#if VARIABLE_NETWORK_PATHS
            nstm.WriteByte((byte)'d'); // Get current directory.

            if ((int)'+' != nstm.ReadByte())
            {
                throw new Exception("GetNetworkPath failure (service didn't report success)");
            }

            return(LocalPathToNetworkPath(XContent.ReceiveXString(nstm, null), host));
#else
            return(LocalPathToNetworkPath(_netpath, host));
#endif
        }