public override void Deserialize(BigEndianReader reader)
        {
            var limit = reader.ReadUShort();

            effects = new Types.FightDispellableEffectExtendedInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                effects[i] = new Types.FightDispellableEffectExtendedInformations();
                effects[i].Deserialize(reader);
            }
            limit = reader.ReadUShort();
            marks = new Types.GameActionMark[limit];
            for (int i = 0; i < limit; i++)
            {
                marks[i] = new Types.GameActionMark();
                marks[i].Deserialize(reader);
            }
            gameTurn = reader.ReadVarShort();
            if (gameTurn < 0)
            {
                throw new Exception("Forbidden value on gameTurn = " + gameTurn + ", it doesn't respect the following condition : gameTurn < 0");
            }
            fightStart = reader.ReadInt();
            if (fightStart < 0)
            {
                throw new Exception("Forbidden value on fightStart = " + fightStart + ", it doesn't respect the following condition : fightStart < 0");
            }
        }
        public virtual void Deserialize(BigEndianReader reader)
        {
            fightId   = reader.ReadInt();
            fightType = reader.ReadSByte();
            if (fightType < 0)
            {
                throw new Exception("Forbidden value on fightType = " + fightType + ", it doesn't respect the following condition : fightType < 0");
            }
            var limit = reader.ReadUShort();

            fightTeams = new Types.FightTeamInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                fightTeams[i] = Types.ProtocolTypeManager.GetInstance <Types.FightTeamInformations>(reader.ReadShort());
                fightTeams[i].Deserialize(reader);
            }
            limit = reader.ReadUShort();
            fightTeamsPositions = new short[limit];
            for (int i = 0; i < limit; i++)
            {
                fightTeamsPositions[i] = reader.ReadShort();
            }
            limit             = reader.ReadUShort();
            fightTeamsOptions = new Types.FightOptionsInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                fightTeamsOptions[i] = new Types.FightOptionsInformations();
                fightTeamsOptions[i].Deserialize(reader);
            }
        }
Exemplo n.º 3
0
        public override void Deserialize(BigEndianReader reader)
        {
            byte flag1 = reader.ReadByte();

            self            = BooleanByteWrapper.GetFlag(flag1, 0);
            verbose         = BooleanByteWrapper.GetFlag(flag1, 1);
            position        = reader.ReadSByte();
            accountNickname = reader.ReadUTF();
            accountId       = reader.ReadInt();
            if (accountId < 0)
            {
                throw new Exception("Forbidden value on accountId = " + accountId + ", it doesn't respect the following condition : accountId < 0");
            }
            playerName = reader.ReadUTF();
            playerId   = reader.ReadVarInt();
            if (playerId < 0)
            {
                throw new Exception("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
            }
            areaId = reader.ReadShort();
            var limit = reader.ReadUShort();

            socialGroups = new Types.AbstractSocialGroupInfos[limit];
            for (int i = 0; i < limit; i++)
            {
                socialGroups[i] = Types.ProtocolTypeManager.GetInstance <Types.AbstractSocialGroupInfos>(reader.ReadShort());
                socialGroups[i].Deserialize(reader);
            }
            playerState = reader.ReadSByte();
            if (playerState < 0)
            {
                throw new Exception("Forbidden value on playerState = " + playerState + ", it doesn't respect the following condition : playerState < 0");
            }
        }
Exemplo n.º 4
0
        public override void FromRaw(BigEndianReader raw)
        {
            int entityLookLength = raw.ReadInt();

            EntityLook         = raw.ReadUTFBytes((ushort)entityLookLength);
            HorizontalSymmetry = raw.ReadBoolean();
        }
Exemplo n.º 5
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     guildOwner = reader.ReadUTF();
     worldX     = reader.ReadShort();
     if (worldX < -255 || worldX > 255)
     {
         throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
     }
     worldY = reader.ReadShort();
     if (worldY < -255 || worldY > 255)
     {
         throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255");
     }
     subAreaId = reader.ReadShort();
     if (subAreaId < 0)
     {
         throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0");
     }
     nbMount  = reader.ReadSByte();
     nbObject = reader.ReadSByte();
     price    = reader.ReadInt();
     if (price < 0)
     {
         throw new Exception("Forbidden value on price = " + price + ", it doesn't respect the following condition : price < 0");
     }
 }
Exemplo n.º 6
0
        public virtual void Deserialize(BigEndianReader reader)
        {
            bonesId = reader.ReadVarShort();
            if (bonesId < 0)
            {
                throw new Exception("Forbidden value on bonesId = " + bonesId + ", it doesn't respect the following condition : bonesId < 0");
            }
            var limit = reader.ReadUShort();

            skins = new short[limit];
            for (int i = 0; i < limit; i++)
            {
                skins[i] = reader.ReadVarShort();
            }
            limit         = reader.ReadUShort();
            indexedColors = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                indexedColors[i] = reader.ReadInt();
            }
            limit  = reader.ReadUShort();
            scales = new short[limit];
            for (int i = 0; i < limit; i++)
            {
                scales[i] = reader.ReadVarShort();
            }
            limit       = reader.ReadUShort();
            subentities = new Types.SubEntity[limit];
            for (int i = 0; i < limit; i++)
            {
                subentities[i] = new Types.SubEntity();
                subentities[i].Deserialize(reader);
            }
        }
Exemplo n.º 7
0
        public override void Deserialize(BigEndianReader reader)
        {
            byte flag1 = reader.ReadByte();

            enabled           = BooleanByteWrapper.GetFlag(flag1, 0);
            abandonnedPaddock = BooleanByteWrapper.GetFlag(flag1, 1);
            level             = reader.ReadByte();
            if (level < 0 || level > 255)
            {
                throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0 || level > 255");
            }
            expLevelFloor = reader.ReadDouble();
            if (expLevelFloor < 0)
            {
                throw new Exception("Forbidden value on expLevelFloor = " + expLevelFloor + ", it doesn't respect the following condition : expLevelFloor < 0");
            }
            experience = reader.ReadDouble();
            if (experience < 0)
            {
                throw new Exception("Forbidden value on experience = " + experience + ", it doesn't respect the following condition : experience < 0");
            }
            expNextLevelFloor = reader.ReadDouble();
            if (expNextLevelFloor < 0)
            {
                throw new Exception("Forbidden value on expNextLevelFloor = " + expNextLevelFloor + ", it doesn't respect the following condition : expNextLevelFloor < 0");
            }
            creationDate = reader.ReadInt();
            if (creationDate < 0)
            {
                throw new Exception("Forbidden value on creationDate = " + creationDate + ", it doesn't respect the following condition : creationDate < 0");
            }
        }
Exemplo n.º 8
0
        public virtual void Deserialize(BigEndianReader reader)
        {
            var limit = reader.ReadUShort();

            quantities = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                quantities[i] = reader.ReadVarInt();
            }
            limit = reader.ReadUShort();
            types = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                types[i] = reader.ReadVarInt();
            }
            taxPercentage             = reader.ReadFloat();
            taxModificationPercentage = reader.ReadFloat();
            maxItemLevel = reader.ReadByte();
            if (maxItemLevel < 0 || maxItemLevel > 255)
            {
                throw new Exception("Forbidden value on maxItemLevel = " + maxItemLevel + ", it doesn't respect the following condition : maxItemLevel < 0 || maxItemLevel > 255");
            }
            maxItemPerAccount = reader.ReadVarInt();
            if (maxItemPerAccount < 0)
            {
                throw new Exception("Forbidden value on maxItemPerAccount = " + maxItemPerAccount + ", it doesn't respect the following condition : maxItemPerAccount < 0");
            }
            npcContextualId = reader.ReadInt();
            unsoldDelay     = reader.ReadVarShort();
            if (unsoldDelay < 0)
            {
                throw new Exception("Forbidden value on unsoldDelay = " + unsoldDelay + ", it doesn't respect the following condition : unsoldDelay < 0");
            }
        }
Exemplo n.º 9
0
 public override void Deserialize(BigEndianReader reader)
 {
     this.accountId = reader.ReadInt();
     this.userName  = reader.ReadUTF();
     this.password  = reader.ReadUTF();
     this.email     = reader.ReadUTF();
 }
Exemplo n.º 10
0
        private void Open()
        {
            BigEndianReader reader = new BigEndianReader(File.ReadAllBytes(Path));

            string header = reader.ReadUTF();

            if (header != FILE_HEADER)
            {
                throw new Exception("malformated file (wrong header)");
            }

            UIListPosition = new Dictionary <string, int>();

            uint loc7 = 0;

            this.Xml = reader.ReadUTF();

            short definitionCount = reader.ReadShort();

            while (loc7 < definitionCount)
            {
                UIListPosition.Add(reader.ReadUTF(), reader.ReadInt());
                loc7++;
            }
        }
Exemplo n.º 11
0
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     targetId   = reader.ReadInt();
     entityLook = new Types.EntityLook();
     entityLook.Deserialize(reader);
 }
Exemplo n.º 12
0
        public static EleGraphicalData ReadFromStream(EleInstance instance, BigEndianReader reader)
        {
            var id   = reader.ReadInt();
            var type = (EleGraphicalElementTypes)reader.ReadByte();

            switch (type)
            {
            case EleGraphicalElementTypes.ANIMATED:
                return(AnimatedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BLENDED:
                return(BlendedGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.BOUNDING_BOX:
                return(BoundingBoxGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.ENTITY:
                return(EntityGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.NORMAL:
                return(NormalGraphicalElementData.ReadFromStream(instance, id, reader));

            case EleGraphicalElementTypes.PARTICLES:
                return(ParticlesGraphicalElementData.ReadFromStream(instance, id, reader));

            default:
                throw new Exception("Unknown graphical data of type " + type);
            }
        }
Exemplo n.º 13
0
        public override void Deserialize(BigEndianReader reader)
        {
            teleporterType = reader.ReadSByte();
            if (teleporterType < 0)
            {
                throw new Exception("Forbidden value on teleporterType = " + teleporterType + ", it doesn't respect the following condition : teleporterType < 0");
            }
            var limit = reader.ReadUShort();

            mapIds = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                mapIds[i] = reader.ReadInt();
            }
            limit      = reader.ReadUShort();
            subAreaIds = new short[limit];
            for (int i = 0; i < limit; i++)
            {
                subAreaIds[i] = reader.ReadShort();
            }
            limit = reader.ReadUShort();
            costs = new short[limit];
            for (int i = 0; i < limit; i++)
            {
                costs[i] = reader.ReadShort();
            }
            limit = reader.ReadUShort();
            destTeleporterType = new sbyte[limit];
            for (int i = 0; i < limit; i++)
            {
                destTeleporterType[i] = reader.ReadSByte();
            }
        }
Exemplo n.º 14
0
        private ArrayList method_1(string string_1, BigEndianReader dofusReader_0)
        {
            ArrayList list = new ArrayList();
            int       num  = dofusReader_0.ReadInt();
            int       i    = 1;

            while ((i <= num))
            {
                var obj = RuntimeHelpers.GetObjectValue(this.class17_0.delegate0_0.Invoke(string_1, dofusReader_0));
                if (obj != null)
                {
                    list.Add(obj);
                }
                i += 1;
            }

            if (list.Count > 0)
            {
                return(list);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 15
0
        // Methods
        internal Class17(string string_1, BigEndianReader dofusReader_0)
        {
            this.string_0 = string_1;
            int num = dofusReader_0.ReadInt();

            this.delegate0_0 = this.method_0(num, dofusReader_0);
        }
Exemplo n.º 16
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     uid = reader.ReadVarInt();
     if (uid < 0)
     {
         throw new Exception("Forbidden value on uid = " + uid + ", it doesn't respect the following condition : uid < 0");
     }
     targetId     = reader.ReadInt();
     turnDuration = reader.ReadShort();
     dispelable   = reader.ReadSByte();
     if (dispelable < 0)
     {
         throw new Exception("Forbidden value on dispelable = " + dispelable + ", it doesn't respect the following condition : dispelable < 0");
     }
     spellId = reader.ReadVarShort();
     if (spellId < 0)
     {
         throw new Exception("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0");
     }
     effectId = reader.ReadVarInt();
     if (effectId < 0)
     {
         throw new Exception("Forbidden value on effectId = " + effectId + ", it doesn't respect the following condition : effectId < 0");
     }
     parentBoostUid = reader.ReadVarInt();
     if (parentBoostUid < 0)
     {
         throw new Exception("Forbidden value on parentBoostUid = " + parentBoostUid + ", it doesn't respect the following condition : parentBoostUid < 0");
     }
 }
Exemplo n.º 17
0
        public override void Deserialize(BigEndianReader reader)
        {
            collectorName = reader.ReadUTF();
            worldX        = reader.ReadShort();
            if (worldX < -255 || worldX > 255)
            {
                throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
            }
            worldY = reader.ReadShort();
            if (worldY < -255 || worldY > 255)
            {
                throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255");
            }
            mapId     = reader.ReadInt();
            subAreaId = reader.ReadShort();
            if (subAreaId < 0)
            {
                throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0");
            }
            userName   = reader.ReadUTF();
            experience = reader.ReadDouble();
            var limit = reader.ReadUShort();

            objectsInfos = new Types.ObjectItemQuantity[limit];
            for (int i = 0; i < limit; i++)
            {
                objectsInfos[i] = new Types.ObjectItemQuantity();
                objectsInfos[i].Deserialize(reader);
            }
        }
Exemplo n.º 18
0
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     playerId = reader.ReadInt();
     if (playerId < 0)
     {
         throw new Exception("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
     }
     playerName = reader.ReadUTF();
     level      = reader.ReadShort();
     if (level < 0 || level > 200)
     {
         throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0 || level > 200");
     }
     alignmentSide = reader.ReadSByte();
     breed         = reader.ReadSByte();
     if (breed < (byte)Enums.PlayableBreedEnum.Feca || breed > (byte)Enums.PlayableBreedEnum.Steamer)
     {
         throw new Exception("Forbidden value on breed = " + breed + ", it doesn't respect the following condition : breed < (byte)Enums.PlayableBreedEnum.Feca || breed > (byte)Enums.PlayableBreedEnum.Steamer");
     }
     sex       = reader.ReadBoolean();
     guildInfo = new Types.BasicGuildInformations();
     guildInfo.Deserialize(reader);
     moodSmileyId = reader.ReadSByte();
     status       = Types.ProtocolTypeManager.GetInstance <Types.PlayerStatus>(reader.ReadShort());
     status.Deserialize(reader);
 }
 public virtual void Deserialize(BigEndianReader reader)
 {
     firstNameId = reader.ReadVarShort();
     if (firstNameId < 0)
     {
         throw new Exception("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0");
     }
     lastNameId = reader.ReadVarShort();
     if (lastNameId < 0)
     {
         throw new Exception("Forbidden value on lastNameId = " + lastNameId + ", it doesn't respect the following condition : lastNameId < 0");
     }
     worldX = reader.ReadShort();
     if (worldX < -255 || worldX > 255)
     {
         throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
     }
     worldY = reader.ReadShort();
     if (worldY < -255 || worldY > 255)
     {
         throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255");
     }
     mapId     = reader.ReadInt();
     subAreaId = reader.ReadVarShort();
     if (subAreaId < 0)
     {
         throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0");
     }
 }
Exemplo n.º 20
0
        private void Initiate(BigEndianReader stream)
        {
            int readType = stream.ReadInt();

            readMethod = GetMethod(readType, stream);
            Type       = GetType(readType);
        }
Exemplo n.º 21
0
 public void RecoverAccountsInfos()
 {
     if (File.Exists(m_SavingFilePath))
     {
         IFormatter binaryFormatter = new BinaryFormatter();
         using (Stream stream = new FileStream(m_SavingFilePath, FileMode.Open, FileAccess.Read))
         {
             BigEndianWriter writer = (BigEndianWriter)binaryFormatter.Deserialize(stream);
             using (BigEndianReader reader = new BigEndianReader(writer.Content))
             {
                 int limite = reader.ReadInt();
                 m_Accounts = new List <Account>();
                 for (int index = 0; index < limite; index++)
                 {
                     m_Accounts.Add(new Account(reader.ReadUTF(), reader.ReadUTF()));
                 }
             }
             writer.Dispose();
             stream.Close();
         }
     }
     foreach (Account accountObject in m_Accounts)
     {
         accountObject.Password = CryptageBS.DecryptBS(accountObject.Password);
     }
 }
Exemplo n.º 22
0
        public override void Deserialize(BigEndianReader reader)
        {
            duration = reader.ReadInt();
            if (duration < 0)
            {
                throw new Exception("Forbidden value on duration = " + duration + ", it doesn't respect the following condition : duration < 0");
            }
            ageBonus            = reader.ReadShort();
            lootShareLimitMalus = reader.ReadShort();
            var limit = reader.ReadUShort();

            results = new Types.FightResultListEntry[limit];
            for (int i = 0; i < limit; i++)
            {
                results[i] = Types.ProtocolTypeManager.GetInstance <Types.FightResultListEntry>(reader.ReadShort());
                results[i].Deserialize(reader);
            }
            limit = reader.ReadUShort();
            namedPartyTeamsOutcomes = new Types.NamedPartyTeamWithOutcome[limit];
            for (int i = 0; i < limit; i++)
            {
                namedPartyTeamsOutcomes[i] = new Types.NamedPartyTeamWithOutcome();
                namedPartyTeamsOutcomes[i].Deserialize(reader);
            }
        }
Exemplo n.º 23
0
        public override void Deserialize(BigEndianReader reader)
        {
            var limit = reader.ReadUShort();

            ids = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                ids[i] = reader.ReadInt();
            }
            limit    = reader.ReadUShort();
            deadsIds = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                deadsIds[i] = reader.ReadInt();
            }
        }
Exemplo n.º 24
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     major = reader.ReadSByte();
     if (major < 0)
     {
         throw new Exception("Forbidden value on major = " + major + ", it doesn't respect the following condition : major < 0");
     }
     minor = reader.ReadSByte();
     if (minor < 0)
     {
         throw new Exception("Forbidden value on minor = " + minor + ", it doesn't respect the following condition : minor < 0");
     }
     release = reader.ReadSByte();
     if (release < 0)
     {
         throw new Exception("Forbidden value on release = " + release + ", it doesn't respect the following condition : release < 0");
     }
     revision = reader.ReadInt();
     if (revision < 0)
     {
         throw new Exception("Forbidden value on revision = " + revision + ", it doesn't respect the following condition : revision < 0");
     }
     patch = reader.ReadSByte();
     if (patch < 0)
     {
         throw new Exception("Forbidden value on patch = " + patch + ", it doesn't respect the following condition : patch < 0");
     }
     buildType = reader.ReadSByte();
     if (buildType < 0)
     {
         throw new Exception("Forbidden value on buildType = " + buildType + ", it doesn't respect the following condition : buildType < 0");
     }
 }
Exemplo n.º 25
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     spouseAccountId = reader.ReadInt();
     if (spouseAccountId < 0)
     {
         throw new Exception("Forbidden value on spouseAccountId = " + spouseAccountId + ", it doesn't respect the following condition : spouseAccountId < 0");
     }
     spouseId = reader.ReadVarInt();
     if (spouseId < 0)
     {
         throw new Exception("Forbidden value on spouseId = " + spouseId + ", it doesn't respect the following condition : spouseId < 0");
     }
     spouseName  = reader.ReadUTF();
     spouseLevel = reader.ReadByte();
     if (spouseLevel < 1 || spouseLevel > 200)
     {
         throw new Exception("Forbidden value on spouseLevel = " + spouseLevel + ", it doesn't respect the following condition : spouseLevel < 1 || spouseLevel > 200");
     }
     breed            = reader.ReadSByte();
     sex              = reader.ReadSByte();
     spouseEntityLook = new Types.EntityLook();
     spouseEntityLook.Deserialize(reader);
     guildInfo = new Types.BasicGuildInformations();
     guildInfo.Deserialize(reader);
     alignmentSide = reader.ReadSByte();
 }
Exemplo n.º 26
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     playerId = reader.ReadVarInt();
     if (playerId < 0)
     {
         throw new Exception("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
     }
     playerName    = reader.ReadUTF();
     alignmentSide = reader.ReadSByte();
     breed         = reader.ReadSByte();
     sex           = reader.ReadBoolean();
     isInWorkshop  = reader.ReadBoolean();
     worldX        = reader.ReadShort();
     if (worldX < -255 || worldX > 255)
     {
         throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
     }
     worldY = reader.ReadShort();
     if (worldY < -255 || worldY > 255)
     {
         throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255");
     }
     mapId     = reader.ReadInt();
     subAreaId = reader.ReadVarShort();
     if (subAreaId < 0)
     {
         throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0");
     }
     status = Types.ProtocolTypeManager.GetInstance <Types.PlayerStatus>(reader.ReadShort());
     status.Deserialize(reader);
 }
Exemplo n.º 27
0
        private object ReadFieldVector(BigEndianReader reader, D2OFieldDefinition field, int vectorDimension)
        {
            int count = reader.ReadInt();

            Type vectorType = field.FieldType;

            for (int i = 0; i < vectorDimension; i++)
            {
                vectorType = vectorType.GetGenericArguments()[0];
            }

            if (!objectCreators.ContainsKey(vectorType))
            {
                Func <object[], object> creator = CreateObjectBuilder(vectorType, new FieldInfo[0]);

                objectCreators.Add(vectorType, creator);
            }

            var result = objectCreators[vectorType](new object[0]) as IList;

            for (int i = 0; i < count; i++)
            {
                vectorDimension++;
                // i didn't found a way to have thez correct dimension so i just add "- 1"
                result.Add(ReadField(reader, field, field.VectorTypes[vectorDimension - 1].Item1, vectorDimension));
                vectorDimension--;
            }

            return(result);
        }
Exemplo n.º 28
0
        public virtual void Deserialize(BigEndianReader reader)
        {
            byte b = reader.ReadByte();

            this.isOnSale     = BooleanByteWrapper.GetFlag(b, 0);
            this.isSaleLocked = BooleanByteWrapper.GetFlag(b, 1);
            //  this.houseId = reader.ReadInt();
            this.houseId = reader.ReadVarInt();
            if (houseId < 0)
            {
                throw new Exception("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0");
            }
            var limit = reader.ReadUShort();

            doorsOnMap = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                doorsOnMap[i] = reader.ReadInt();
            }
            ownerName = reader.ReadUTF();
            modelId   = reader.ReadVarShort();
            if (modelId < 0)
            {
                throw new Exception("Forbidden value on modelId = " + modelId + ", it doesn't respect the following condition : modelId < 0");
            }
        }
Exemplo n.º 29
0
 public void FromRaw(BigEndianReader raw)
 {
     try
     {
         int header = raw.ReadByte();
         if (header != 69)
         {
             throw new Exception("Unknown file format");
         }
         FileVersion   = raw.ReadByte();
         ElementsCount = raw.ReadUInt();
         ElementsMap   = new Dictionary <int, GraphicalElementData>();
         for (int i = 0; i < ElementsCount; i++)
         {
             int  edId               = raw.ReadInt();
             byte edType             = raw.ReadByte();
             GraphicalElementData ed = GraphicalElementFactory.GetGraphicalElementData(edId, edType);
             ed.FromRaw(raw);
             ElementsMap[edId] = ed;
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"{ex}");
     }
 }
        public override void Deserialize(BigEndianReader reader)
        {
            presetId = reader.ReadSByte();
            if (presetId < 0)
            {
                throw new Exception("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0");
            }
            symbolId = reader.ReadSByte();
            if (symbolId < 0)
            {
                throw new Exception("Forbidden value on symbolId = " + symbolId + ", it doesn't respect the following condition : symbolId < 0");
            }
            var limit = reader.ReadUShort();

            itemsPositions = new byte[limit];
            for (int i = 0; i < limit; i++)
            {
                itemsPositions[i] = reader.ReadByte();
            }
            limit     = reader.ReadUShort();
            itemsUids = new int[limit];
            for (int i = 0; i < limit; i++)
            {
                itemsUids[i] = reader.ReadInt();
            }
        }