Exemple #1
0
        public void updateWebList(ManagerForm _MainForm, PackMetadata Metadata)
        {
            if (GAspsRPmngr.Properties.Settings.Default.SourceSelection == 2) // Setting 2 = custom source
            {
                Metadata.Source = GAspsRPmngr.Properties.Settings.Default.CustomSource;
            }
            else if (GAspsRPmngr.Properties.Settings.Default.SourceSelection == 0)              // Setting 0 = Wynn
            {
                Metadata.Source = "https://gasplund.github.io/downloads/packlist_wynn.json";    // Wynn packs JSON direct ("official" source)
            }
            else if (GAspsRPmngr.Properties.Settings.Default.SourceSelection == 1)              // Setting 1 = Vanilla
            {
                Metadata.Source = "https://gasplund.github.io/downloads/packlist_vanilla.json"; // Vanilla packs JSON ("official" source)
            }

            TimeSpan  timeoutTimespan = new TimeSpan(0, 0, 10);
            WebClient httpClient      = new WebClient();

            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                string clientResponse = httpClient.DownloadString(Metadata.Source);
                string updateListList = clientResponse;
                _MainForm.updateList(updateListList);
            }
            catch (System.ArgumentException e)
            {
                ErrorForm form3 = new ErrorForm("Your custom link is invalid or broken!", e.StackTrace, e.GetType().ToString());
                // Get your shit together yo
                form3.ShowDialog();
            }
            catch (Exception e)
            {
                ErrorForm form3 = new ErrorForm(e.Message, e.StackTrace, e.GetType().ToString());
                form3.ShowDialog();
            }
        }