Ejemplo n.º 1
0
        public void Init()
        {
            string     filename    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "itemData.xml");
            ItemReader mitemReader = new ItemReader();

            mitemsData = mitemReader.Load(filename);
        }
Ejemplo n.º 2
0
        public void Init()
        {
            string InventoryFile = "inventory.xml";
            string filename      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "itemData.xml");

            Console.WriteLine("-----Creating Inventory-----");
            source = new Inventory()
            {
                ItemToQuantity =
                    new Dictionary <object, object> {
                    { "Poke ball", 10 }, { "Potion", 10 },
                    { "Premier ball", 20 }, { "Revive", 3 }, { "Great ball", 8 },
                    { "Hyper Potion", 2 }
                }
            };

            source.Serialize(source);
            source = source.Deserialize(InventoryFile);

            itemReader    = new ItemReader();
            itemsDatafile = itemReader.Load(filename);
        }