private async void checkForCores() { try { foreach (string s in listOfComponents) { CoreItem temp = await Check(s); coreList.Add(temp); ProgressBar pb = new ProgressBar(); ListBoxItem lb = new ListBoxItem(); pb.Height = 16; lb.Content = pb; pbList.Add(pb); listBoxCoresDl.Items.Add(lb); listBoxCores.Items.Add(temp.ToString()); } } catch (Octokit.RateLimitExceededException ex) { Logging.WriteLine("GitHub rate limit reached!"); MessageBox.Show( "Unfortunately you have reached the hourly rate limit on GitHub's side, you will need to wait an hour or two before running this again. There is nothing we (teknogods) can do about this for now.", "GitHub rate limit exceeded!"); Application.Current.Shutdown(); } }
private async void addRedists() { CoreItem directX = new CoreItem(); directX.dlLink = "https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe"; directX.isRedist = true; directX.name = "DirectX Runtimes"; directX.version = "9.0"; CoreItem vcr = new CoreItem(); vcr.dlLink = "http://nzgamer41.win/TeknoParrot/TPRedists/vcr.zip"; vcr.isRedist = true; vcr.name = "Visual C++ Redistributibles (2005-2019)"; vcr.version = "N/A"; coreList.Add(directX); coreList.Add(vcr); ProgressBar pbdx = new ProgressBar(); ListBoxItem lbdx = new ListBoxItem(); pbdx.Height = 16; lbdx.Content = pbdx; pbList.Add(pbdx); listBoxCoresDl.Items.Add(lbdx); listBoxCores.Items.Add(directX.ToString()); ProgressBar pbvc = new ProgressBar(); ListBoxItem lbvc = new ListBoxItem(); pbvc.Height = 16; lbvc.Content = pbvc; pbList.Add(pbvc); listBoxCoresDl.Items.Add(lbvc); listBoxCores.Items.Add(vcr.ToString()); }
public static async Task <CoreItem> Check(string componentToCheck, bool isLimited = false) { var github = new GitHubClient(new ProductHeaderValue("TPBootstrapper")); var versionPattern = @"\d{1}\.\d{1}\.\d{1}\.\d{1,3}"; CoreItem temp = new CoreItem(); temp.name = componentToCheck; //jump in first if (componentToCheck == "SegaToolsTP") { var releases = await github.Repository.Release.GetAll("nzgamer41", componentToCheck); var latest = releases[0]; temp.dlLink = latest.Assets[0].BrowserDownloadUrl; var match = Regex.Match(latest.Name, versionPattern); temp.version = match.Groups[0].Value; return(temp); } if (componentToCheck != "OpenParrotWin32" && componentToCheck != "OpenParrotx64" && componentToCheck != "TeknoParrot" && componentToCheck != "TeknoParrotN2") { var releases = await github.Repository.Release.GetAll("teknogods", componentToCheck); var latest = releases[0]; temp.dlLink = latest.Assets[0].BrowserDownloadUrl; temp.version = latest.Name; if (componentToCheck == "TeknoParrotUi") { temp.isRequired = true; } return(temp); } else if (componentToCheck != "TeknoParrot" && componentToCheck != "TeknoParrotN2") { var releases = await github.Repository.Release.GetAll("teknogods", "OpenParrot"); if (componentToCheck == "OpenParrotWin32") { for (int i = 0; i < releases.Count; i++) { var latest = releases[i]; if (latest.TagName == "OpenParrotWin32") { temp.dlLink = latest.Assets[0].BrowserDownloadUrl; var match = Regex.Match(latest.Name, versionPattern); temp.version = match.Groups[0].Value; return(temp); } } } else if (componentToCheck == "OpenParrotx64") { //checking openparrot64 for (int i = 0; i < releases.Count; i++) { var latest = releases[i]; if (latest.TagName == "OpenParrotx64") { temp.dlLink = latest.Assets[0].BrowserDownloadUrl; var match = Regex.Match(latest.Name, versionPattern); temp.version = match.Groups[0].Value; return(temp); } } } } else { var releases = await github.Repository.Release.GetAll("teknogods", "TeknoParrot"); if (componentToCheck == "TeknoParrot") { for (int i = 0; i < releases.Count; i++) { var latest = releases[i]; if (latest.TagName == "TeknoParrot") { temp.dlLink = latest.Assets[0].BrowserDownloadUrl; var match = Regex.Match(latest.Name, versionPattern); temp.version = match.Groups[0].Value; return(temp); } } } else if (componentToCheck == "TeknoParrotN2") { for (int i = 0; i < releases.Count; i++) { var latest = releases[i]; if (latest.TagName == "TeknoParrotN2") { temp.dlLink = latest.Assets[0].BrowserDownloadUrl; var match = Regex.Match(latest.Name, versionPattern); temp.version = match.Groups[0].Value; return(temp); } } } else { throw new Exception("Invalid request!"); } } throw new Exception("Checking for new versions failed!"); }