Example #1
0
        public ItemEnchantDataStore(IResourceManager resourceManager,
                                    ILogger <ItemEnchantDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic enchantRes in resource.ItemList)
            {
                var enchant = new ItemEnchant();
                enchant.Index         = enchantRes.Index;
                enchant.Name          = enchantRes.Nameen;
                enchant.Name          = enchant.Name.Trim();
                enchant.Kind          = EnchantKind.Parse(enchantRes.Kind);
                enchant.UseType       = ItemUseType.Parse(enchantRes.UseType);
                enchant.MaxUse        = enchantRes.MaxUse;
                enchant.ElementalKind = ElementalKind.Parse(enchantRes.ElementalKind);
                enchant.AddPer        = enchantRes.AddPer;
                enchant.SellPrice     = enchantRes.SellPrice;
                enchant.Hair          = enchantRes.HAIR == 1;
                enchant.Body          = enchantRes.BODY == 1;
                enchant.Pants         = enchantRes.PANTS == 1;
                enchant.Foot          = enchantRes.FOOT == 1;
                enchant.Cap           = enchantRes.CAP == 1;
                enchant.Hand          = enchantRes.HAND == 1;
                enchant.Glasses       = enchantRes.GLASSES == 1;
                enchant.Bag           = enchantRes.BAG == 1;
                enchant.Socks         = enchantRes.SOCKS == 1;
                enchant.Racket        = enchantRes.RACKET == 1;
                Add(enchant.Index, enchant);
            }
            _byKind = new Dictionary <EnchantKind, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
Example #2
0
        public void T13_BigXmlTest()
        {
            var urlList = new List <string>()
            {
                // 1MB
                "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/mondial/mondial-3.0.xml",
                // 30 MB
                "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/tpc-h/lineitem.xml",
                // 109 MB
                "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/SwissProt/SwissProt.xml" /*,
                                                                                                               * // 683 MB
                                                                                                               * "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/pir/psd7003.xml"*/
            };

            var getter = getHttpFiles(urlList);

            getter.Wait(5 * 60 * 1000); // 5min max
            var stopWatch = new Stopwatch();

            foreach (string xml in getter.Result)
            {
                stopWatch.Reset();
                stopWatch.Start();
                var cdata = XmlSlurper.ParseText(xml);
                stopWatch.Stop();

                Decimal fileSizeMb = Math.Round(xml.Length / (1024m * 1024m), 2);
                Int64   timeMs     = stopWatch.ElapsedMilliseconds;
                Decimal speed      = Math.Round(timeMs / fileSizeMb, 0);
                Console.WriteLine($"T13 Parsed {fileSizeMb} MB in {timeMs} ms (approx. {speed} ms/MB)");
            }
        }
        public ItemHouseDecorationDataStore(IResourceManager resourceManager,
                                            ILogger <ItemHouseDecorationDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic houseDecoRes in resource.ItemList)
            {
                var houseDeco = new ItemHouseDecoration();
                houseDeco.Index         = houseDecoRes.Index;
                houseDeco.Name          = houseDecoRes.Nameen;
                houseDeco.Name          = houseDeco.Name.Trim();
                houseDeco.Kind          = HouseDecorationKind.Parse(houseDecoRes.Kind);
                houseDeco.UseType       = ItemUseType.Parse(houseDecoRes.UseType);
                houseDeco.MaxUse        = houseDecoRes.MaxUse;
                houseDeco.HousingPoint  = houseDecoRes.Housingpoint;
                houseDeco.InHouse       = houseDecoRes.InHouse == 1;
                houseDeco.AddGold       = houseDecoRes.AddGold;
                houseDeco.AddExp        = houseDecoRes.AddExp;
                houseDeco.AddBattleGold = houseDecoRes.AddBattleGold;
                houseDeco.AddBattleExp  = houseDecoRes.AddBattleExp;
                houseDeco.EnableParcel  = houseDecoRes.EnableParcel == 1;
                Add(houseDeco.Index, houseDeco);
            }
            _byKind = new Dictionary <HouseDecorationKind, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
Example #4
0
        public void T10_BoolIntDecimalDoubleTest()
        {
            var settings1 = XmlSlurper.ParseText(getFile("HardwareSettings.xml"));
            var settings2 = XmlSlurper.ParseFile(getFileFullPath("HardwareSettings.xml"));

            foreach (var settings in new[] { settings1, settings2 })
            {
                Assert.Equal <bool?>(true, settings.view.displayIcons);
                Assert.Equal <bool?>(false, settings.view.showFiles);
                Assert.Equal <int?>(2, settings.performance.additionalChecks.disk.minFreeSpace);
                Assert.Equal <double?>(5.5, settings.performance.additionalChecks.disk.warnFreeSpace);
                Assert.Equal <decimal?>(5.5m, settings.performance.additionalChecks.disk.warnFreeSpace);

                Assert.True(settings.view.displayIcons);
                Assert.False(settings.view.showFiles);
                Assert.Equal <int>(2, settings.performance.additionalChecks.disk.minFreeSpace);
                Assert.Equal <double>(5.5, settings.performance.additionalChecks.disk.warnFreeSpace);
                Assert.Equal <decimal>(5.5m, settings.performance.additionalChecks.disk.warnFreeSpace);

                // usage showcase
                if (!settings.view.displayIcons)
                {
                    Assert.True(false);
                }
                int?minFreeSpace = settings.performance.additionalChecks.disk.minFreeSpace;
                if (minFreeSpace != 2)
                {
                    Assert.True(false);
                }
            }
        }
Example #5
0
        public void T05_ListXmlNodesTest()
        {
            var catalog1 = XmlSlurper.ParseText(getFile("BookCatalog.xml"));
            var catalog2 = XmlSlurper.ParseFile(getFileFullPath("BookCatalog.xml"));

            foreach (var catalog in new[] { catalog1, catalog2 })
            {
                var bookList = catalog.bookList;

                Assert.Equal(12, bookList.Count);

                var book1 = bookList[0];
                Assert.Equal("bk101", book1.id);
                Assert.Equal("Gambardella, Matthew", book1.author);
                Assert.Equal("XML Developer's Guide", book1.title);
                Assert.Equal("Computer", book1.genre);
                Assert.Equal("44.95", book1.price);

                var book4 = bookList[3];
                Assert.Equal("bk104", book4.id);
                Assert.Equal("Corets, Eva", book4.author);
                Assert.Equal("Oberon's Legacy", book4.title);
                Assert.Equal("Fantasy", book4.genre);
                Assert.Equal("5.95", book4.price);

                var book12 = bookList[11];
                Assert.Equal("bk112", book12.id);
                Assert.Equal("Galos, Mike", book12.author);
                Assert.Equal("Visual Studio 7: A Comprehensive Guide", book12.title);
                Assert.Equal("Computer", book12.genre);
                Assert.Equal("49.95", book12.price);
            }
        }
Example #6
0
        public void SimpleXmlAttributesTest()
        {
            var book = XmlSlurper.ParseText(getFile("book.xml"));

            Assert.AreEqual("bk101", book.id);
            Assert.AreEqual("123456789", book.isbn);
        }
Example #7
0
        public void T11_ConversionExceptionTest()
        {
            var settings1 = XmlSlurper.ParseText(getFile("HardwareSettings.xml"));
            var settings2 = XmlSlurper.ParseFile(getFileFullPath("HardwareSettings.xml"));

            foreach (var settings in new[] { settings1, settings2 })
            {
                Assert.Throws <ValueConversionException>(() =>
                {
                    int t = settings.view.displayIcons;
                });
                Assert.Throws <ValueConversionException>(() =>
                {
                    decimal t = settings.view.displayIcons;
                });
                Assert.Throws <ValueConversionException>(() =>
                {
                    double t = settings.view.displayIcons;
                });
                Assert.Throws <ValueConversionException>(() =>
                {
                    bool t = settings.performance.additionalChecks.disk.minFreeSpace;
                });
            }
        }
        public ItemPartDataStore(IResourceManager resourceManager,
                                 ILogger <ItemPartDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic itemRes in resource.ItemList)
            {
                var itemPart = new ItemPart();
                itemPart.Index          = itemRes.Index;
                itemPart.Name           = itemRes.Nameen;
                itemPart.Name           = itemPart.Name.Trim();
                itemPart.Hero           = HeroType.Parse(itemRes.Char);
                itemPart.Type           = ItemPartType.Parse(itemRes.Part);
                itemPart.Mesh           = itemRes.Mesh;
                itemPart.Hair           = itemRes.Hair;
                itemPart.Leg            = itemRes.Leg;
                itemPart.Foot           = itemRes.Foot;
                itemPart.EnchantElement = itemRes.EnchantElement;
                Add(itemPart.Index, itemPart);
            }
            _byType = new Dictionary <int, HashSet <int> >();
            _byHero = new Dictionary <HeroType, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
Example #9
0
        public void T09_PrintXmlContents2()
        {
            string xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
                         "<nutrition>" +
                         "	<food>"+
                         "		<name>Avocado Dip</name>"+
                         "		<mfr>Sunnydale</mfr>"+
                         "		<carb>2</carb>"+
                         "		<fiber>0</fiber>"+
                         "		<protein>1</protein>"+
                         "	</food>"+
                         "	<food>"+
                         "		<name>Bagels, New York Style </name>"+
                         "		<mfr>Thompson</mfr>"+
                         "		<carb>54</carb>"+
                         "		<fiber>3</fiber>"+
                         "		<protein>11</protein>"+
                         "	</food>"+
                         "	<food>"+
                         "		<name>Beef Frankfurter, Quarter Pound </name>"+
                         "		<mfr>Armitage</mfr>"+
                         "		<carb>8</carb>"+
                         "		<fiber>0</fiber>"+
                         "		<protein>13</protein>"+
                         "	</food>"+
                         "</nutrition>";
            var nutrition = XmlSlurper.ParseText(xml);

            // since many food nodes were found, a list was generated and named foodList (common name + "List")
            Console.WriteLine("T09 name1 = " + nutrition.foodList[0].name);
            Console.WriteLine("T09 name2 = " + nutrition.foodList[1].name);
        }
Example #10
0
        public void SimpleXmlNodesTest()
        {
            var book = XmlSlurper.ParseText(getFile("book.xml"));

            Assert.AreEqual("Gambardella, Matthew", book.author);
            Assert.AreEqual("XML Developer's Guide", book.title);
            Assert.AreEqual("Computer", book.genre);
            Assert.AreEqual("44.95", book.price);
        }
        public ShopItemDataStore(IResourceManager resourceManager,
                                 IItemPartDataStore itemPartDataStore,
                                 IItemHouseDecorationDataStore houseDecorationDataStore,
                                 IItemEnchantDataStore enchantDataStore,
                                 IItemRecipeDataStore recipeDataStore,
                                 ILogger <ShopItemDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            var tmp = new Dictionary <int, ShopItem>();

            foreach (dynamic itemRes in resource.ProductList)
            {
                var shopItem = new ShopItem();
                shopItem.Display      = itemRes.DISPLAY;
                shopItem.Index        = itemRes.Index;
                shopItem.Enable       = itemRes.Enable == 1;
                shopItem.Free         = itemRes.Free == 1;
                shopItem.Sale         = itemRes.Sale == 1;
                shopItem.Event        = itemRes.Event == 1;
                shopItem.Couple       = itemRes.Couple == 1;
                shopItem.Nobuy        = itemRes.Nobuy == 1;
                shopItem.Rand         = itemRes.Rand != "No";
                shopItem.UseType      = ItemUseType.Parse(itemRes.UseType);
                shopItem.Use0         = itemRes.Use0;
                shopItem.Use1         = itemRes.Use1;
                shopItem.Use2         = itemRes.Use2;
                shopItem.PriceType    = ShopPriceType.Parse(itemRes.PriceType);
                shopItem.Price0       = itemRes.Price0;
                shopItem.Price1       = itemRes.Price1;
                shopItem.Price2       = itemRes.Price2;
                shopItem.OldPrice0    = itemRes.OldPrice0;
                shopItem.OldPrice1    = itemRes.OldPrice1;
                shopItem.OldPrice2    = itemRes.OldPrice2;
                shopItem.CouplePrice  = itemRes.CouplePrice;
                shopItem.CategoryType = ShopCategoryType.Parse(itemRes.Category);
                shopItem.Name         = itemRes.Name;
                shopItem.GoldBack     = itemRes.GoldBack;
                shopItem.EnableParcel = itemRes.EnableParcel == 1;
                shopItem.Hero         = (int)itemRes.Char;
                shopItem.Items        = new[] { itemRes.Item0, itemRes.Item1, itemRes.Item2, itemRes.Item3, itemRes.Item4, itemRes.Item5, itemRes.Item6, itemRes.Item7, itemRes.Item8, itemRes.Item9 }
                .Select(p => (int)p).Where(p => p != 0).ToArray();
                tmp.Add(shopItem.Index, shopItem);
            }

            foreach (var kvp in tmp.OrderBy(p => p.Key))
            {
                Add(kvp.Key, kvp.Value);
            }

            _itemPartDataStore        = itemPartDataStore;
            _houseDecorationDataStore = houseDecorationDataStore;
            _enchantDataStore         = enchantDataStore;
            _recipeDataStore          = recipeDataStore;
            logger.LogInformation("loaded.");
        }
Example #12
0
        public void T01_ObjectNotNullTest()
        {
            var city1 = XmlSlurper.ParseText(getFile("City.xml"));
            var city2 = XmlSlurper.ParseFile(getFileFullPath("City.xml"));

            foreach (var city in new[] { city1, city2 })
            {
                Assert.NotNull(city);
                Assert.NotNull(city.Name);
            }
        }
Example #13
0
        public void T08_PrintXmlContents1()
        {
            string xml  = "<book id=\"bk101\" isbn=\"123456789\"><author>Gambardella, Matthew</author><title>XML Developer Guide</title></book>";
            var    book = XmlSlurper.ParseText(xml);

            // that's it, now we have everything
            Console.WriteLine("T08 id = " + book.id);
            Console.WriteLine("T08 isbn = " + book.isbn);
            Console.WriteLine("T08 author = " + book.author);
            Console.WriteLine("T08 title = " + book.title);
        }
Example #14
0
        public void T02_SimpleXmlAttributesTest()
        {
            var book1 = XmlSlurper.ParseText(getFile("Book.xml"));
            var book2 = XmlSlurper.ParseFile(getFileFullPath("Book.xml"));

            foreach (var book in new[] { book1, book2 })
            {
                Assert.Equal("bk101", book.id);
                Assert.Equal("123456789", book.isbn);
            }
        }
Example #15
0
        public void T04_XmlMultipleLevelsNodesTest()
        {
            var settings1 = XmlSlurper.ParseText(getFile("HardwareSettings.xml"));
            var settings2 = XmlSlurper.ParseFile(getFileFullPath("HardwareSettings.xml"));

            foreach (var settings in new[] { settings1, settings2 })
            {
                Assert.Equal("true", settings.view.displayIcons);
                Assert.Equal("false", settings.performance.additionalChecks.disk.brandOptions.toshiba.useBetaFunc);
            }
        }
Example #16
0
        public ItemRecipeDataStore(IResourceManager resourceManager,
                                   ILogger <ItemRecipeDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic recipeRes in resource.RecipeList)
            {
                var recipe = new ItemRecipe();
                recipe.Index        = recipeRes.Index;
                recipe.Name         = recipeRes.Nameen;
                recipe.Name         = recipe.Name.Trim();
                recipe.Kind         = RecipeKind.Parse(recipeRes.Kind);
                recipe.UseType      = ItemUseType.Parse(recipeRes.UseType);
                recipe.MaxUse       = recipeRes.MaxUse;
                recipe.UseCount     = recipeRes.UseCount;
                recipe.Hero         = HeroType.Parse(recipeRes.Character);
                recipe.EnableParcel = recipeRes.EnableParcel == 1;
                recipe.RequireGold  = recipeRes.RequireGold;
                recipe.MixGaugeTime = recipeRes.MixGaugeTime;
                recipe.HouseLevel   = recipeRes.Houselevel;
                recipe.Probability  = recipeRes.Probability;
                recipe.Materials    = new List <Recipe.RecipeMaterial>();
                recipe.Mutations    = new List <Recipe.RecipeMutation>();
                for (int i = 0; i < 6; i++)
                {
                    if (recipeRes.Members["Material" + i] != 0)
                    {
                        recipe.Materials.Add(new Recipe.RecipeMaterial()
                        {
                            Index = recipeRes.Members["Material" + i],
                            Count = recipeRes.Members["Count" + i],
                        });
                    }
                }
                for (int i = 0; i < 5; i++)
                {
                    if (recipeRes.Members["Mutation" + i] != 0)
                    {
                        recipe.Mutations.Add(new Recipe.RecipeMutation()
                        {
                            Index       = recipeRes.Members["Mutation" + i],
                            Probability = recipeRes.Members["MutationPro" + i],
                            Min         = recipeRes.Members["MutationMIN" + i],
                            Max         = recipeRes.Members["MutationMAX" + i],
                        });
                    }
                }
                Add(recipe.Index, recipe);
            }

            _byKind = new Dictionary <int, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
Example #17
0
        public void T03_SimpleXmlNodesTest()
        {
            var book1 = XmlSlurper.ParseText(getFile("Book.xml"));
            var book2 = XmlSlurper.ParseFile(getFileFullPath("Book.xml"));

            foreach (var book in new[] { book1, book2 })
            {
                Assert.Equal("Gambardella, Matthew", book.author);
                Assert.Equal("XML Developer's Guide", book.title);
                Assert.Equal("Computer", book.genre);
                Assert.Equal("44.95", book.price);
            }
        }
Example #18
0
        public PetLevelDataStore(IResourceManager resourceManager,
                                 ILogger <PetLevelDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            byte level = 0;

            foreach (dynamic exp in resource.ExpList)
            {
                Add(level++, exp.Value);
            }
            logger.LogInformation("loaded.");
        }
Example #19
0
        public EmblemQuestDataStore(IResourceManager resourceManager,
                                    ITextDataStore textDataStore,
                                    ILogger <EmblemQuestDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            _quests       = new Dictionary <int, Quest>();
            _questDetails = new Dictionary <int, QuestDetail>();
            _rewards      = new List <RewardItem>();

            loadQuests(textDataStore, resource);
            loadQuestDetails(resource);
            loadRewards(resource);
            logger.LogInformation("loaded.");
        }
Example #20
0
        public void BothPropertiesAndListXmlTest()
        {
            var nutrition = XmlSlurper.ParseText(getFile("nutrition.xml"));

            var foodList = nutrition.bookList;

            Assert.AreEqual(12, foodList.Count);

            var food1 = foodList[0];

            Assert.AreEqual("Avocado Dip", food1.name);
            Assert.AreEqual("Sunnydale", food1.mfr);

            /*Assert.AreEqual("XML Developer's Guide", food1.total-fat);
             * Assert.AreEqual("Computer", food1.genre);
             * Assert.AreEqual("44.95", food1.price);*/
        }
Example #21
0
        public void T07_BothPropertiesAndListRecursiveXmlTest()
        {
            var city1 = XmlSlurper.ParseText(getFile("CityInfo.xml"));
            var city2 = XmlSlurper.ParseFile(getFileFullPath("CityInfo.xml"));

            foreach (var city in new[] { city1, city2 })
            {
                Assert.True(city.Mayor == "Roni Mueller");
                Assert.True(city.CityHall == "Schulstrasse 12");
                Assert.True(city.Name == "Wilen bei Wollerau");
                Assert.True(city.Gemeinde == "Freienbach");

                Assert.Equal(3, city.StreetList.Count);

                Assert.Equal("8832", city.StreetList[2].PostCode);
                Assert.Equal(3, city.StreetList[2].HouseNumberList.Count);
            }
        }
Example #22
0
        public void T06_BothPropertiesAndListRootXmlTest()
        {
            var nutrition1 = XmlSlurper.ParseText(getFile("Nutrition.xml"));
            var nutrition2 = XmlSlurper.ParseFile(getFileFullPath("Nutrition.xml"));

            foreach (var nutrition in new[] { nutrition1, nutrition2 })
            {
                var foodList = nutrition.foodList;

                Assert.Equal(10, foodList.Count);

                var food1 = foodList[0];
                Assert.Equal("Avocado Dip", food1.name);
                Assert.Equal("Sunnydale", food1.mfr);
                Assert.Equal("11", food1.totalfat);

                Assert.Equal("1", food1.vitamins.a);
                Assert.Equal("0", food1.vitamins.c);
            }
        }
        private void Init()
        {
            if (Validate_Paths())
            {
                // Data
                var xml = File.ReadAllText(Addon_Manager_Data_Path + @"\settings.xml").Replace("<?xml version=\"1.1\" ?>", "<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                Settings = XmlSlurper.ParseText(xml);

                Autoload_Addons = Get_Autoload_Addons();
                All_Addons      = Get_Addons();
                All_Jobs.Sort();
                All_Zones = Get_All_Zones();

                Global_Addons = Get_Global_Addons();
                Player_Addons = Get_Character_Addons();
                By_Job        = Get_Jobs_Addons();
                By_Zone       = Get_ZoneSettings();

                Zone_Groups.Add(ZoneGroups_Header);
                Zone_Groups.AddRange(By_Zone.Select(x => x.GroupId).ToList());

                // UI
                txt_WindowerPath.Text = Properties.Settings.Default.Windower_Path;

                Cb_Jobs.ItemsSource = All_Jobs;
                //Cb_Jobs.SelectedIndex = 0;

                Cb_Zones.ItemsSource = All_Zones;
                //Cb_Zones.SelectedIndex = 0;

                Cb_ZoneGroups.ItemsSource = Zone_Groups;
                //Cb_ZoneGroups.SelectedIndex = 0;

                lb_GlobalAddons.ItemsSource = Global_Addons;
                lb_Character.ItemsSource    = Player_Addons;
                lb_Jobs.ItemsSource         = By_Job;
                lb_Zones.ItemsSource        = By_Zone;
                //lb_Zones.ItemsSource = By_Zone.Select(c => { c.Zones = "\t" + c.Zones.Replace(",", "\n\t"); return c; }).Select(c => { c.Addons = c.Addons.Replace(",", "\n"); return c; });
                lb_Addons.ItemsSource = All_Addons;
            }
        }
Example #24
0
        public ItemToolDataStore(IResourceManager resourceManager,
                                 ILogger <ItemToolDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic toolRes in resource.RecipeList)
            {
                var tool = new ItemTool();
                tool.Index        = toolRes.Index;
                tool.Name         = toolRes.Nameen;
                tool.Name         = tool.Name.Trim();
                tool.Kind         = ItemToolKind.Parse(toolRes.Kind);
                tool.UseType      = ItemUseType.Parse(toolRes.UseType);
                tool.MaxUse       = toolRes.MaxUse;
                tool.EnableParcel = toolRes.EnableParcel == 1;

                Add(tool.Index, tool);
            }
            logger.LogInformation("loading...");
        }
Example #25
0
        public MapQuestDataStore(IResourceManager resourceManager,
                                 ILogger <MapQuestDataStore> logger)
        {
            logger.LogInformation("loading...");
            _globals     = new List <Global>();
            _tutorials   = new Dictionary <ushort, Tutorial>();
            _challenges  = new Dictionary <ushort, TennisChallenge>();
            _miniGames   = new Dictionary <int, MiniGame>();
            _playerNpcs  = new Dictionary <int, PlayerNpc>();
            _monsterNpcs = new Dictionary <int, MonsterNpc>();

            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            loadGlobals(resource);
            loadTutorials(resource);
            loadChallenges(resource);
            loadGuardianChallenges(resource);
            loadMiniGames(resource);
            loadPlayerNpcs(resource);
            loadMonsterNpcs(resource);
            logger.LogInformation("loaded.");
        }
Example #26
0
        public void T12_CDataTest()
        {
            var cdata1 = XmlSlurper.ParseText(getFile("CData.xml"));
            var cdata2 = XmlSlurper.ParseFile(getFileFullPath("CData.xml"));

            foreach (var cdata in new[] { cdata1, cdata2 })
            {
                // test cdata for single nodes
                Assert.Equal("DOCUMENTO N. 1234-9876", cdata.Title);

                // test cdata for list nodes
                dynamic attr = cdata.AttributeList[0];
                Assert.Equal("document.id", attr.Name);
                Assert.Equal("<string>DOCUMENTO N. 1234-9876</string>", attr);

                attr = cdata.AttributeList[4];
                Assert.Equal("receipt.date", attr.Name);
                Assert.Equal("<string>2020-12-28</string>", attr);

                attr = cdata.AttributeList[5];
                Assert.Equal("fcurrency", attr.Name);
                Assert.Equal("EUR", attr);
            }
        }
Example #27
0
        public void ObjectNotNullTest()
        {
            var book = XmlSlurper.ParseText(getFile("book.xml"));

            Assert.IsNotNull(book);
        }