Example #1
0
 private void DoOneUpdate()
 {
     if (this.updates.Count > 0)
     {
         this.updateState = "updating";
         this.changeStatusText("Downloading " + this.updates[0].versionNumber + "...");
         UpdateDownloader.Download(this.updates[0], this.onDownloadProgressChange, this.onDownloadComplete);
     }
     else
     {
         this.updateState = "updated";
         this.changeStatusText("Finish !");
         this.mainButton.Text           = "Start RetroZone !";
         this.retroZoneVersion          = RetroZoneVersion.GetFromExe();
         this.currentVersionNumber.Text = this.retroZoneVersion.value;
     }
 }
Example #2
0
        public async void PrimitiveCheck()
        {
            // EXE version
            this.changeStatusText("Checking versions...");
            this.retroZoneVersion          = RetroZoneVersion.GetFromExe();
            this.currentVersionNumber.Text = this.retroZoneVersion.value;


            // Updates available
            this.updates = await Update.GetFromApi(retroZoneVersion);

            if (this.updates == null)
            {
                Thread.Sleep(2000);
                Environment.Exit(0);
            }
            if (this.retroZoneVersion.value == "NEW")
            {
                this.newVersionNumber.Text = this.updates[0].versionNumber;
            }
            else
            {
                this.newVersionNumber.Text = (updates.Count > 1) ? this.updates[0].versionNumber : this.updates[1].versionNumber;
            }

            if (this.newVersionNumber.Text != this.currentVersionNumber.Text)
            {
                this.mainButton.Text    = (retroZoneVersion.value == "NEW") ? "Install" : "Update";
                this.mainButton.Enabled = true;
                this.mainButton.Click  += mainButtonClick;
                this.updateState        = "ready";
                this.changeStatusText("Ready !");
            }
            else
            {
                this.mainButton.Text = "Start RetroZone !";
                this.changeStatusText("No updates available...");
                this.updateState = "updated";
            }
        }
Example #3
0
        public static async Task <List <Update> > GetFromApi(RetroZoneVersion retroZoneVersion)
        {
            IRestClient  client  = new RestClient(API_URL);
            IRestRequest request = new RestRequest("api/check_update", Method.GET);

            request.AddHeader("API-VERSION", retroZoneVersion.value);
            IRestResponse response = await client.ExecuteTaskAsync(request);

            if (response.ErrorException != null)
            {
                MessageBox.Show("We are sorry, RetroZone server can't be contacted... Check your network ! \n\nVisit retro-zone.net for more help !");
                return(null);
            }

            try
            {
                return(JsonConvert.DeserializeObject <List <Update> >(response.Content));
            }
            catch
            {
                MessageBox.Show("We are sorry, RetroZone server can't be contacted... Check your network ! \n\nVisit retro-zone.net for more help !");
                return(null);
            }
        }