GetVersionString() 공개 정적인 메소드

public static GetVersionString ( ) : string
리턴 string
예제 #1
0
파일: MainForm.cs 프로젝트: TheFern2/raptor
        private void CreateCrashLog(Exception exception)
        {
            StreamWriter writer = null;

            try {
                string filePath = Path.Combine(Application.StartupPath, "crash.log");
                writer = new StreamWriter(filePath);

                writer.WriteLine(Strings.GetString("send_log_file", Program.MailAddress));
                writer.WriteLine();
                writer.WriteLine("Version: {0}", Program.GetVersionString());
                writer.WriteLine("Mono: {0}", MonoHelper.IsRunningOnMono ? "yes" : "no");

                writer.WriteLine();
                writer.WriteLine(exception.Message);
                Exception innerException = exception.InnerException;
                while (innerException != null)
                {
                    writer.WriteLine(innerException.Message);
                    innerException = innerException.InnerException;
                }

                writer.WriteLine();
                writer.WriteLine(exception.StackTrace);
            }
            catch {
                // Do nothing
            }
            finally {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
예제 #2
0
        private void UpdateTexts()
        {
            this.Text         = Strings.GetString("about_nclass");
            lblTitle.Text     = Program.GetVersionString();
            lblCopyright.Text = "Copyright (C) 2006-2007 " + Strings.GetString("author");
            lblStatus.Text    = Strings.GetString("version", Strings.GetString("beta"));
            lnkEmail.Text     = Strings.GetString("send_email");
            lnkHomepage.Text  = Strings.GetString("visit_homepage");
            btnClose.Text     = Strings.GetString("button_close");

            lnkHomepage.Links.Clear();
            lnkEmail.Links.Clear();
            lnkHomepage.Links.Add(0, lnkHomepage.Text.Length, Program.WebAddress);
            lnkEmail.Links.Add(0, lnkEmail.Text.Length,
                               "mailto:" + Program.MailAddress + "?subject=NClass");
            lblTranslator.Text = Strings.GetString("translator");
        }
예제 #3
0
        private static void CreateCrashLog(string directory, Exception exception)
        {
            StreamWriter writer = null;

            try
            {
                string filePath = Path.Combine(directory, "crash.log");
                writer = new StreamWriter(filePath);

                writer.WriteLine(string.Format(
                                     Strings.SendLogFile, Properties.Resources.MailAddress));
                writer.WriteLine();
                writer.WriteLine("Version: {0}", Program.GetVersionString());
                writer.WriteLine("Mono: {0}", MonoHelper.IsRunningOnMono ? "yes" : "no");
                if (MonoHelper.IsRunningOnMono)
                {
                    writer.WriteLine("Mono version: {0}", MonoHelper.Version);
                }
                writer.WriteLine("OS: {0}", Environment.OSVersion.VersionString);

                writer.WriteLine();
                writer.WriteLine(exception.Message);
                Exception innerException = exception.InnerException;
                while (innerException != null)
                {
                    writer.WriteLine(innerException.Message);
                    innerException = innerException.InnerException;
                }

                writer.WriteLine();
                writer.WriteLine(exception.StackTrace);
            }
            catch
            {
                // Do nothing
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
예제 #4
0
        private void mnuCheckForUpdates_Click(object sender, EventArgs e)
        {
            System.Threading.Tasks.Task <IReadOnlyList <Octokit.Release> > releases;
            Octokit.Release latest = null;

            ProgressDialog progressDownload = new ProgressDialog();

            Thread thread = new Thread(() =>
            {
                Octokit.GitHubClient client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("alexgracianoarj"));
                releases = client.Repository.Release.GetAll("alexgracianoarj", "nclass");
                latest   = releases.Result[0];
                Console.Write(latest.Name);

                if (progressDownload.InvokeRequired)
                {
                    progressDownload.BeginInvoke(new Action(() => progressDownload.Close()));
                }
            });

            thread.Start();

            progressDownload.Text = "Update";
            progressDownload.lblPleaseWait.Text = "Checking...";
            progressDownload.SetIndeterminate(true);

            progressDownload.ShowDialog();

            double latestVersion  = Convert.ToDouble(latest.TagName.Replace("v", ""), System.Globalization.CultureInfo.InvariantCulture);
            double programVersion = Convert.ToDouble(Program.GetVersionString().Split(' ')[1], System.Globalization.CultureInfo.InvariantCulture);

            if (latestVersion > programVersion)
            {
                if (MessageBox.Show("There is a new version of NClass.\n\nDo you want download the new version and install it now?", "NClass", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                {
                    thread = new Thread(() =>
                    {
                        WebClient wc = new WebClient();

                        wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler((sen, env) =>
                        {
                            double bytesIn    = double.Parse(env.BytesReceived.ToString());
                            double totalBytes = double.Parse(env.TotalBytesToReceive.ToString());
                            double percentage = bytesIn / totalBytes * 100;

                            if (progressDownload.InvokeRequired)
                            {
                                progressDownload.BeginInvoke(new Action(() => progressDownload.lblPleaseWait.Text = "Downloaded " + Convert.ToInt32(percentage) + "% - " + (env.BytesReceived / 1024) + " KB of " + (env.TotalBytesToReceive / 1024) + " KB"));
                            }

                            if (progressDownload.InvokeRequired)
                            {
                                progressDownload.BeginInvoke(new Action(() => progressDownload.progressBar1.Value = Convert.ToInt32(percentage)));
                            }
                        });

                        wc.DownloadFileCompleted += new AsyncCompletedEventHandler((sen, env) =>
                        {
                            // Close the dialog if it hasn't been already
                            if (progressDownload.InvokeRequired)
                            {
                                progressDownload.BeginInvoke(new Action(() => progressDownload.Close()));
                            }

                            System.Diagnostics.Process.Start(Path.GetTempPath() + "NClass_Update.exe");

                            Application.Exit();
                        });

                        wc.DownloadFileAsync(new Uri(latest.Assets[0].BrowserDownloadUrl), Path.GetTempPath() + "NClass_Update.exe");
                    });

                    thread.Start();

                    progressDownload.Text = "Update";
                    progressDownload.lblPleaseWait.Text = "Downloading...";
                    progressDownload.SetIndeterminate(false);

                    progressDownload.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("NClass already is updated.", "NClass", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }