Exemplo n.º 1
0
 /// <summary>
 /// Parses AABB from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     Min = new Vector3D();
     Min.Parse(buffer);
     Max = new Vector3D();
     Max.Parse(buffer);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Reads PRTransform from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     Quaternion = new Quaternion();
     Quaternion.Parse(buffer);
     Vector3D = new Vector3D();
     Vector3D.Parse(buffer);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Parses RGBAColor from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     Red = (byte) buffer.ReadInt(8);
     Green = (byte) buffer.ReadInt(8);
     Blue = (byte) buffer.ReadInt(8);
     Alpha = (byte) buffer.ReadInt(8);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Encodes RGBAColor to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteInt(8, Red);
     buffer.WriteInt(8, Green);
     buffer.WriteInt(8, Blue);
     buffer.WriteInt(8, Alpha);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Encodes SceneCachedValues to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteInt(32, Unknown1);
     buffer.WriteInt(32, Unknown2);
     buffer.WriteInt(32, Unknown3);
     AABB1.Encode(buffer);
     AABB2.Encode(buffer);
     for (int i = 0; i < Unknown4.Length; i++) buffer.WriteInt(32, Unknown4[i]);
     buffer.WriteInt(32, Unknown5);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Parses SceneCachedValues from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     Unknown1 = buffer.ReadInt(32);
     Unknown2 = buffer.ReadInt(32);
     Unknown3 = buffer.ReadInt(32);
     AABB1 = new AABB();
     AABB1.Parse(buffer);
     AABB2 = new AABB();
     AABB2.Parse(buffer);
     Unknown4 = new int[4];
     for (int i = 0; i < Unknown4.Length; i++) Unknown4[i] = buffer.ReadInt(32);
     Unknown5 = buffer.ReadInt(32);
 }
Exemplo n.º 7
0
        // Create and parse the GameMessage that handles the next opcode
        public static GameMessage ParseMessage(GameBitBuffer buffer)
        {
            GameMessage msg = null;

            Opcodes opcode = (Opcodes)buffer.ReadInt(9);
            if (MessageTypes.ContainsKey(opcode))
            {
                msg = (GameMessage)FormatterServices.GetUninitializedObject(MessageTypes[opcode]);
                typeof(GameMessage).GetProperty("Id").SetValue(msg, (int)opcode, null);
                msg.Parse(buffer);
            }

            return msg as GameMessage;
        }
Exemplo n.º 8
0
        public static GameMessage ParseMessage(GameBitBuffer buffer)
        {
            GameMessage msg = null;

            Opcodes opcode = (Opcodes)buffer.ReadInt(9);
            if (MessageTypes.ContainsKey(opcode))
            {
                msg = (GameMessage)FormatterServices.GetUninitializedObject(MessageTypes[opcode]);
                msg.Id = (int)opcode;
                msg.Parse(buffer);
            }

            return msg as GameMessage;
        }
Exemplo n.º 9
0
 /// <summary>
 /// Parses Quaternion from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     W = buffer.ReadFloat32();
     Vector3D = new Vector3D();
     Vector3D.Parse(buffer);
 }
Exemplo n.º 10
0
 public abstract void Encode(GameBitBuffer buffer);
Exemplo n.º 11
0
 public override void Encode(GameBitBuffer buffer)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 12
0
 public override void Parse(GameBitBuffer buffer)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Encodes Vector2D to given GameBitBuffer.
 /// </summary>        
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteInt(32, X);
     buffer.WriteInt(32, Y);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Parses Vector2D from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     X = buffer.ReadInt(32);
     Y = buffer.ReadInt(32);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Encodes SceneSpecification to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteInt(32, CellZ);
     Cell.Encode(buffer);
     for (int i = 0; i < SNOLevelAreas.Length; i++) buffer.WriteInt(32, SNOLevelAreas[i]);
     buffer.WriteInt(32, SNOPrevWorld);
     buffer.WriteInt(32, Unknown1);
     buffer.WriteInt(32, SNOPrevLevelArea);
     buffer.WriteInt(32, SNONextWorld);
     buffer.WriteInt(32, Unknown2);
     buffer.WriteInt(32, SNONextLevelArea);
     buffer.WriteInt(32, SNOMusic);
     buffer.WriteInt(32, SNOCombatMusic);
     buffer.WriteInt(32, SNOAmbient);
     buffer.WriteInt(32, SNOReverb);
     buffer.WriteInt(32, SNOWeather);
     buffer.WriteInt(32, SNOPresetWorld);
     buffer.WriteInt(32, Unknown3);
     buffer.WriteInt(32, Unknown4);
     buffer.WriteInt(32, Unknown5);
     buffer.WriteInt(32, ClusterID);
     SceneCachedValues.Encode(buffer);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Encodes PRTransform to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     Quaternion.Encode(buffer);
     Vector3D.Encode(buffer);
 }
Exemplo n.º 17
0
 public abstract void Parse(GameBitBuffer buffer);
Exemplo n.º 18
0
        /// <summary>
        /// Returns the protocol version for a given stream if the information is available
        /// Only GS streams have that version set (i guess/hope)
        /// </summary>
        public bool IsGSStream(string stream)
        {
            if (stream == "")
                return false;

            var x = stream.Substring(0, stream.IndexOf("\n"));
            
            if ((x.Substring(0,1) != "O") && (x.Substring(0,1) != "I"))
                return false; //is this a mooege dump?

            var currentBuffer = (x.Substring(13)).Replace("\r", "");
            var buf = String_To_Bytes(currentBuffer);

            GameBitBuffer bitbuffer = new GameBitBuffer(buf);
            
            if (bitbuffer.IsPacketAvailable())
            {
                try
                {
                    bitbuffer.Position = 32;
                    GameMessage message = bitbuffer.ParseMessage();
                    if (message is JoinBNetGameMessage)
                    {
                        //this isnt real confirmation :P
                        return true;
                    }
                }
                catch (Exception e)
                {

                }
            }
            return false;
        }
Exemplo n.º 19
0
 /// <summary>
 /// Parses Vector3D from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     X = buffer.ReadFloat32();
     Y = buffer.ReadFloat32();
     Z = buffer.ReadFloat32();
 }
Exemplo n.º 20
0
 /// <summary>
 /// Parses SceneSpecification from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     CellZ = buffer.ReadInt(32);
     Cell = new Vector2D();
     Cell.Parse(buffer);
     SNOLevelAreas = new int /* sno */[4];
     for (int i = 0; i < SNOLevelAreas.Length; i++) SNOLevelAreas[i] = buffer.ReadInt(32);
     SNOPrevWorld = buffer.ReadInt(32);
     Unknown1 = buffer.ReadInt(32);
     SNOPrevLevelArea = buffer.ReadInt(32);
     SNONextWorld = buffer.ReadInt(32);
     Unknown2 = buffer.ReadInt(32);
     SNONextLevelArea = buffer.ReadInt(32);
     SNOMusic = buffer.ReadInt(32);
     SNOCombatMusic = buffer.ReadInt(32);
     SNOAmbient = buffer.ReadInt(32);
     SNOReverb = buffer.ReadInt(32);
     SNOWeather = buffer.ReadInt(32);
     SNOPresetWorld = buffer.ReadInt(32);
     Unknown3 = buffer.ReadInt(32);
     Unknown4 = buffer.ReadInt(32);
     Unknown5 = buffer.ReadInt(32);
     ClusterID = buffer.ReadInt(32);
     SceneCachedValues = new SceneCachedValues();
     SceneCachedValues.Parse(buffer);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Encodes AABB to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     Min.Encode(buffer);
     Max.Encode(buffer);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Encodes SNOName to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteInt(32, (int)Group);
     buffer.WriteInt(32, SNOId);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Parses SNOName from given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to parse from.</param>
 public void Parse(GameBitBuffer buffer)
 {
     Group = (SNOGroup)buffer.ReadInt(32);
     SNOId = buffer.ReadInt(32);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Encodes Vector3D to given GameBitBuffer.
 /// </summary>        
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteFloat32(X);
     buffer.WriteFloat32(Y);
     buffer.WriteFloat32(Z);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Encodes Quaternion to given GameBitBuffer.
 /// </summary>
 /// <param name="buffer">The GameBitBuffer to write.</param>
 public void Encode(GameBitBuffer buffer)
 {
     buffer.WriteFloat32(W);
     Vector3D.Encode(buffer);
 }