Exemplo n.º 1
0
        public void TestGameDataSet(string mapInfoFilePath, GameDataSet expectedDataSet)
        {
            using var mapInfoStream = File.OpenRead(mapInfoFilePath);
            var mapInfo = MapInfo.Parse(mapInfoStream);

            Assert.AreEqual(expectedDataSet, mapInfo.GameDataSet);
        }
Exemplo n.º 2
0
    private void AddList(GameDataSet dataSet, GameDataType dataType, string csvString)
    {
        List <string[]> csvDataList = CsvHelper.FormatCsvToStringArrayList(csvString);

        switch (dataType)
        {
        case GameDataType.USER_ITEM:
            foreach (string[] data in csvDataList)
            {
                if (data == csvDataList[0])
                {
                    continue;
                }
                dataSet.UserItemList.Add(new UserItem(int.Parse(data[0]), int.Parse(data[1]), Convert.ToBoolean(data[2])));
            }
            break;

        case GameDataType.USER_PARAMETER:
            foreach (string[] data in csvDataList)
            {
                if (data == csvDataList[0])
                {
                    continue;
                }
                dataSet.UserParameterList.Add(new UserParameter(int.Parse(data[0]), int.Parse(data[1]), data[2]));
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 3
0
        private void ShowSchemaButton_Click(object sender, EventArgs e)
        {
            StringWriter swXML = new StringWriter();

            GameDataSet.WriteXmlSchema(swXML);
            textBox1.Text = swXML.ToString();
        }
Exemplo n.º 4
0
    public GameDataSet ReadData()
    {
        GameDataSet dataSet = new GameDataSet();

        AddList(dataSet, GameDataType.USER_ITEM, TextFileHelper.Read(Const.Path.GameData.userItem));
        AddList(dataSet, GameDataType.USER_PARAMETER, TextFileHelper.Read(Const.Path.GameData.userParameter));
        return(dataSet);
    }
Exemplo n.º 5
0
        public void TestGameDataSet(string mapInfoFilePath, GameDataSet expectedDataSet)
        {
            using var mapInfoStream = File.OpenRead(mapInfoFilePath);
            using var mapInfoReader = new BinaryReader(mapInfoStream);
            var mapInfo = mapInfoReader.ReadMapInfo();

            Assert.AreEqual(expectedDataSet, mapInfo.GameDataSet);
        }
Exemplo n.º 6
0
        private void ReadXmlButton_Click(object sender, EventArgs e)
        {
            string filePath = @"C:\Users\Simone\Source\Repos\.NET\Blackjack\Blackjack\XML\games.xml";

            GameDataSet.ReadXml(filePath);

            dataGridView1.DataSource = GameDataSet;
            dataGridView1.DataMember = "game";
        }
Exemplo n.º 7
0
    public async Task <GameDataSet> CreateGameSet(
        int nvn, string HostId, string DuelId,
        List <CharCardSet> HostCardList = null, List <CharCardSet> DuelerCardList = null,
        List <EventCard> HostECList     = null, List <EventCard> DuelerECList     = null)
    {
        // if (RoomConn.CurrentRoom == null)throw new System.Exception("NO_ROOM_EXIST");
        if (RoomKey == null)
        {
            throw new System.Exception("NO_ROOM_KEY");
        }
        if (GDSClient == null)
        {
            throw new System.Exception("NO_CLIENT_EXIST");
        }
        if (CurrentGS != null)
        {
            return(CurrentGS);
        }
        try {
            var req = new GDCreateReq {
                RoomKey  = RoomKey,
                HostId   = HostId,
                DuelerId = DuelId,
                Nvn      = nvn,
            };

            if (HostCardList != null)
            {
                req.HostCardDeck.AddRange(HostCardList);
            }
            if (DuelerCardList != null)
            {
                req.DuelCardDeck.AddRange(DuelerCardList);
            }
            if (HostECList != null)
            {
                req.HostExtraEc.AddRange(HostECList);
            }
            if (DuelerECList != null)
            {
                req.DuelExtraEc.AddRange(DuelerECList);
            }

            var tmpGameSet = await GDSClient.CreateGameAsync(req);

            Debug.Log($"{tmpGameSet.CurrPhase}");
            CurrentGS = tmpGameSet;
            return(CurrentGS);
        } catch (RpcException) {
            throw;
        }
    }
Exemplo n.º 8
0
    public List <Item> getWinItemList(GameDataSet gameDataSet)
    {
        List <Item> itemList = new List <Item>();

        var winNode        = getWinNode();
        var itemActionList = winNode.actionList.Where(x => x.actionType == NodeActionType.AddItem);

        foreach (var itemAction in itemActionList)
        {
            itemList.Add(ItemFactory.getItemFromIndex(itemAction.index, gameDataSet));
        }

        return(itemList);
    }
Exemplo n.º 9
0
    public GameDataSet CreateInitialData()
    {
        GameDataSet dataSet = new GameDataSet();

        foreach (Item item in MasterDataManager.Instance.MasterDataSet.ItemList)
        {
            dataSet.UserItemList.Add(new UserItem(dataSet.UserItemList.Count, item.Id, item.InitialIsOwned));
        }
        foreach (Parameter param in MasterDataManager.Instance.MasterDataSet.ParameterList)
        {
            dataSet.UserParameterList.Add(new UserParameter(dataSet.UserParameterList.Count, param.Id, param.InitialValue));
        }
        SaveData(dataSet);
        return(dataSet);
    }
Exemplo n.º 10
0
    public void loadGameData()
    {
        gameDataSet = new GameDataSet();
        gameDataSet.itemDataDictionary         = getDataObjectDictionary("Data/Items", typeof(ItemData)).ToDictionary(x => x.Key, x => (ItemData)x.Value);
        gameDataSet.usableItemDataDictionary   = getDataObjectDictionary("Data/UsableItems", typeof(UsableItemData)).ToDictionary(x => x.Key, x => (UsableItemData)x.Value);
        gameDataSet.weaponDataDictionary       = getDataObjectDictionary("Data/Weapons", typeof(WeaponData)).ToDictionary(x => x.Key, x => (WeaponData)x.Value);
        gameDataSet.rangedWeaponDataDictionary = getDataObjectDictionary("Data/RangedWeapons", typeof(RangedWeaponData)).ToDictionary(x => x.Key, x => (RangedWeaponData)x.Value);
        gameDataSet.ammoDataDictionary         = getDataObjectDictionary("Data/Ammo", typeof(AmmoData)).ToDictionary(x => x.Key, x => (AmmoData)x.Value);
        gameDataSet.armorDataDictionary        = getDataObjectDictionary("Data/Armors", typeof(ArmorData)).ToDictionary(x => x.Key, x => (ArmorData)x.Value);

        gameDataSet.effectDataDictionary        = getDataObjectDictionary("Data/Effects", typeof(EffectData)).ToDictionary(x => x.Key, x => (EffectData)x.Value);
        gameDataSet.abilityDataDictionary       = getDataObjectDictionary("Data/Abilities", typeof(AbilityData)).ToDictionary(x => x.Key, x => (AbilityData)x.Value);
        gameDataSet.gameCharacterDataDictionary = getDataObjectDictionary("Data/GameCharacters", typeof(GameCharacterData)).ToDictionary(x => x.Key, x => (GameCharacterData)x.Value);

        gameDataSet.talentTreeDataDictionary = getDataObjectDictionary("Data/TalentTree", typeof(TalentTreeData)).ToDictionary(x => x.Key, x => (TalentTreeData)x.Value);
    }
Exemplo n.º 11
0
    private StoreItem getSellItem(long itemID, float priceAdjustment, int count, GameDataSet gameDataSet)
    {
        StoreItem storeItem = null;
        Item      i         = ItemFactory.getItemFromIndex(itemID, gameDataSet);

        if (i != null)
        {
            storeItem          = new StoreItem();
            storeItem.item     = i;
            storeItem.count    = count;
            storeItem.price    = (long)Math.Round(i.price * priceAdjustment);
            storeItem.selected = 1;
            return(storeItem);
        }
        return(storeItem);
    }
 public void LoadGameData(GameDataSet ds, LogRecorderInterface log)
 {
     try
     {
         ds.Clear();
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM HashList", GetConnection()))
             adpt.Fill(ds.HashList);
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM HardPointList", GetConnection()))
             adpt.Fill(ds.HardPointList);
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM EquipInfoList", GetConnection()))
             adpt.Fill(ds.EquipInfoList);
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM ShipInfoList", GetConnection()))
             adpt.Fill(ds.ShipInfoList);
     }
     catch (Exception e)
     {
         log.AddLog(String.Format("Error '{0}' when updating db", e.Message));
     }
 }
Exemplo n.º 13
0
    //given a gameDataSet, and global flags, return the list of items (and prices) sold
    //dont return items with 0 price (specials, etc)
    public List <StoreItem> getSellList(GameDataSet gameDataSet, Random r)
    {
        List <StoreItem> storeList = new List <StoreItem>();

        var infoNode = treeNodeDictionary[1];

        foreach (var branch in infoNode.getBranchList(this))
        {
            StoreTreeNode storeNode = (StoreTreeNode)this.getNode(branch.linkIndex);
            if (storeNode.content.nodeType == StoreNodeType.ItemClass)
            {
                storeList.AddRange(getSellItemTypeList(storeNode.content.itemType, storeNode.content.sellPrice, storeNode.content.count, storeNode.content.linkIndex, gameDataSet, r));
            }
            else if (storeNode.content.nodeType == StoreNodeType.ItemIndex)
            {
                storeList.Add(getSellItem(storeNode.content.linkIndex, storeNode.content.sellPrice, storeNode.content.count, gameDataSet));
            }
        }
        return(storeList);
    }
Exemplo n.º 14
0
    private List <StoreItem> getStoreItemListFromItemIdList(List <long> itemIdList, GameDataSet gameDataSet, int count, float priceAdjustment)
    {
        List <StoreItem> storeItemList = new List <StoreItem>();

        foreach (long id in itemIdList)
        {
            var item = ItemFactory.getItemFromIndex(id, gameDataSet);
            if (item.price > 0)
            {
                StoreItem tempStoreItem = new StoreItem();
                tempStoreItem.item     = item;
                tempStoreItem.count    = count;
                tempStoreItem.price    = (long)Math.Round(tempStoreItem.item.price * priceAdjustment);
                tempStoreItem.selected = 1;

                storeItemList.Add(tempStoreItem);
            }
        }

        return(storeItemList);
    }
Exemplo n.º 15
0
    public async Task <GameDataSet> GetGameData(string roomKey, bool isWatcher)
    {
        if (GDSClient == null)
        {
            throw new System.Exception("NO_CLIENT_EXIST");
        }
        // if (RoomKey == null || RoomKey == "")throw new System.Exception("NO_ROOM_KEY");

        try {
            var req = new GDGetInfoReq {
                RoomKey   = roomKey == null ? RoomKey : roomKey,
                IsWatcher = isWatcher,
            };
            var tmpGameSet = await GDSClient.GetGameDataAsync(req);

            CurrentGS = tmpGameSet;
            return(CurrentGS);
        } catch (RpcException) {
            throw;
        }
    }
Exemplo n.º 16
0
    //lookup the item in the store list and return the price, otherwise default to .5f
    public long getBuyPrice(Item i, GameDataSet gameDataSet)
    {
        float buyPrice = 0.0f;

        var infoNode = treeNodeDictionary[1];
        List <StoreTreeNode> storeNodeList = new List <StoreTreeNode>();

        foreach (var branch in infoNode.getBranchList(this))
        {
            var storeNode = (StoreTreeNode)this.getNode(branch.linkIndex);

            if (storeNode.content.nodeType == StoreNodeType.ItemIndex)
            {
                if (storeNode.content.linkIndex == i.ID)
                {
                    if (storeNode.content.buyPrice > buyPrice)
                    {
                        buyPrice = storeNode.content.buyPrice;
                    }
                }
            }
            else if (storeNode.content.nodeType == StoreNodeType.ItemClass)
            {
                if (storeNode.content.itemType == i.type && i.price <= storeNode.content.linkIndex)
                {
                    if (storeNode.content.buyPrice > buyPrice)
                    {
                        buyPrice = storeNode.content.buyPrice;
                    }
                }
            }
        }

        if (buyPrice < .5)
        {
            buyPrice = .5f;
        }

        return((long)Math.Round(i.price * buyPrice));
    }
 public void CommitGameData(GameDataSet ds, LogRecorderInterface log)
 {
     try
     {
         BeginTransaction();
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM HashList", GetConnection()))
         {
             SQLiteCommandBuilder builder = new SQLiteCommandBuilder(adpt);
             builder.ConflictOption = ConflictOption.OverwriteChanges;
             adpt.Update(ds.HashList);
         }
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM HardPointList", GetConnection()))
         {
             SQLiteCommandBuilder builder = new SQLiteCommandBuilder(adpt);
             builder.ConflictOption = ConflictOption.OverwriteChanges;
             adpt.Update(ds.HardPointList);
         }
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM EquipInfoList", GetConnection()))
         {
             SQLiteCommandBuilder builder = new SQLiteCommandBuilder(adpt);
             builder.ConflictOption = ConflictOption.OverwriteChanges;
             adpt.Update(ds.EquipInfoList);
         }
         using (SQLiteDataAdapter adpt = new SQLiteDataAdapter("SELECT * FROM ShipInfoList", GetConnection()))
         {
             SQLiteCommandBuilder builder = new SQLiteCommandBuilder(adpt);
             builder.ConflictOption = ConflictOption.OverwriteChanges;
             adpt.Update(ds.ShipInfoList);
         }
         EndTransaction();
     }
     catch (Exception e)
     {
         log.AddLog(String.Format("Error '{0}' when updating db", e.Message));
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// Scans the specified directory and recursively search for ini files that appear to contain
        /// hashcodes.
        /// </summary>
        /// <param name="flDataPath"></param>
        /// <param name="iniFilePath"></param>
        /// <remarks>Not used any more</remarks>
        private void ScanForHashCodes(GameDataSet dataStore, string flDataPath, BackgroundWorker bgw, LogRecorderInterface log)
        {
            // Scan the ini files.    
            string[] iniFiles = Directory.GetFiles(flDataPath, "*.ini");
            for (int i=0; i<iniFiles.Length; i++)
            {
                if (bgw.CancellationPending)
                    return;

                string filePath = iniFiles[i];
                bgw.ReportProgress(((i * 100) / iniFiles.Length), "Scanning " + filePath.Substring(flDataPath.Length + 1) + "...");
                try
                {
                    FLDataFile ini = new FLDataFile(filePath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        foreach (FLDataFile.Setting e in section.settings)
                        {
                            if (e.NumValues() == 0)
                                continue;

                            string st = e.settingName.ToLowerInvariant();
                            if (st == "nickname" || st == "archetype" || st == "loadout"
                                || st == "explosion_arch" || st == "fuse" || st == "zone"
                                || st == "name" || st == "room" || st == "prop"
                                || st == "msg_id_prefix" || st == "npc")
                            {
                                string nickName = e.Str(0);
                                uint hashU = FLUtility.CreateID(nickName.ToLowerInvariant());
                                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                                if (conflictingEntry == null)
                                {
                                    string keys = hashU.ToString() + " 0x" + hashU.ToString("X");
                                    dataStore.HashList.AddHashListRow(hashU, nickName, GAMEDATA_GEN, "", "", "", "", "", keys);
                                }
                            }

                            /* for (int j = 0; j < e.NumValues(); j++)
                            {
                                string nickName = e.Str(j);
                                uint hashU = FLUtility.CreateID(nickName.ToLowerInvariant());
                                string keys = hashU.ToString() + " 0x" + hashU.ToString("X");
                                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                                if (conflictingEntry == null)
                                {
                                    dataStore.HashList.AddHashListRow(hashU, nickName, GAMEDATA_GEN, "", "", "", "", "");
                                }
                            } */                       
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.AddLog(String.Format("Error '{0}' when scanning {1}", ex.Message, filePath));
                }
            }
            
            // Recurse through subdirectories.
            string[] dataDirs = Directory.GetDirectories(flDataPath);
            for (int i = 0; i < dataDirs.Length; i++ )
            {
                ScanForHashCodes(dataStore, dataDirs[i], bgw, log);
            }
        }
Exemplo n.º 19
0
    public void CreateInitialData()
    {
        GameDataLoader dataLoader = new GameDataLoader();

        GameDataSet = dataLoader.CreateInitialData();
    }
Exemplo n.º 20
0
    public void UpdateData()
    {
        GameDataLoader dataLoader = new GameDataLoader();

        GameDataSet = dataLoader.ReadData();
    }
Exemplo n.º 21
0
 public FLGameData()
 {
     DataStore = new GameDataSet();
 }
Exemplo n.º 22
0
    //returning a random list of items of type at less than rarityIndex (price)
    private List <StoreItem> getSellItemTypeList(ItemType type, float priceAdjustment, int count, long rarityIndex, GameDataSet gameDataSet, Random r)
    {
        List <StoreItem> storeItemList = new List <StoreItem>();
        var itemCount = r.Next(9) + 1;    //TODO: Do we want this hardcoded here?

        switch (type)
        {
        case ItemType.Weapon:
            List <long> weaponIdList = gameDataSet.weaponDataDictionary.Where(x => x.Value.price <= rarityIndex).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(weaponIdList, gameDataSet, count, priceAdjustment));
            break;

        case ItemType.Ammo:
            List <long> ammoIdList = gameDataSet.ammoDataDictionary.Where(x => x.Value.price <= rarityIndex).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(ammoIdList, gameDataSet, count, priceAdjustment));
            break;

        case ItemType.Armor:
            List <long> armorIdList = gameDataSet.armorDataDictionary.Where(x => x.Value.price <= rarityIndex).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(armorIdList, gameDataSet, count, priceAdjustment));
            break;

        case ItemType.Potion:
            List <long> potionIdList = gameDataSet.usableItemDataDictionary.Where(x => x.Value.price <= rarityIndex && x.Value.type == ItemType.Potion).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(potionIdList, gameDataSet, count, priceAdjustment));
            break;

        case ItemType.Thrown:
            List <long> thrownIdList = gameDataSet.usableItemDataDictionary.Where(x => x.Value.price <= rarityIndex && x.Value.type == ItemType.Thrown).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(thrownIdList, gameDataSet, count, priceAdjustment));
            break;

        case ItemType.Wand:
            List <long> wandIdList = gameDataSet.usableItemDataDictionary.Where(x => x.Value.price <= rarityIndex && x.Value.type == ItemType.Wand).Select(x => x.Key).OrderBy(x => r.Next()).Take(itemCount).ToList();
            storeItemList.AddRange(getStoreItemListFromItemIdList(wandIdList, gameDataSet, count, priceAdjustment));
            break;

        default:
            break;
        }

        return(storeItemList);
    }
Exemplo n.º 23
0
 public static void SaveData(GameDataSet dataSet)
 {
     TextFileHelper.Write(Const.Path.GameData.userItem, CsvHelper.FormatListToCsv(dataSet.UserItemList));
     TextFileHelper.Write(Const.Path.GameData.userParameter, CsvHelper.FormatListToCsv(dataSet.UserParameterList));
 }
Exemplo n.º 24
0
        private bool AddGameData(GameDataSet.HashListDataTable items, FLDataFile.Section section, string gameDataType, bool ignoreEntriesWithNoIds)
        {
            string nickName = section.GetSetting("nickname").Str(0);
            
            string stIDSName = GetIDSParm(section, "ids_name");
            if (stIDSName == "")
                stIDSName = GetIDSParm(section, "strid_name");

            if (ignoreEntriesWithNoIds && stIDSName == "")
                return false;

            uint hash = FLUtility.CreateID(nickName.ToLowerInvariant());
            if (gameDataType == GAMEDATA_FACTIONS)
                hash = FLUtility.CreateFactionID(nickName);

            GameDataSet.HashListRow conflictingHashEntry = items.FindByItemHash(hash);
            if (conflictingHashEntry != null)
                return false;

            string stIDSInfo = GetIDSParm(section, "ids_info");
            
            string stIDSInfo1 = GetIDSParm(section, "ids_info1");
            if (stIDSInfo1 == "")
                stIDSInfo1 = GetIDSParm(section, "ids_short_name");

            string stIDSInfo2 = GetIDSParm(section, "ids_info2");
            string stIDSInfo3 = GetIDSParm(section, "ids_info3");

            string keys = hash.ToString() + " 0x" + hash.ToString("X");

            items.AddHashListRow(hash, nickName, gameDataType, stIDSName, stIDSInfo, stIDSInfo1, stIDSInfo2, stIDSInfo3, keys);
            return true;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Load room hash codes from base ini data.
        /// </summary>
        /// <param name="baseIniPath"></param>
        private void LoadRoomData(GameDataSet dataStore, string baseNick, string baseIniPath)
        {
            FLDataFile iniRoom = new FLDataFile(baseIniPath, true);
            foreach (FLDataFile.Section section in iniRoom.sections)
            {
                if (section.sectionName.ToLowerInvariant() != "room")
                    continue;

                string locationNick = FLUtility.CreateID(baseNick.ToLowerInvariant()).ToString("x")
                    + "_" + section.GetSetting("nickname").Str(0).ToLowerInvariant();

                uint hashU = FLUtility.CreateID(locationNick.ToLowerInvariant());
                string keys = hashU.ToString() + " 0x" + hashU.ToString("X");

                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                if (conflictingEntry == null)
                {
                    dataStore.HashList.AddHashListRow(hashU, locationNick, GAMEDATA_ROOM, GetItemDescByNickNameX(baseNick), "", "", "", "", keys);
                }
            }   
        }
Exemplo n.º 26
0
        /// <summary>
        /// Load an ion cross game data file that has a nickname key
        /// </summary>
        /// <param name="items">The database to copy data into</param>
        /// <param name="ioncrossDir">The file </param>
        /// <param name="hashFile"></param>
        private void LoadIonCrossNickNameDesc(GameDataSet.HashListDataTable items, string filePath, LogRecorderInterface log, bool isFaction)
        {
            try
            {
                FLDataFile ini = new FLDataFile(filePath, false);
                foreach (FLDataFile.Section s in ini.sections)
                {
                    foreach (FLDataFile.Setting setting in s.settings)
                    {
                        try
                        {
                            GameDataSet.HashListRow itemRecord = GetItemByNickName(setting.settingName.ToLowerInvariant());
                            if (isFaction)
                                itemRecord = GetItemByFactionNickName(setting.settingName.ToLowerInvariant());

                            if (itemRecord != null)
                            {
                                if (setting.NumValues() > 0)
                                    itemRecord.IDSName = setting.Str(0);
                            }
                        }
                        catch (Exception ex)
                        {
                            log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, setting.desc));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, filePath));
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// Load a ion cross game data file that has a hash key
 /// </summary>
 /// <param name="items">The database to copy data into</param>
 /// <param name="ioncrossDir">The file </param>
 /// <param name="hashFile"></param>
 private void LoadIonCrossHashDesc(GameDataSet.HashListDataTable items, string filePath, LogRecorderInterface log)
 {
     try
     {
         FLDataFile ini = new FLDataFile(filePath, true);
         foreach (FLDataFile.Section s in ini.sections)
         {
             foreach (FLDataFile.Setting setting in s.settings)
             {
                 try
                 {
                     GameDataSet.HashListRow itemRecord = GetItemByNickName(setting.settingName);
                     if (itemRecord == null)
                         itemRecord = GetItemByHash(Convert.ToUInt32(setting.settingName));
                     if (itemRecord != null)
                     {
                         if (setting.NumValues() > 1)
                             itemRecord.IDSName = setting.Str(1);
                         else if (setting.NumValues() > 0)
                             itemRecord.IDSName = setting.Str(0);
                     }
                 }
                 catch (Exception ex)
                 {
                     log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, setting.desc));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, filePath));
     }
 }