Пример #1
0
        public static async void TryCheckForUpdatesAsync(bool failSilently = true)
        {
            try
            {
                //get latest release info from github
                string html = await DownloadLatestReleaseHTML();

                string latestVersion = ParseLatestVersion(html);
                string patchNotes    = ParsePatchNotes(html);

                //compare version numbers to determine if updates are available
                if (VersionStringToNumber(latestVersion) <= VersionStringToNumber(CurrentVersion))
                {
                    //aready have the latest version
                    if (!failSilently)
                    {
                        System.Windows.Forms.MessageBox.Show($"You already have the lastest version ({CurrentVersion}) of CTM's AATool.", "No Updates Available");
                    }
                }
                else
                {
                    //updates are available; ask user if they'd like to download
                    using (var dialog = new FUpdate(latestVersion, patchNotes))
                        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
                        {
                            RunUpdateAssistant(false);
                        }
                }
            }
            catch (Exception) { }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");

            Console.WriteLine("Creating new Configuration...");
            User config = new User()
            {
                Username = "******",
                Password = "******",
                DeviceId = DracoUtils.GenerateDeviceId(),
                Login    = "******"
            };

            Config options = new Config()
            {
                CheckProtocol = true,
                EventsCounter = new Dictionary <string, int>(),
                Lang          = "English",
                TimeOut       = 0,
                UtcOffset     = 7200
            };

            var draco = new DracoClient(null, options);

            Console.WriteLine("Ping...");
            var ping = draco.Ping();

            if (!ping)
            {
                throw new Exception();
            }

            Console.WriteLine("Boot...");
            draco.Boot(config);

            Console.WriteLine("Login...");
            var login = draco.Login().Result;

            if (login == null)
            {
                throw new Exception("Unable to login");
            }

            var newLicence = login.info.newLicense;

            if (login.info.sendClientLog)
            {
                Console.WriteLine("Send client log is set to true! Please report.");
            }

            draco.Post("https://us.draconiusgo.com/client-error", new
            {
                appVersion = draco.ClientVersion,
                deviceInfo = $"platform = iOS\"nos ={ draco.ClientInfo.platformVersion }\"ndevice = iPhone 6S",
                userId     = draco.User.Id,
                message    = "Material doesn\"t have a texture property \"_MainTex\"",
                stackTrace = "",
            });

            if (newLicence > 0)
            {
                draco.AcceptLicence(newLicence);
            }

            Console.WriteLine("Init client...");
            draco.Load();

            Console.WriteLine("Get user items...");
            var response = draco.Inventory.GetUserItems() as FBagUpdate;

            foreach (var item in response.items)
            {
                Console.WriteLine($"  item = { English.Load["key.item."+ item.type.ToString()]}, count = { item.count}");
            }

            Console.WriteLine("Get map update");
            FUpdate         map       = draco.GetMapUpdate(45.469896, 9.180439, 20);
            FCreatureUpdate creatures = map.items.Find(o => o.GetType() == typeof(FCreatureUpdate)) as FCreatureUpdate;
            FHatchedEggs    hatched   = map.items.Find(o => o.GetType() == typeof(FHatchedEggs)) as FHatchedEggs;
            FChestUpdate    chests    = map.items.Find(o => o.GetType() == typeof(FChestUpdate)) as FChestUpdate;
            FAvaUpdate      avatar    = map.items.Find(o => o.GetType() == typeof(FAvaUpdate)) as FAvaUpdate;
            FBuildingUpdate buildings = map.items.Find(o => o.GetType() == typeof(FBuildingUpdate)) as FBuildingUpdate;

            Console.WriteLine($"  { creatures.inRadar.Count} creature(s) in radar");
            foreach (var creature in creatures.inRadar)
            {
                var id   = creature.id;
                var name = English.Load["creature." + creature.name.ToString()];
                Console.WriteLine($"    creature { name } ({ creature.coords.latitude }, ${ creature.coords.longitude }) [id: { id }]");
            }

            Console.WriteLine("Done.\r\nPress one key to exit...");
            Console.ReadKey();
        }