private static GithubRelease GetNewestReleaseMono() { string outputFilePath = Application.StartupPath + @"/release.json"; GithubRelease rel = null; if (File.Exists(Application.StartupPath + "/release.json")) { File.Delete(Application.StartupPath + "/release.json"); } MonoHelper.DownloadFile( "https://api.github.com/repos/BlackDragonBE/MarkdownToRW_Converter/releases/latest", outputFilePath, "MarkdownToRW_Converter"); // Read json if (File.Exists(Application.StartupPath + "/release.json")) { var json = ""; using (StreamReader sr = new StreamReader(outputFilePath.Replace("\"", ""))) { json = sr.ReadToEnd(); } rel = JsonConvert.DeserializeObject <GithubRelease>(json); File.Delete(Application.StartupPath + "/release.json"); } return(rel); }
private void btnCopyClipboard_Click(object sender, EventArgs e) { if (txtHtml.Text != "") { Clipboard.SetText(txtHtml.Text); if (MonoHelper.IsRunningOnMac) { MonoHelper.CopyToMacClipboard(txtHtml.Text); } } }
private static void StartAppUpdate(GithubRelease newestRelease) { // Copy updater.exe to folder above // Run updater.exe on folder above // Updater gets current folder & path to zip as arguments & starts // This app exists // Preparation Console.WriteLine("Downloading new release..."); string downloadUrl = ""; string downloadName = ""; foreach (GithubRelease.Asset asset in newestRelease.assets) { if (asset.name.Contains("GUI")) { downloadName = asset.name; downloadUrl = asset.browser_download_url; } } string zipPath = Directory.GetParent(Application.StartupPath) + "/" + downloadName; string newUpdaterPath = Directory.GetParent(Application.StartupPath) + "/RWUpdater.exe"; //Download update MonoHelper.DownloadFile(downloadUrl, zipPath, "MarkdownToRW_Converter"); // Copy updater to folder above if (File.Exists(newUpdaterPath)) { File.Delete(newUpdaterPath); } File.Copy(Application.StartupPath + "/RWUpdater.exe", newUpdaterPath); File.Copy(Application.StartupPath + "/DotNetZip.dll", Directory.GetParent(Application.StartupPath) + "/DotNetZip.dll"); // Run updater & quit Process.Start(newUpdaterPath, DragonUtil.SurroundWithQuotes(Application.StartupPath) + " " + DragonUtil.SurroundWithQuotes(zipPath)); Environment.Exit(0); }
public MainForm() { InitializeComponent(); Console.WriteLine("Detecting OS..."); MonoHelper.DetectOperatingSystem(); ServicePointManager.ServerCertificateValidationCallback = MonoHelper.Validator; ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; Text += " v" + DragonVersion.VERSION + " on " + Environment.OSVersion.VersionString; if (MonoHelper.IsRunningOnMono) { Text += " [MONO]"; } UpdateHelper.DoUpdateCleanup(); UpdateHelper.CheckForUpdates(); }
private void btnMacPastePassword_Click(object sender, EventArgs e) { txtPassword.Text = MonoHelper.PasteFromMacClipboard(); }
private void btnMacPasteUsername_Click(object sender, EventArgs e) { txtUsername.Text = MonoHelper.PasteFromMacClipboard(); }