From 5f22bd956ecb1b66d9bc5933bad7fd5dff789a5d Mon Sep 17 00:00:00 2001 From: "nikse.dk" Date: Tue, 4 Feb 2014 16:06:18 +0100 Subject: [PATCH] About dialog now displays only first 7 characters of last commit hash + hash is clickable + should be able to compile without git --- .gitignore | 6 +++--- src/Forms/About.Designer.cs | 15 +++++++++++++++ src/Forms/About.cs | 11 ++++++++++- src/Forms/About.resx | 2 +- src/UpdateAssemblyInfo/Program.cs | 12 ++++++++++-- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6313237be..b18653b83 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,10 @@ /src/*.suo /src/bin /src/obj -/src/Properties/AssemblyInfo.cs /src/Test/bin /src/Test/obj -/src/UpdateAssemblyDescription/bin -/src/UpdateAssemblyDescription/obj +/src/UpdateAssemblyInfo/bin +/src/UpdateAssemblyInfo/obj +/src/Properties/AssemblyInfo.cs /SE*.zip /SubtitleEdit-*-setup.exe diff --git a/src/Forms/About.Designer.cs b/src/Forms/About.Designer.cs index a145a7a92..3c9ceb318 100644 --- a/src/Forms/About.Designer.cs +++ b/src/Forms/About.Designer.cs @@ -33,6 +33,7 @@ this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.richTextBoxAbout1 = new System.Windows.Forms.RichTextBox(); this.buttonDonate = new System.Windows.Forms.Button(); + this.linkLabelGitBuildHash = new System.Windows.Forms.LinkLabel(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -97,11 +98,24 @@ this.buttonDonate.UseVisualStyleBackColor = false; this.buttonDonate.Click += new System.EventHandler(this.buttonDonate_Click); // + // linkLabelGitBuildHash + // + this.linkLabelGitBuildHash.AutoSize = true; + this.linkLabelGitBuildHash.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.linkLabelGitBuildHash.Location = new System.Drawing.Point(148, 15); + this.linkLabelGitBuildHash.Name = "linkLabelGitBuildHash"; + this.linkLabelGitBuildHash.Size = new System.Drawing.Size(90, 20); + this.linkLabelGitBuildHash.TabIndex = 43; + this.linkLabelGitBuildHash.TabStop = true; + this.linkLabelGitBuildHash.Text = "linkLabel1"; + this.linkLabelGitBuildHash.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelGitBuildHash_LinkClicked); + // // About // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(457, 372); + this.Controls.Add(this.linkLabelGitBuildHash); this.Controls.Add(this.buttonDonate); this.Controls.Add(this.okButton); this.Controls.Add(this.pictureBox1); @@ -131,6 +145,7 @@ private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.RichTextBox richTextBoxAbout1; private System.Windows.Forms.Button buttonDonate; + private System.Windows.Forms.LinkLabel linkLabelGitBuildHash; } } diff --git a/src/Forms/About.cs b/src/Forms/About.cs index 8a68ef645..0a628f54a 100644 --- a/src/Forms/About.cs +++ b/src/Forms/About.cs @@ -23,7 +23,11 @@ namespace Nikse.SubtitleEdit.Forms string minorMinorVersion = string.Empty; if (versionInfo.Length >= 3 && versionInfo[2] != "0") minorMinorVersion = "." + versionInfo[2]; - labelProduct.Text = String.Format("{0} {1}.{2}{3}, build {4}", _languageGeneral.Title, versionInfo[0], versionInfo[1], minorMinorVersion, Utilities.AssemblyDescription.Substring(0, 10)); //versionInfo[3]); + labelProduct.Text = String.Format("{0} {1}.{2}{3}, build", _languageGeneral.Title, versionInfo[0], versionInfo[1], minorMinorVersion); + string buildHash = Utilities.AssemblyDescription; + linkLabelGitBuildHash.Left = labelProduct.Left + labelProduct.Width - 5; + if (buildHash != null && buildHash.Length > 6) + linkLabelGitBuildHash.Text = String.Format("{0}", Utilities.AssemblyDescription.Substring(0, 7)); richTextBoxAbout1.Text = _language.AboutText1.TrimEnd() + Environment.NewLine + Environment.NewLine + _languageGeneral.TranslatedBy.Trim(); @@ -65,5 +69,10 @@ namespace Nikse.SubtitleEdit.Forms Process.Start("http://www.nikse.dk/Donate"); } + private void linkLabelGitBuildHash_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start("https://github.com/SubtitleEdit/subtitleedit/commit/" + Utilities.AssemblyDescription); + } + } } diff --git a/src/Forms/About.resx b/src/Forms/About.resx index c3aca0a54..eec99dc94 100644 --- a/src/Forms/About.resx +++ b/src/Forms/About.resx @@ -121,7 +121,7 @@ iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAAK/INwWK6QAAAAlwSFlzAAAO - vgAADr4B6kKxwAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuNUmK/OAAAA72SURBVHhe7drr + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuNUmK/OAAAA72SURBVHhe7drr j1XVGQZw/xWjBi0aEFAwoGKhBQsGtKgY6TjiSAQJxYiiAQMGlIuoCJgiImJAU8MUtUBEWhuC2uIHq0ZM FK3VVFNrNWpSo3wwu/u3znnnrLPnzAUYak3YyZN9W3ut93ney1p7n3PKye3kdnI7ufW17d27t1izZk3C 6tWr0/6BBx7ohvsfWJPQ6n7cq17vwv21fd5m7dq1aV/tL8ZgS9gTxxs3biy2bNlSHDhwoKibf/zbzp2/ diff --git a/src/UpdateAssemblyInfo/Program.cs b/src/UpdateAssemblyInfo/Program.cs index 7344b6576..fdb25e4f8 100644 --- a/src/UpdateAssemblyInfo/Program.cs +++ b/src/UpdateAssemblyInfo/Program.cs @@ -63,8 +63,6 @@ namespace UpdateAssemblyInfo try { DoUpdateAssembly("[GITHASH]", clrHash.Result, template, target); - File.WriteAllText(errorFileName, "GIT TAGS: " + clrTags.Result); - DoUpdateAssembly("[REVNO]", clrTags.Result.Split('-')[1] , target, target); return 0; } @@ -76,6 +74,16 @@ namespace UpdateAssemblyInfo } else { + try + { + // allow for compile without git + DoUpdateAssembly("[GITHASH]", string.Empty, template, target); + DoUpdateAssembly("[REVNO]", "0", template, target); + } + catch + { + } + Console.WriteLine("Error running Git"); Console.WriteLine(" - git folder: " + workingFolder); Console.WriteLine(" - template: " + template);