ReadByte() public method

Reads a single byte from the stream.
public ReadByte ( ) : byte
return byte
Example #1
0
 protected override void Parse(EndianBinaryReader r)
 {
     Locale = ReadString8(r);
     ViewDistance = r.ReadByte();
     ChatFlags = r.ReadByte();
     ChatColors = r.ReadBoolean();
     DisplayedSkinParts = r.ReadByte();
 }
Example #2
0
        protected override void Parse(EndianBinaryReader r)
        {
            Position = CoordInt.Read(r);
            TypeState = r.ReadByte();
            PitchDirection = r.ReadByte();
            BlockType = (BlockID)ReadVarInt(r);

            #if DEBUGPACKET
            if (BlockType.ToString() == ((int)BlockType).ToString())
                throw new NotImplementedException(BlockType.ToString());
            #endif
        }
Example #3
0
        protected override void Parse(EndianBinaryReader r)
        {
            Status = (StatusEnum)r.ReadByte();
            Position = CoordInt.Read(r);
            Face = (Face)r.ReadByte();

            #if DEBUGPACKET
            if (Status.ToString() == ((int)Status).ToString())
                throw new NotImplementedException(Status.ToString());
            if (Face.ToString() == ((int)Face).ToString())
                throw new NotImplementedException(Face.ToString());
            #endif
        }
Example #4
0
 protected override void Parse(EndianBinaryReader r)
 {
     Dimension = (Dimensions)r.ReadInt32();
     Difficulty = r.ReadByte();
     Mode = (GameMode)r.ReadByte();
     #if DEBUGPACKET
     if (Dimension.ToString() == ((int)Dimension).ToString())
         throw new NotImplementedException(Dimension.ToString());
     if (Mode.ToString() == ((int)Mode).ToString())
         throw new NotImplementedException(Mode.ToString());
     #endif
     LevelType = ReadString8(r);
 }
Example #5
0
 protected override void Parse(EndianBinaryReader r)
 {
     EntityID = r.ReadInt32();
     GameMode = (GameMode)r.ReadByte();
     Dimension = (Dimensions)r.ReadSByte();
     Difficulty = r.ReadByte();
     MaxPlayers = r.ReadByte();
     LevelType = ReadString8(r);
     ReducedDebug = r.ReadBoolean();
     #if DEBUGPACKET
     if (Dimension.ToString() == ((int)Dimension).ToString())
         throw new NotImplementedException(Dimension.ToString());
     if (GameMode.ToString() == ((int)GameMode).ToString())
         throw new NotImplementedException(GameMode.ToString());
     #endif
 }
Example #6
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Title = ReadString8(r);
     Position = CoordInt.Read(r);
     FaceDirection = (Face)r.ReadByte();
 }
Example #7
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     InventoryType = ReadString8(r);
     WindowTitle = ReadString8(r);
     NumberOfSlots = r.ReadByte();
     if (InventoryType == "EntityHorse")
         Unknown = r.ReadInt32();
     #if DEBUGPACKET
     Console.WriteLine("Horse Window Unknown: " + Unknown);
     if (InventoryTypes.Contains(InventoryType) == false)
     {
         Console.WriteLine("Unknown InventoryType: " + InventoryType);
         throw new NotImplementedException(InventoryType);
     }
     #endif
 }
Example #8
0
        protected override void Parse(EndianBinaryReader r)
        {
			Position = new CoordDouble ();
			Position.X = r.ReadDouble ();
			Position.Y = r.ReadDouble ();
			Position.Z = r.ReadDouble ();
			OnGround = r.ReadByte ();
		}
Example #9
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Type = (MobType)r.ReadByte();
     Pos = ReadAbsInt(r);
     Yaw = r.ReadSByte() * Math.PI / 128;
     Pitch = r.ReadSByte() * Math.PI / 128;
     HeadYaw = r.ReadByte();
     UX = r.ReadInt16();
     UY = r.ReadInt16();
     UZ = r.ReadInt16();
     Metadata = Metadata.Read(r);
     #if DEBUGPACKET
     if (Type.ToString() == ((int)Type).ToString())
         throw new NotImplementedException(Type.ToString());
     #endif
 }
Example #10
0
 protected override void Parse(EndianBinaryReader r)
 {
     Name = ReadString8(r);
     Position = ReadInt8(r);
     Volume = r.ReadSingle();
     Pitch = r.ReadByte();
     //Category = (SoundCategoy)r.ReadByte();
 }
Example #11
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = r.ReadInt32();
     Status = (EntityStatuses)r.ReadByte();
     #if DEBUGPACKET
     if (Status.ToString() == ((int)Status).ToString())
         throw new NotImplementedException(Status.ToString());
     #endif
 }
Example #12
0
 protected override void Parse(EndianBinaryReader r)
 {
     Reason = (GameState)r.ReadByte();
     Value = r.ReadSingle();
     #if DEBUGPACKET
     if (Reason.ToString() == ((int)Reason).ToString())
         throw new NotImplementedException(Reason.ToString());
     #endif
 }
Example #13
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     Slot = r.ReadInt16();
     RightClick = r.ReadSByte();
     ActionID = r.ReadInt16();
     Shift = r.ReadSByte();
     Item = SlotItem.Read(r);
 }
Example #14
0
        protected override void Parse(EndianBinaryReader r)
        {
            EID = ReadVarInt(r);
            Animate = (Animations)r.ReadByte();

            #if DEBUGPACKET
            if (Animate.ToString() == ((int)Animate).ToString())
                throw new NotImplementedException(Animate.ToString());
            #endif

        }
Example #15
0
 protected override void Parse(EndianBinaryReader r)
 {
     EffectID = (SoundEffects)r.ReadInt32();
     Position = CoordInt.Read(r);
     SoundData = r.ReadInt32();
     SoundByte = r.ReadByte();
     //Debug.WriteLine(DebugPacket.Read(r));
     #if DEBUGPACKET
     if (EffectID.ToString() == ((int)EffectID).ToString())
         throw new NotImplementedException(EffectID.ToString());
     #endif
 }
Example #16
0
        protected override void Parse(EndianBinaryReader r)
        {
            WindowID = r.ReadByte();
            int count = r.ReadInt16();
            Items = new SlotItem [count];
            for (int n = 0; n < Items.Length; n++)
            {
                Items [n] = SlotItem.Read(r);
#if DEBUG
                //Console.WriteLine("Slot " + n + ": " + Items [n]);
#endif
            }
        }
        protected override void Parse(EndianBinaryReader r)
        {
            Position = new CoordDouble();
            Position.X = r.ReadDouble();
            Position.Y = r.ReadDouble();
            Position.Z = r.ReadDouble();
            Yaw = r.ReadSingle() * Math.PI / 180;
            Pitch = r.ReadSingle() * Math.PI / 180;
            Relative = r.ReadByte();

            //Console.WriteLine("Parsed: " + this);
            //Debug.WriteLine("Parsed: " + this);
        }
Example #18
0
 protected override void Parse(EndianBinaryReader r)
 {
     Event = (Action)r.ReadByte();
     if (Event == Action.End)
     {
         Duration = ReadVarInt(r);
         EntityID = r.ReadInt32();
     }
     if (Event == Action.Dead)
     {
         PlayerID = ReadVarInt(r);
         EntityID = r.ReadInt32();
         Message = ReadString8(r);
     }
 }
Example #19
0
		protected override void Parse (EndianBinaryReader r)
		{
			string raw = ReadString8 (r);
			//Debug.WriteLine("Chat RAW: " + raw);
			try {
                Json = ChatJson.Parse(raw);
                Position = (ChatPosition)r.ReadByte ();
			} 
            #if !DEBUG
            catch (Exception ex) {
				Log.WriteServer (ex);
			}
            #endif
            finally {
			}
		}
Example #20
0
        protected override void Parse(EndianBinaryReader r)
        {
            Pos = CoordInt.Read(r);
            Action = (Actions)r.ReadByte();
            Data = NBT.Tag.ReadTag(r);

            #if DEBUGPACKET
            if (Action == Actions.Unknown2)
                Console.WriteLine(this);
            if (Action == Actions.Unknown3)
                Console.WriteLine(this);
            if (Action == Actions.Unknown4)
                Console.WriteLine(this);

            if (Action.ToString() == ((int)Action).ToString())
                throw new NotImplementedException(Action.ToString());
            #endif
        }
Example #21
0
        protected override void Parse(EndianBinaryReader r)
        {
            Name = ReadString8(r);
            Mode = (TeamMode)r.ReadByte();

            if (Mode == TeamMode.Created || Mode == TeamMode.Updated)
            {
                Title = ReadString8(r);
                Prefix = ReadString8(r);
                Suffix = ReadString8(r);
                Flags = r.ReadSByte();
                U1 = ReadString8(r);
                U2 = r.ReadSByte();
            }
            if (Mode == TeamMode.Created || Mode == TeamMode.PlayerAdded || Mode == TeamMode.PlayerRemoved)
            {
                int count = ReadVarInt(r);
                Players = new List<string>();
                for (int n = 0; n < count; n++)
                    Players.Add(ReadString8(r));
            }
        }
Example #22
0
        protected override void Parse(EndianBinaryReader r)
        {
            EID = ReadVarInt(r);
            Type = (Vehicles)r.ReadByte();
            #if DEBUGPACKET
            if (Type.ToString() == ((int)Type).ToString())
                throw new NotImplementedException(Type.ToString());
            #endif
            if (Type == Vehicles.Unknown)
                Console.WriteLine();
            Position = ReadAbsInt(r);

            Yaw = r.ReadSByte();
            Pitch = r.ReadSByte();

            SourceEntity = r.ReadInt32();
            if (SourceEntity <= 0)
                return;
            short vx = r.ReadInt16();
            short vy = r.ReadInt16();
            short vz = r.ReadInt16();			
            Velocity = new CoordInt(vx, vy, vz);
        }
Example #23
0
 protected override void Parse(EndianBinaryReader r)
 {
     SideWays = r.ReadSingle();
     Forward = r.ReadSingle();
     Action = (Actions)r.ReadByte();
 }
Example #24
0
 protected override void Parse(EndianBinaryReader r)
 {
     Flags = (Abilities)r.ReadByte();
     FlySpeed = r.ReadSingle();
     WalkSpeed = r.ReadSingle();
 }
Example #25
0
        protected override void Parse(EndianBinaryReader r)
        {
			WindowID = r.ReadByte ();
		}
Example #26
0
        public void Parse(EndianBinaryReader reader, uint size)
        {
            var maxReadPos = reader.BaseStream.Position + size;
            while(reader.BaseStream.Position < maxReadPos)
            {
                if (objectStack.Count != 0)
                {
                    var count = reader.ReadUInt16();
                    var propString = "";
                    for (var i = 0; i < count; i++)
                    {
                        propString += (char) reader.ReadByte();
                    }
                    objectStack.Peek().CurrentProperty = propString;
                }

                var type = (Globals.Amf0Types)reader.ReadByte();

                switch (type)
                {
                    case Globals.Amf0Types.Number:
                        {
                            var value = reader.ReadDouble();
                            if(objectStack.Count != 0)
                            {
                                objectStack.Peek().Numbers.Add(objectStack.Peek().CurrentProperty, value);
                            }
                            else
                            {
                                amfData.Numbers.Add(value);
                            }
                        }
                        break;
                    case Globals.Amf0Types.Boolean:
                        {
                            var value = reader.ReadBoolean();
                            if (objectStack.Count != 0)
                            {
                                objectStack.Peek().Booleans.Add(objectStack.Peek().CurrentProperty, value);
                            }
                            else
                            {
                                amfData.Booleans.Add(value);
                            }
                        }
                        break;
                    case Globals.Amf0Types.String:
                        {
                            var count = reader.ReadUInt16();
                            var pushString = "";
                            for (var i = 0; i < count; i++)
                            {
                                pushString += (char) reader.ReadByte();
                            }

                            if (objectStack.Count != 0)
                            {
                                objectStack.Peek().Strings.Add(objectStack.Peek().CurrentProperty, pushString);
                            }
                            else
                            {
                                amfData.Strings.Add(pushString);
                            }
                        }
                        break;
                    case Globals.Amf0Types.Null:

                        if (objectStack.Count != 0)
                        {
                            objectStack.Peek().Nulls++;
                        }
                        else
                        {
                            amfData.Nulls++;
                        }
                        break;
                    case Globals.Amf0Types.Object:
                    case Globals.Amf0Types.Array:
                        {
                            if(type == Globals.Amf0Types.Array)
                            {
                                var arrayLength = reader.ReadInt32();
                            }
                            var objectAdd = new AmfObject();
                            objectStack.Push(objectAdd);
                        }
                        break;
                    case Globals.Amf0Types.ObjectEnd:
                        {
                            if(objectStack.Count == 1)
                            {
                                amfData.Objects.Add(objectStack.Pop());
                            }
                            else if(objectStack.Count > 1)
                            {
                                var mostRecentObject = objectStack.Pop();
                                objectStack.Peek().Objects.Add(objectStack.Peek().CurrentProperty, mostRecentObject);
                            }
                        }
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
                /*
                switch (type)
                {
                    case Amf0Types.Array:
                    case Amf0Types.Object:
                        {
                            if(type == Amf0Types.Array)
                            {
                                var arrayLength = reader.ReadInt32();
                                Console.WriteLine("Array:" + arrayLength);
                            }
                            bool hasProperty = false;
                            string property = "";
                            var objectAdd = new AmfObject();
                            while (reader.BaseStream.Position < maxReadPos)
                            {
                                if(!hasProperty)
                                {
                                    property = "";
                                    var propertyStringLength = reader.ReadUInt16();
                                    for (var i = 0; i < propertyStringLength; i++)
                                    {
                                        property += (char)reader.ReadByte();
                                    }
                                    hasProperty = true;
                                }

                                if (hasProperty == true)
                                {
                                    if(property.Length == 0)
                                    {
                                        amfData.Objects.Add(objectAdd);

                                        break;
                                    }
                                    var objtype = (Amf0Types)reader.ReadByte();
                                    parseType(objtype, reader, ref objectAdd.Nulls, objectNumbers: objectAdd.Numbers,
                                              objectBooleans: objectAdd.Booleans, objectStrings: objectAdd.Strings,
                                              property: property);
                                    hasProperty = false;
                                }
                            }
                        }
                        break;
                    default:
                        parseType(type, reader, ref amfData.Nulls, amfData.Numbers, amfData.Booleans, amfData.Strings);
                        break;
                }*/
            }
        }
Example #27
0
 //jesus f**k note to self: fix this
 private static void parseType(Globals.Amf0Types type, EndianBinaryReader reader,
     ref uint Nulls,
     List<double> Numbers = null,
     List<bool> Booleans = null,
     List<string> Strings = null,
     Dictionary<string, string> objectStrings = null,
     Dictionary<string, double> objectNumbers = null,
     Dictionary<string, bool> objectBooleans = null,
     string property = "")
 {
     switch (type)
     {
         case Globals.Amf0Types.Number:
             if (Numbers != null)
                 Numbers.Add(reader.ReadDouble());
             else
                 objectNumbers.Add(property, reader.ReadDouble());
             break;
         case Globals.Amf0Types.Boolean:
             if (Booleans != null)
                 Booleans.Add(reader.ReadBoolean());
             else
                 objectBooleans.Add(property, reader.ReadBoolean());
             break;
         case Globals.Amf0Types.String:
             {
                 var count = reader.ReadUInt16();
                 var pushString = "";
                 for (var i = 0; i < count; i++)
                 {
                     pushString += (char) reader.ReadByte();
                 }
                 if (Strings != null)
                     Strings.Add(pushString);
                 else
                     objectStrings.Add(property, pushString);
             }
             break;
         case Globals.Amf0Types.Null:
             Nulls++;
             break;
         case Globals.Amf0Types.Array:
             break;
         case Globals.Amf0Types.ObjectEnd:
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Position = CoordInt.Read(r);
     DestroyStage = r.ReadByte();
 }
Example #29
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     Property = r.ReadInt16();
     Value = r.ReadInt16();
 }
Example #30
0
 protected override void Parse(EndianBinaryReader r)
 {
     Position = (ScreenPosition)r.ReadByte();
     Board = ReadString8(r);
 }