Пример #1
0
    public static List <BonusMultConfig> ParseMiniMilestones(string filename)
    {
        IEnumerable <string[]> source = TSVParser.Parse(filename).Skip(1);

        return((from line in source
                select BonusMultParser.ParseBonusMultConfig(line[0])).ToList());
    }
Пример #2
0
    public static ChunkMapConfig ParseChunkMap(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text);
        List <int[]>           list   = new List <int[]>();

        for (int i = 0; i < source.Count(); i++)
        {
            for (int j = 0; j < source.ElementAt(i).Length; j++)
            {
                int num = source.ElementAt(i).asInt(j, source.ElementAt(i).toError <int>());
                if (num > 0)
                {
                    list.Add(new int[4]
                    {
                        j - 5,
                        0,
                        8 - i,
                        num
                    });
                }
            }
        }
        ChunkMapConfig chunkMapConfig = new ChunkMapConfig();

        chunkMapConfig.SetChunkMap(list);
        return(chunkMapConfig);
    }
Пример #3
0
    private void Parse(string text, ref List <string> languages, ref Dictionary <string, string> texts)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text + "\t");

        languages = (from s in source.First().Skip(1)
                     select s.Trim() into s
                     where s != "Description"
                     select s).ToList();
        string text2 = Language();
        int    num   = m_supportedLanguages.IndexOf(text2) + 1;

        PlayerData.Instance.Language = text2;
        foreach (string[] item in from r in source.Skip(1)
                 where r[0] != string.Empty
                 select r)
        {
            try
            {
                texts.Add(item[0], item[num]);
            }
            catch (Exception ex)
            {
                UnityEngine.Debug.LogError("Unable to get localized: " + string.Join(",", item) + "|index: " + num + ", len: " + item.Length + ", exception: " + ex.Message);
            }
        }
        texts.Add(string.Empty, string.Empty);
    }
Пример #4
0
    public static List <GamblingConfig> ParseGamblings(string text)
    {
        List <RewardEnum>      rewardTypes = ParseRewardTypes(text);
        IEnumerable <string[]> source      = TSVParser.Parse(text).Skip(1);

        return(source.Select(delegate(string[] line)
        {
            GamblingConfig gamblingConfig = new GamblingConfig
            {
                Level = line.asInt(0, line.toError <int>()),
                FailChance = line.asFloat(1, line.toError <float>())
            };
            List <WeightedObject <RewardData> > list = new List <WeightedObject <RewardData> >();
            for (int i = 2; i < line.Length; i++)
            {
                RewardEnum type = rewardTypes[i - 2];
                AmountAndWeight amountAndWeight = line.asCustom(i, AmountAndWeightParser.ParseAmountAndWeight, line.toError <AmountAndWeight>());
                WeightedObject <RewardData> item = new WeightedObject <RewardData>
                {
                    Value = new RewardData(type, amountAndWeight.Amount),
                    Weight = amountAndWeight.Weight
                };
                list.Add(item);
            }
            gamblingConfig.Rewards = list;
            return gamblingConfig;
        }).ToList());
    }
Пример #5
0
        public static void GenerateCreateScript()
        {
            SQLServerAccessor accessor = new SQLServerAccessor();

            string tsvfilepath = @"D:\repository\Mitutor\DBSourceData\ScoreScripts.tsv";
            string csvfilepath = "D:\\hackson\\TABot\\TABot\\DBSourceData\\PSAScheduleData2.csv";

            //CSVParser parser = new CSVParser(csvfilepath);
            TSVParser     parser = new TSVParser(tsvfilepath);
            DBTableSchema schema = parser.ParserSchema();

            string createtablestr = parser.GenerateSQLQueryForCreateTable(schema);

            Console.WriteLine(createtablestr);

            //accessor.ExecSQL(createtablestr);

            List <string> insertList = parser.GenerateSQLQueryForInsertRow(schema);
            StringBuilder builder    = new StringBuilder();

            foreach (string line in insertList)
            {
                builder.AppendLine(line);
                Console.WriteLine(line);
            }

            accessor.ExecSQL(builder.ToString());
        }
Пример #6
0
    public static List <PlayerGoalConfig> ParsePlayerGoals(string file, bool tutorial)
    {
        List <string[]>         list  = TSVParser.Parse(file).Skip(1).ToList();
        List <PlayerGoalConfig> list2 = new List <PlayerGoalConfig>();

        for (int i = 0; i < list.Count; i++)
        {
            string[]         array            = list[i];
            PlayerGoalConfig playerGoalConfig = new PlayerGoalConfig();
            playerGoalConfig.ID           = array.asString(0, array.toError <string>());
            playerGoalConfig.Index        = i;
            playerGoalConfig.AppleID      = array.asString(1, array.toError <string>());
            playerGoalConfig.GoogleID     = array.asString(2, array.toError <string>());
            playerGoalConfig.Task         = array.asEnum(3, array.toError <PlayerGoalTask>());
            playerGoalConfig.Parameter    = ParseTaskParameter(array, 4, playerGoalConfig.Task);
            playerGoalConfig.HeroLevelReq = array.asInt(5, array.toError <int>());
            for (int j = 0; j < 5; j++)
            {
                playerGoalConfig.StarReq[j] = array.asBigDouble(6 + j, array.toError <BigDouble>());
            }
            playerGoalConfig.IsTutorialGoal = tutorial;
            list2.Add(playerGoalConfig);
        }
        return(list2);
    }
Пример #7
0
    public static List <GearConfig> ParseGears(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new GearConfig
        {
            GearIndex = line.asInt(0, line.toError <int>()),
            Category = line.asEnum(2, line.toError <GearCategory>()),
            UpgradeCostA = line.asFloat(4, line.toError <float>()),
            UpgradeCostB = line.asFloat(5, line.toError <float>()),
            UpgradeCostC = line.asFloat(6, line.toError <float>()),
            MaxLevel = line.asInt(7, line.toError <int>()),
            Boost1 = new GearBoostStruct
            {
                Mult = line.asCustom(8, BonusMultParser.ParseBonusMultConfig, line.toError <BonusMultConfig>()),
                Operator = line.asEnum(9, line.toError <BoostOperatorEnum>()),
                LevelUpAmount = line.asFloat(10, line.toError <float>())
            },
            Boost2 = new GearBoostStruct
            {
                Mult = line.asCustom(11, BonusMultParser.ParseBonusMultConfig, line.toError <BonusMultConfig>()),
                Operator = line.asEnum(12, line.toError <BoostOperatorEnum>()),
                LevelUpAmount = line.asFloat(13, line.toError <float>())
            }
        }).ToList());
    }
Пример #8
0
        public static void GenerateCreateScript()
        {
            SQLServerAccessor accessor = new SQLServerAccessor();

            string tsvfilepath = "d:\\data\\ta\\IntelligenceRoute.tsv";
            //"d:\\data\\ta\\Examination.tsv";//"C:\\WS\\OfficialAccountBotExtension\\Hackthon\\TABot\\DBSourceData\\Calculator3.tsv";

            string csvfilepath = "C:\\WS\\OfficialAccountBotExtension\\Hackthon\\TABot\\DBSourceData\\PSAScheduleData2.csv";
            // "C:\\WS\\OfficialAccountBotExtension\\Hackthon\\TABot\\DBSourceData\\PSANotificationData.csv";
            // "C:\\WS\\OfficialAccountBotExtension\\Hackthon\\TABot\\DBSourceData\\PSAESCachedObject.csv";

            //CSVParser parser = new CSVParser(csvfilepath);
            TSVParser     parser = new TSVParser(tsvfilepath);
            DBTableSchema schema = parser.ParserSchema();

            string createtablestr = parser.GenerateSQLQueryForCreateTable(schema);

            Console.WriteLine(createtablestr);

            accessor.ExecSQL(createtablestr);

            List <string> insertList = parser.GenerateSQLQueryForInsertRow(schema);
            StringBuilder builder    = new StringBuilder();

            foreach (string line in insertList)
            {
                builder.AppendLine(line);
                Console.WriteLine(line);
            }

            accessor.ExecSQL(builder.ToString());
        }
Пример #9
0
        public override void Parse(TextReader reader, WorldCollection worlds, ErrorLogger?errors)
        {
            TSVParser parser = new TSVParser(reader);

            foreach (var row in parser.Data)
            {
                ParseWorld(worlds, row.dict, row.line, row.lineNumber, errors);
            }
        }
Пример #10
0
    public static List <DrillConfig> ParseDrills(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new DrillConfig
        {
            Level = line.asInt(0, line.toError <int>()),
            Reward = ParseRewardOrNull(line[1])
        }).ToList());
    }
Пример #11
0
    public static List <WeightedObject <RewardData> > ParseGiftRewards(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new WeightedObject <RewardData>
        {
            Value = RewardParser.ParseReward(line[0]),
            Weight = line.asInt(1, line.toError <int>())
        }).ToList());
    }
Пример #12
0
    public static List <GpuPerfData> ParseGpuPerf(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return(source.Select(delegate(string[] line)
        {
            string gpu = line.asString(0, line.toError <string>());
            GpuPerfEnum perf = line.asEnum(1, line.toError <GpuPerfEnum>());
            return new GpuPerfData(gpu, perf);
        }).ToList());
    }
Пример #13
0
    public static List <RankConfig> ParseRanks(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new RankConfig
        {
            Tier = line.asInt(0, line.toError <int>()),
            Rank = line.asEnum(1, line.toError <RankEnum>())
        }).ToList());
    }
Пример #14
0
    public static List <BundleTierConfig> ParseBundleTiers(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new BundleTierConfig
        {
            ProductEnum = line.asEnum(0, line.toError <IAPProductEnum>()),
            BundleTier = line.asInt(1, line.toError <int>())
        }).ToList());
    }
Пример #15
0
    public static List <WeightedObject <ChestRewardConfig> > ParseChests(string text, ChestEnum chest)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new WeightedObject <ChestRewardConfig>
        {
            Value = new ChestRewardConfig(line.asCustom(0, RewardParser.ParseReward, line.toError <RewardData>()), line.asEnum(1, line.toError <RarityEnum>())),
            Weight = line.asFloat((int)(chest + 2), line.toError <float>())
        }).ToList());
    }
Пример #16
0
    public static List <PlayerGoalRewards> ParseRewards(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new PlayerGoalRewards
        {
            Stars = line.asInt(0, line.toError <int>()),
            GemReward = line.asInt(1, line.toError <int>())
        }).ToList());
    }
Пример #17
0
    public static List <ZoneMapping> parseZoneMapping(string configName)
    {
        IEnumerable <string[]> source = TSVParser.Parse(PersistentSingleton <StringCache> .Instance.Get(configName)).Skip(1);

        return((from line in source
                select new ZoneMapping
        {
            Zone = line.asString(0, line.toError <string>()),
            Id = line.asString(1, line.toError <string>())
        }).ToList());
    }
Пример #18
0
    public static List <GearSet> ParseGearSets(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new GearSet
        {
            SetIndex = line.asInt(0, line.toError <int>()),
            ChunkUnlockLevel = line.asInt(1, line.toError <int>()),
            Bonus = line.asCustom(2, BonusMultParser.ParseBonusMultConfig, line.toError <BonusMultConfig>())
        }).ToList());
    }
Пример #19
0
    public static List <TournamentTierConfig> ParseTournamentTiers(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text + "\t").Skip(1);

        return((from line in source
                select new TournamentTierConfig
        {
            Tier = line.asEnum(0, line.toError <TournamentTier>()),
            Bonus = BonusMultParser.ParseBonusMultConfig(line[1]),
            Requirement = line.asInt(2, line.toError <int>())
        }).ToList());
    }
Пример #20
0
    public static List <AdFrequencyConfig> ParseAdFrequencies(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new AdFrequencyConfig
        {
            Placement = line.asEnum(0, line.toError <AdPlacement>()),
            DailyCap = line.asInt(1, line.toError <int>()),
            Cooldown = line.asInt(2, line.toError <int>())
        }).ToList());
    }
Пример #21
0
    public static List <TierConfig> ParseTiers(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new TierConfig
        {
            Tier = line.asInt(0, line.toError <int>()),
            BerryReq = line.asInt(1, line.toError <int>()),
            DamageMult = line.asFloat(2, line.toError <float>())
        }).ToList());
    }
        public void HeadersCount()
        {
            string path      = Path.Combine(RootFolder, @"Example Data\CorrectExample.tsv");
            var    validator = new TSVValidator(path);
            bool   valid     = validator.IsValid();

            Assert.True(valid);

            ITSVParser parser = new TSVParser(validator.TSVContent);
            TSVData    data   = parser.Parse();

            Assert.IsTrue(data.Headers.Count == 8);
        }
Пример #23
0
    public static List <BoosterConfig> ParseBoosters(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new BoosterConfig
        {
            BoosterID = line.asString(0, line.toError <string>()),
            InitialGemCost = line.asInt(1, line.toError <int>()),
            GemCostIncrease = line.asInt(2, line.toError <int>()),
            RewardAmount = line.asCustom(3, BoosterRewardAmountParser.ParseBoosterRewardAmount, line.toError <float>())
        }).ToList());
    }
Пример #24
0
    public static List <SkillConfig> ParseSkills(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new SkillConfig
        {
            Name = line.asString(0, line.toError <string>()),
            DurationSeconds = line.asInt(1, line.toError <int>()),
            CoolDownSeconds = line.asInt(2, line.toError <int>()),
            LevelReq = line.asInt(3, line.toError <int>())
        }).ToList());
    }
Пример #25
0
        private static TSVData ReadTSV(string path)
        {
            var  validator      = new TSVValidation.TSVValidator(path);
            bool isTSVFileValid = validator.IsValid();

            if (isTSVFileValid)
            {
                ITSVParser parser = new TSVParser(validator.TSVContent);
                TSVData    data   = parser.Parse();
                return(data);
            }
            throw new Exception("Invalid TSV file.");
        }
Пример #26
0
    public static List <CraftingMaterialConfig> ParseCraftingMaterial(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return((from line in source
                select new CraftingMaterialConfig
        {
            GearIndex = line.asInt(0, line.toError <int>()),
            JellyStartingpoint = line.asInt(1, line.toError <int>()),
            Material1 = ParseMaterialOrNull(line[2]),
            Material2 = ParseMaterialOrNull(line[3]),
            Material3 = ParseMaterialOrNull(line[4])
        }).ToList());
    }
Пример #27
0
    public static List <int> ParsePerkMilestonesLevels(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text);

        return(source.Take(1).Select(delegate(string[] line)
        {
            List <int> list = new List <int>();
            for (int i = 1; i < line.Length; i++)
            {
                list.Add(line.asInt(i, line.toError <int>()));
            }
            return list;
        }).First());
    }
Пример #28
0
    private static List <RewardEnum> ParseRewardTypes(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text);

        return(source.Take(1).Select(delegate(string[] line)
        {
            List <RewardEnum> list = new List <RewardEnum>();
            for (int i = 2; i < line.Length; i++)
            {
                list.Add(line.asEnum(i, line.toError <RewardEnum>()));
            }
            return list;
        }).First());
    }
Пример #29
0
    private void ParseOverwrite(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text + "\t");
        string item = Language();
        int    num  = m_supportedLanguages.IndexOf(item) + 1;

        foreach (string[] item2 in from r in source.Skip(1)
                 where r[0] != string.Empty
                 select r)
        {
            if (m_texts.ContainsKey(item2[0]) && item2.Length > num && item2[num] != string.Empty)
            {
                m_texts[item2[0]] = item2[num];
            }
        }
    }
Пример #30
0
    public static List <XPromoConfig> ParseXpromo(string text)
    {
        IEnumerable <string[]> source = TSVParser.Parse(text).Skip(1);

        return(source.Select(delegate(string[] line)
        {
            string id = line.asString(0, line.toError <string>());
            string appName = line.asString(1, line.toError <string>());
            string iosApp = line.asString(2, line.toError <string>());
            string pkgId = line.asString(3, line.toError <string>());
            string launchUrl = line.asString(4, line.toError <string>());
            string webUrl = line.asString(5, line.toError <string>());
            string appsFlyerUrl = line.asString(6, line.toError <string>());
            return new XPromoConfig(id, appName, iosApp, pkgId, launchUrl, webUrl, appsFlyerUrl);
        }).ToList());
    }