Exemplo n.º 1
0
        private void UpdateFlags()
        {
            LOG.Debug("UpdateFlags()");
            ConsumablesImporter Importer = WGAPI.GetFlags();

            if (Importer.Status.ToLower().Equals("ok"))
            {
                Program.Flags = new List <Consumable>();
                foreach (KeyValuePair <string, Consumable> Flag in Importer.Data)
                {
                    Program.Flags.Add(Flag.Value);
                }
                BinarySerialize.WriteToBinaryFile(Commons.GetFlagsFileName(), Program.Flags);
            }
        }
Exemplo n.º 2
0
        public static ConsumablesImporter GetFlags()
        {
            try { Setup(); } catch (Exception) { }
            string path           = $"encyclopedia/consumables/?application_id={APP_ID}&type=Flags";
            string responseString = "";
            var    response       = Client.GetAsync(path).Result;

            if (response.IsSuccessStatusCode)
            {
                var responseContent = response.Content;
                responseString = responseContent.ReadAsStringAsync().Result;
            }
            ConsumablesImporter Import = JsonConvert.DeserializeObject <ConsumablesImporter>(responseString);

            return(Import);
        }
Exemplo n.º 3
0
        private void UpdateUpgrades()
        {
            LOG.Debug("UpdateUpgrades()");
            ConsumablesImporter Importer = WGAPI.GetUpgrades();

            if (Importer.Status.ToLower().Equals("ok"))
            {
                Program.Upgrades = new List <Consumable>();
                foreach (KeyValuePair <string, Consumable> Data in Importer.Data)
                {
                    Program.Upgrades.Add(Data.Value);
                }
                BinarySerialize.WriteToBinaryFile(Commons.GetUpgradesFileName(), Program.Upgrades);
            }
            else
            {
                LOG.Warning("Unable to import Upgrades: " + Importer.Status.ToString());
            }
        }