コード例 #1
0
        private List <Accessory> Fetch()
        {
            var accessories = new List <Accessory>();

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            using (var excelPackage = new ExcelPackage(new FileInfo(this._sourceFiile)))
            {
                var worksheet = excelPackage.Workbook.Worksheets["Accessories"];

                for (var i = 2; i <= worksheet.Dimension.End.Row; ++i)
                {
                    var accessory = new Accessory()
                    {
                        Name          = worksheet.Cells[i, 3].GetValue <string>(),
                        Description   = worksheet.Cells[i, 4].GetValue <string>(),
                        AccessoryType = (AccessoryTypes)Enum.Parse(typeof(AccessoryTypes), worksheet.Cells[i, 2].GetValue <string>()),
                        Tag           = worksheet.Cells[i, 1].GetValue <string>(),
                    };

                    accessory.Id = GuidHelpers.Create(accessory.Tag);

                    accessories.Add(accessory);
                }
            }

            return(accessories);
        }
コード例 #2
0
        private List <Item> Fetch()
        {
            var items = new List <Item>();

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            using (var excelPackage = new ExcelPackage(new FileInfo(this._sourceFiile)))
            {
                var worksheet = excelPackage.Workbook.Worksheets["Items"];

                for (var i = 2; i <= worksheet.Dimension.End.Row; ++i)
                {
                    var item = new Item()
                    {
                        Name        = worksheet.Cells[i, 1].GetValue <string>(),
                        Description = worksheet.Cells[i, 2].GetValue <string>(),
                    };

                    item.Id = GuidHelpers.Create(item.Name);

                    items.Add(item);
                }
            }

            return(items);
        }
コード例 #3
0
        private List <Hero> Fetch()
        {
            var heroes = new List <Hero>();

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            using (var excelPackage = new ExcelPackage(new FileInfo(this._sourceFiile)))
            {
                var worksheet = excelPackage.Workbook.Worksheets["Heroes"];

                for (var i = 2; i <= worksheet.Dimension.End.Row; ++i)
                {
                    var hero = new Hero()
                    {
                        Name                   = worksheet.Cells[i, 7].GetValue <string>(),
                        Title                  = worksheet.Cells[i, 8].GetValue <string>(),
                        Description            = worksheet.Cells[i, 9].GetValue <string>(),
                        Gender                 = (Genders)Enum.Parse(typeof(Genders), worksheet.Cells[i, 2].GetValue <string>()),
                        Origin                 = worksheet.Cells[i, 10].GetValue <string>(),
                        AdditionDate           = worksheet.Cells[i, 11].GetValue <DateTime>(),
                        ReleaseDate            = worksheet.Cells[i, 12].GetValue <DateTime>(),
                        Color                  = (Colors)Enum.Parse(typeof(Colors), worksheet.Cells[i, 3].GetValue <string>()),
                        Weapon                 = (Weapons)Enum.Parse(typeof(Weapons), worksheet.Cells[i, 4].GetValue <string>()),
                        MovementType           = (MovementTypes)Enum.Parse(typeof(MovementTypes), worksheet.Cells[i, 5].GetValue <string>()),
                        BVID                   = int.Parse(worksheet.Cells[i, 13].GetValue <string>(), NumberStyles.HexNumber),
                        BaseHitPoints          = worksheet.Cells[i, 14].GetValue <int>() - 2,
                        HitPointsGrowthRate    = worksheet.Cells[i, 15].GetValue <int>(),
                        BaseAttack             = worksheet.Cells[i, 16].GetValue <int>() - 2,
                        AttackGrowthRate       = worksheet.Cells[i, 17].GetValue <int>(),
                        BaseSpeed              = worksheet.Cells[i, 18].GetValue <int>() - 2,
                        SpeedGrowthRate        = worksheet.Cells[i, 19].GetValue <int>(),
                        BaseDefense            = worksheet.Cells[i, 20].GetValue <int>() - 2,
                        DefenseGrowthRate      = worksheet.Cells[i, 21].GetValue <int>(),
                        BaseResistance         = worksheet.Cells[i, 22].GetValue <int>() - 2,
                        ResistanceGrowthRate   = worksheet.Cells[i, 23].GetValue <int>(),
                        IsDuoHero              = worksheet.Cells[i, 24].GetValue <bool>(),
                        IsLegendaryHero        = worksheet.Cells[i, 25].GetValue <bool>(),
                        IsMythicHero           = worksheet.Cells[i, 26].GetValue <bool>(),
                        IsResplendentHero      = worksheet.Cells[i, 27].GetValue <bool>(),
                        Element                = string.IsNullOrEmpty(worksheet.Cells[i, 28].GetValue <string>()) ? (Elements?)null :  (Elements)Enum.Parse(typeof(Elements), worksheet.Cells[i, 28].GetValue <string>()),
                        LegendaryHeroBoostType = string.IsNullOrEmpty(worksheet.Cells[i, 29].GetValue <string>()) ? (LegendaryHeroBoostTypes?)null :  (LegendaryHeroBoostTypes)Enum.Parse(typeof(LegendaryHeroBoostTypes), worksheet.Cells[i, 29].GetValue <string>()),
                        MythicHeroBoostType    = string.IsNullOrEmpty(worksheet.Cells[i, 30].GetValue <string>()) ? (MythicHeroBoostTypes?)null : (MythicHeroBoostTypes)Enum.Parse(typeof(MythicHeroBoostTypes), worksheet.Cells[i, 30].GetValue <string>()),
                        Tag = worksheet.Cells[i, 1].GetValue <string>(),
                    };

                    var artist = this._artistMap[
                        worksheet.Cells[i, 6].GetValue <string>().ToLower()
                                 ];

                    hero.ArtistId = artist.Id;

                    hero.Id = GuidHelpers.Create(hero.Tag);

                    heroes.Add(hero);
                }
            }

            return(heroes);
        }
コード例 #4
0
        private List <Skill> Fetch()
        {
            var skills = new List <Skill>();

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            using (var excelPackage = new ExcelPackage(new FileInfo(this._sourceFiile)))
            {
                var worksheet = excelPackage.Workbook.Worksheets["Skills"];

                for (var i = 2; i <= worksheet.Dimension.End.Row; ++i)
                {
                    var skill = new Skill()
                    {
                        Name                    = worksheet.Cells[i, 4].GetValue <string>(),
                        Description             = worksheet.Cells[i, 5].GetValue <string>(),
                        GroupName               = worksheet.Cells[i, 6].GetValue <string>(),
                        IsAvailableAsSacredSeal = worksheet.Cells[i, 20].GetValue <bool>(),
                        IsExclusive             = worksheet.Cells[i, 7].GetValue <bool>(),
                        SkillType               = (SkillTypes)Enum.Parse(typeof(SkillTypes), worksheet.Cells[i, 2].GetValue <string>()),
                        WeaponRefineType        = string.IsNullOrEmpty(worksheet.Cells[i, 3].GetValue <string>()) ? (WeaponRefineTypes?)null : (WeaponRefineTypes)Enum.Parse(typeof(WeaponRefineTypes), worksheet.Cells[i, 3].GetValue <string>()),
                        Might                   = worksheet.Cells[i, 8].GetValue <int?>(),
                        Range                   = worksheet.Cells[i, 9].GetValue <int?>(),
                        Cooldown                = worksheet.Cells[i, 10].GetValue <int?>(),
                        HitPointsModifier       = worksheet.Cells[i, 15].GetValue <int?>(),
                        AttackModifier          = worksheet.Cells[i, 16].GetValue <int?>(),
                        SpeedModifier           = worksheet.Cells[i, 17].GetValue <int?>(),
                        DefenseModifier         = worksheet.Cells[i, 18].GetValue <int?>(),
                        ResistanceModifier      = worksheet.Cells[i, 19].GetValue <int?>(),
                        SkillPoints             = worksheet.Cells[i, 11].GetValue <int>(),
                        Tag = worksheet.Cells[i, 1].GetValue <string>(),
                    };

                    skill.SkillMovementTypes = this.GetSkillMovementTypes(
                        value: worksheet.Cells[i, 12].GetValue <string>()
                        );

                    skill.SkillWeaponTypes = this.GetSkillWeaponTypes(
                        value: worksheet.Cells[i, 13].GetValue <string>()
                        );

                    skill.SkillWeaponEffectivenesses = this.GetSkillWeaponEffectivenesses(
                        value: worksheet.Cells[i, 14].GetValue <string>()
                        );

                    skill.Id = GuidHelpers.Create(skill.Tag);

                    skills.Add(skill);
                }
            }

            return(skills);
        }
コード例 #5
0
        private static TestRunInfo GetTestResults(RemoteWebDriver webDriver)
        {
            var resultsObject = (string)webDriver.ExecuteScript("return JSON.stringify(TestRunner.GetTestResults());");
            var testRunResult = JsonSerializer.Deserialize <TestRunInfo>(resultsObject, new JsonSerializerOptions()
            {
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase
            });

            if (testRunResult?.Tests is null)
            {
                throw new TestRunnerException("Failed to get test run results.");
            }

            // Initialize ID properties
            testRunResult.TestRunId = Guid.NewGuid().ToString();
            foreach (var test in testRunResult.Tests)
            {
                test.ExecutionId = Guid.NewGuid().ToString();
                test.TestId      = GuidHelpers.Create($"{test.DeclaringTypeFullName}.{test.MethodName}").ToString();
            }

            return(testRunResult);
        }