Пример #1
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.entityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.motionX = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.motionY = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.motionZ = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
 }
Пример #2
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.itemID = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.uniqueID = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.itemData = new byte[IPAddress.NetworkToHostOrder(DataInput.ReadInt16())];
     DataInput.Read(this.itemData,0,this.itemData.Length);
 }
Пример #3
0
 public VolkeEyeSensorMessage(long timeFrame, System.IO.BinaryReader reader)
     : base(timeFrame)
 {
     short zero = 0;
     this.LeftPosition = new Point((int)Math.Max(reader.ReadInt16(), zero), (int)Math.Max(reader.ReadInt16(), zero));
     this.RightPosition = new Point((int)Math.Max(reader.ReadInt16(), zero), (int)Math.Max(reader.ReadInt16(), zero));
 }
Пример #4
0
        public FileHeader(System.IO.BinaryReader br)
        {
            majorVersion = 0;
            minorVersion = 0;
            stringCount = 0;
            infoCount = 0;
            ruleCount = 0;
            layoutOptions = new LayoutOptions();

            byte[] magicCode = br.ReadBytes(4);
            if (magicCode[0] != 'K' && magicCode[1] != 'M' && magicCode[2] != 'K' && magicCode[3] != 'L')
            {
                throw new Exception("Invalid KeyMagic keyboard layout file.");
            }

            majorVersion = br.ReadByte();
            minorVersion = br.ReadByte();

            if (majorVersion == 1 && minorVersion > 4)
            {
                throw new Exception("Cannot load this keyboard layout file because this is newer version of keyboard layout file.");
            }

            stringCount = br.ReadInt16();
            if (majorVersion == 1 && minorVersion > 3)
            {
                infoCount = br.ReadInt16();
            }
            ruleCount = br.ReadInt16();

            layoutOptions.trackCaps = br.ReadBoolean();
            layoutOptions.autoBksp = br.ReadBoolean();
            layoutOptions.eat = br.ReadBoolean();
            layoutOptions.posBased = br.ReadBoolean();
        }
Пример #5
0
 public VolkeMouseSensor(long timeFrame, System.IO.BinaryReader reader)
     : base(timeFrame)
 {
     int x = reader.ReadInt16();
     int y = reader.ReadInt16();
     this.Point = new Point(x, y);
 }
Пример #6
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.xLocation = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.yLocation = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.zLocation = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.instrumentType = DataInput.ReadByte();
     this.pitch = DataInput.ReadByte();
     this.blockId = IPAddress.NetworkToHostOrder(DataInput.ReadInt16()) &4095;
 }
Пример #7
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.xCh = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.zCh = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.includeInitialize = DataInput.ReadBoolean();
     this.yChMin = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.yChMax = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.tempLength = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     DataInput.ReadBytes(this.tempLength);
 }
Пример #8
0
        public VolkeQuestionMessage(long timeFrame, System.IO.BinaryReader reader)
            : base(timeFrame)
        {
            int x = reader.ReadInt16();
            int y = reader.ReadInt16();
            int size = reader.ReadInt32();
            var imageBytes = reader.ReadBytes(size);

            this.Point = new Point(x, y);
            this.Image = Image.FromStream(new MemoryStream(imageBytes));
        }
Пример #9
0
 public RGBImage(System.IO.BinaryReader br)
 {
     try
     {
         this.Width = br.ReadInt16();
         this.Height = br.ReadInt16();
         this.Size = Convert.ToInt32(this.Width) * Convert.ToInt32(this.Height) * 4;
         this.Data = br.ReadBytes(this.Size);
     }
     catch (Exception ex)
     {
     }
 }
Пример #10
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.entityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.type = DataInput.ReadByte() & 255;
     this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.yPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.yaw = DataInput.ReadByte();
     this.pitch = DataInput.ReadByte();
     this.headYaw = DataInput.ReadByte();
     this.velocityX = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.velocityY = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.velocityZ = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     readWatchableObjects(DataInput);
 }
Пример #11
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.entityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.effectId = DataInput.ReadByte();
     this.effectAmplifier = DataInput.ReadByte();
     this.duration = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
 }
Пример #12
0
 public PaletteImage(System.IO.BinaryReader br, bool compressed)
 {
     try
     {
         this.Width = br.ReadInt16();
         this.Height = br.ReadInt16();
         this.Size = Convert.ToInt32(this.Width) * Convert.ToInt32(this.Height);
         if (compressed)
         {
             this.Size = br.ReadUInt16();
         }
         this.Data = br.ReadBytes(this.Size);
     }
     catch (Exception ex)
     {
     }
 }
Пример #13
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.yPosition = DataInput.ReadByte();
     this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.type = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.metadata = DataInput.ReadByte();
 }
Пример #14
0
 public override object Deserialize(System.IO.BinaryReader binaryReader)
 {
     bool hasValue = binaryReader.ReadBoolean ();
     if (!hasValue)
         return null;
     int typeID = binaryReader.ReadByte ();
     switch (typeID) {
     case 1:
         return binaryReader.ReadBoolean ();
     case 2:
         return binaryReader.ReadByte ();
     case 128:
         return binaryReader.ReadSByte ();
     case 3:
         return binaryReader.ReadInt16 ();
     case 129:
         return binaryReader.ReadUInt16 ();
     case 4:
         return binaryReader.ReadInt32 ();
     case 130:
         return binaryReader.ReadUInt32 ();
     case 5:
         return binaryReader.ReadInt64 ();
     case 131:
         return binaryReader.ReadUInt64 ();
     case 9:
         return binaryReader.ReadDouble ();
     case 16:
         return binaryReader.ReadString ();
     case 144:
         return binaryReader.ReadChar ();
     case 24:
         return new DateTime (binaryReader.ReadInt64 ());
     case 32:
         return new Guid (binaryReader.ReadBytes (16));
     case 36:
         return binaryReader.ReadBytes (binaryReader.ReadInt32 ());
     case 37:
         {
             int count = binaryReader.ReadInt32 ();
             string[] r = new string[count];
             for (int n = 0; n != count; n++)
                 r [n] = binaryReader.ReadString ();
             return r;
         }
     case 38:
         {
             int count = binaryReader.ReadInt32 ();
             long[] r = new long[count];
             for (int n = 0; n != count; n++)
                 r [n] = binaryReader.ReadInt64 ();
             return r;
         }
     default:
         throw new Exception (string.Format ("Serialization for type <{0}> is not supported", typeID));
     }
 }
Пример #15
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.respawnDimension = DataInput.ReadInt32();
     this.difficulty = DataInput.ReadByte();
     this.gameType = DataInput.ReadByte();
     this.worldHeight = DataInput.ReadInt16();
     String s = readString(DataInput, 16);
     this.terrainType = s;
 }
Пример #16
0
        protected override void readData(System.IO.BinaryReader DataInput)
        {
            this.entityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.type = DataInput.ReadByte();
            this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.yPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.pitch = DataInput.ReadByte();
            this.yaw = DataInput.ReadByte();
            this.throwerEntityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());

            if (this.throwerEntityId > 0)
            {
                this.speedX = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
                this.speedY = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
                this.speedZ = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
            }
        }
Пример #17
0
        public PlayWaveHelper(System.IO.BinaryReader reader)
        {
            int strLen = reader.ReadInt16();
            byte[] bytes = reader.ReadBytes((int)strLen);
            _bankname = Encoding.ASCII.GetString(bytes);

            _index = reader.ReadInt32();
            _weight = reader.ReadByte();
        }
Пример #18
0
        public void DeserializePacket(System.IO.BinaryReader reader)
        {
            Version = reader.ReadString();

            var packetCount = reader.ReadInt32();

            for (var i = 0; i < packetCount; i++)
                CustomPackets.Add(reader.ReadInt16());
        }
Пример #19
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.WindowId = DataInput.ReadByte();
     short num = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     this.items = new ItemStack[num];
     for (int i = 0; i < num; i++)
     {
         items[i] = readItemStack(DataInput);
     }
 }
Пример #20
0
        protected override void readData(System.IO.BinaryReader DataInput)
        {
            this.PacketID = 56;
            this.ChunkNumber = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
            this.DataLength = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            bool flag_1 = DataInput.ReadBoolean();

            if (DataLength != 0)
            {
                if (ChunkData.Length < this.DataLength)
                    ChunkData = new byte[this.DataLength];
                DataInput.Read(ChunkData, 0, this.DataLength);
            }
            for (int i = 0; i < this.ChunkNumber; i++)
            {
                DataInput.ReadInt32();
                DataInput.ReadInt32();
                DataInput.ReadInt16();
                DataInput.ReadInt16();
            }
        }
Пример #21
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     this.entityId = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.name = readString(DataInput, 16);
     this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.yPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     this.rotation = DataInput.ReadByte();
     this.pitch = DataInput.ReadByte();
     this.currentItem = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
     readWatchableObjects(DataInput);
 }
Пример #22
0
        protected override void readData(System.IO.BinaryReader DataInput)
        {
            this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.yPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
            this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.signLines = new String[4];

            for (int i = 0; i < 4; ++i)
            {
                this.signLines[i] = readString(DataInput, 15);
            }
        }
Пример #23
0
        protected override void readData(System.IO.BinaryReader DataInput)
        {
            this.xPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.zPosition = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
            this.size = IPAddress.NetworkToHostOrder(DataInput.ReadInt16()) &65535;
            int i = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());

            if (i > 0)
            {
                this.metadataArray = new byte[i];
                DataInput.Read(this.metadataArray,0,i);
            }
        }
Пример #24
0
        public ushort num_leaf_faces; // number of consecutive edges (in the face leaf array)

        #endregion Fields

        #region Methods

        public void Read(System.IO.BinaryReader source)
        {
            brush_or = source.ReadUInt32();
            cluster = source.ReadInt16();           // -1 for cluster indicates no visibility information
            area = source.ReadUInt16();              // ?

            box.Read(source);

            first_leaf_face = source.ReadUInt16();   // index of the first face (in the face leaf array)
            num_leaf_faces = source.ReadUInt16();    // number of consecutive edges (in the face leaf array)

            first_leaf_brush = source.ReadUInt16();  // ?
            num_leaf_brushes = source.ReadUInt16();  // ?
        }
Пример #25
0
        protected override void ReadFromStream(System.IO.BinaryReader reader)
        {
            base.ReadFromStream(reader);

            Chunks = reader.ReadUInt16();
            Delay = reader.ReadUInt16();
            Reserved = reader.ReadInt16();
            Width = reader.ReadUInt16();
            Height = reader.ReadUInt16();

            if (Width != 0 || Height != 0)
                throw new NotImplementedException("Overlay width or height is not supported yet.");

            ReadSubChunks(reader, Chunks);
        }
Пример #26
0
 internal void Read(System.IO.BinaryReader source)
 {
     mins = new short[3];
     maxs = new short[3];
     mins[0] = source.ReadInt16();
     mins[1] = source.ReadInt16();
     mins[2] = source.ReadInt16();
     maxs[0] = source.ReadInt16();
     maxs[1] = source.ReadInt16();
     maxs[2] = source.ReadInt16();
 }
Пример #27
0
        float mVolume; // category gain

        #endregion Fields

        #region Constructors

        //internal System.Collections.Generic.List<SoundHelper> instances = new System.Collections.Generic.List<SoundHelper>();
        public AudioCategory(System.IO.BinaryReader reader)
        {
            int strLen = reader.ReadInt16();
            byte[] bytes = reader.ReadBytes((int)strLen);
            mName = Encoding.ASCII.GetString(bytes);

            bool mBackgroundMusic = reader.ReadBoolean();
            int volume = reader.ReadInt32(); // 100 * db
            int mBehavior = reader.ReadInt32();
            int mMaxInstances = reader.ReadInt32();
            //GSGE.Debug.logMessage("category " + mName + " maxInstances = " + mMaxInstances);
            GSGE.Debug.assert(mMaxInstances > 0);

            // XACT stores it as a 2 decimal fixed point value
            double attenuation_in_db = volume / 100.0f;
            float gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            mVolume = gain;
        }
Пример #28
0
 protected override void readData(System.IO.BinaryReader DataInput)
 {
     DataInput.ReadInt32();
     int i = IPAddress.NetworkToHostOrder(DataInput.ReadInt32());
     for (int j = 0; j < i; ++j)
     {
         readString(DataInput, 64);
         DataInput.ReadDouble();
         short l = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());
         for (int k = 0; k < l; ++k)
         {
             DataInput.ReadInt64();
             DataInput.ReadInt64();
             DataInput.ReadInt64();
             DataInput.ReadByte();
         }
     }
 }
Пример #29
0
        protected override void readData(System.IO.BinaryReader DataInput)
        {
            this.teamName = readString(DataInput, 16);
            this.mode = DataInput.ReadByte();

            if (this.mode == 0 || this.mode == 2)
            {
                this.teamDisplayName = readString(DataInput, 32);
                this.teamPrefix = readString(DataInput, 16);
                this.teamSuffix = readString(DataInput, 16);
                this.friendlyFire = DataInput.ReadByte();
            }

            if (this.mode == 0 || this.mode == 3 || this.mode == 4)
            {
                short short1 = IPAddress.NetworkToHostOrder(DataInput.ReadInt16());

                for (int i = 0; i < short1; ++i)
                {
                    readString(DataInput, 16);
                }
            }
        }
Пример #30
0
        public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader)
        {
            _priority = reader.ReadInt32();

            int volume = reader.ReadInt32();
            double attenuation_in_db = volume / 100.0f;
            GSGE.Debug.assert(attenuation_in_db <= 0);
            gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            GSGE.Debug.assert(gain <= 1.0f);

            _pitch = (float)(reader.ReadInt32() / 100.0f);

            int trackCount = reader.ReadInt32();
            _tracks = new TrackHelper[trackCount];
            for (int i = 0; i < trackCount; i++)
            {
                _tracks[i] = new TrackHelper(reader);
            }

            int strLen = reader.ReadInt16();
            byte[] bytes = reader.ReadBytes((int)strLen);
            string catname = Encoding.ASCII.GetString(bytes);
            category = audioengine.GetCategory(catname);

            int rpcCount = reader.ReadInt32();
            rpcs = new RPCCurve[rpcCount];
            for (int i = 0; i < rpcCount; i++)
            {
                strLen = reader.ReadInt16();
                bytes = reader.ReadBytes((int)strLen);
                string rpc = Encoding.ASCII.GetString(bytes);

                rpcs[i] = audioengine.GetRPC(rpc);
            }

            strLen = reader.ReadInt16();
            bytes = reader.ReadBytes((int)strLen);
            effect = Encoding.ASCII.GetString(bytes);
        }