diff --git a/BuildTools/UpdateVersionNumber/DisplayItem.cs b/BuildTools/UpdateVersionNumber/DisplayItem.cs deleted file mode 100644 index a2541b350..000000000 --- a/BuildTools/UpdateVersionNumber/DisplayItem.cs +++ /dev/null @@ -1,54 +0,0 @@ -#region Disclaimer / License -// Copyright (C) 2011, Kenneth Skovhede -// http://www.hexad.dk, opensource@hexad.dk -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// -#endregion -using System; -using System.Collections.Generic; -using System.Text; - -namespace UpdateVersionNumber -{ - public class DisplayItem - { - public DisplayItem(string file, Version version) - { - m_file = file; - m_version = version; - } - - private string m_file; - - public string File - { - get { return m_file; } - set { m_file = value; } - } - private Version m_version; - - public Version Version - { - get { return m_version; } - set { m_version = value; } - } - - public override string ToString() - { - return m_file + " (" + m_version.ToString() + ")"; - } - } -} diff --git a/BuildTools/UpdateVersionNumber/Form1.Designer.cs b/BuildTools/UpdateVersionNumber/Form1.Designer.cs deleted file mode 100644 index 02bf1b15d..000000000 --- a/BuildTools/UpdateVersionNumber/Form1.Designer.cs +++ /dev/null @@ -1,225 +0,0 @@ -namespace UpdateVersionNumber -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.checkedListBox1 = new System.Windows.Forms.CheckedListBox(); - this.label2 = new System.Windows.Forms.Label(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); - this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); - this.panel1 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.button3 = new System.Windows.Forms.Button(); - this.panel1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(16, 32); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(66, 13); - this.label1.TabIndex = 0; - this.label1.Text = "New version"; - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(96, 32); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(100, 20); - this.textBox1.TabIndex = 1; - // - // checkedListBox1 - // - this.checkedListBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.checkedListBox1.CheckOnClick = true; - this.checkedListBox1.FormattingEnabled = true; - this.checkedListBox1.IntegralHeight = false; - this.checkedListBox1.Location = new System.Drawing.Point(16, 64); - this.checkedListBox1.Name = "checkedListBox1"; - this.checkedListBox1.SelectionMode = System.Windows.Forms.SelectionMode.None; - this.checkedListBox1.Size = new System.Drawing.Size(212, 98); - this.checkedListBox1.Sorted = true; - this.checkedListBox1.TabIndex = 2; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(16, 8); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(36, 13); - this.label2.TabIndex = 3; - this.label2.Text = "Folder"; - // - // textBox2 - // - this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox2.Location = new System.Drawing.Point(96, 8); - this.textBox2.Name = "textBox2"; - this.textBox2.ReadOnly = true; - this.textBox2.Size = new System.Drawing.Size(92, 20); - this.textBox2.TabIndex = 4; - this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(196, 8); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(24, 20); - this.button1.TabIndex = 5; - this.button1.Text = "..."; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.button2.Location = new System.Drawing.Point(86, 176); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); - this.button2.TabIndex = 6; - this.button2.Text = "Update"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // folderBrowserDialog1 - // - this.folderBrowserDialog1.Description = "Select project folder"; - this.folderBrowserDialog1.ShowNewFolderButton = false; - // - // backgroundWorker1 - // - this.backgroundWorker1.WorkerSupportsCancellation = true; - this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); - this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); - // - // panel1 - // - this.panel1.Controls.Add(this.button2); - this.panel1.Controls.Add(this.checkedListBox1); - this.panel1.Controls.Add(this.button1); - this.panel1.Controls.Add(this.label1); - this.panel1.Controls.Add(this.textBox2); - this.panel1.Controls.Add(this.textBox1); - this.panel1.Controls.Add(this.label2); - this.panel1.Location = new System.Drawing.Point(16, 24); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(240, 216); - this.panel1.TabIndex = 7; - // - // panel2 - // - this.panel2.Controls.Add(this.button3); - this.panel2.Controls.Add(this.groupBox1); - this.panel2.Location = new System.Drawing.Point(272, 24); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(256, 216); - this.panel2.TabIndex = 8; - // - // progressBar1 - // - this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(16, 32); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(200, 23); - this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; - this.progressBar1.TabIndex = 0; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.progressBar1); - this.groupBox1.Location = new System.Drawing.Point(16, 72); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(224, 72); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Loading, please wait"; - // - // button3 - // - this.button3.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.button3.Location = new System.Drawing.Point(91, 176); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(75, 23); - this.button3.TabIndex = 7; - this.button3.Text = "Stop"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(564, 272); - this.Controls.Add(this.panel2); - this.Controls.Add(this.panel1); - this.Name = "Form1"; - this.Text = "Form1"; - this.Load += new System.EventHandler(this.Form1_Load); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.panel2.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.CheckedListBox checkedListBox1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; - private System.ComponentModel.BackgroundWorker backgroundWorker1; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.ProgressBar progressBar1; - private System.Windows.Forms.Button button3; - } -} - diff --git a/BuildTools/UpdateVersionNumber/Form1.cs b/BuildTools/UpdateVersionNumber/Form1.cs deleted file mode 100644 index 67f43f103..000000000 --- a/BuildTools/UpdateVersionNumber/Form1.cs +++ /dev/null @@ -1,262 +0,0 @@ -#region Disclaimer / License -// Copyright (C) 2011, Kenneth Skovhede -// http://www.hexad.dk, opensource@hexad.dk -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// -#endregion -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace UpdateVersionNumber -{ - public partial class Form1 : Form - { - private readonly System.Text.RegularExpressions.Regex RXP = new System.Text.RegularExpressions.Regex(@"\[assembly\: AssemblyVersion\(\""(?\d+\.\d+\.\d+\.\d+)\""\)\]"); - private readonly System.Text.RegularExpressions.Regex RXP2 = new System.Text.RegularExpressions.Regex(@"\[assembly\: AssemblyFileVersion\(\""(?\d+\.\d+\.\d+\.\d+)\""\)\]"); - private readonly System.Text.RegularExpressions.Regex RXP3 = new System.Text.RegularExpressions.Regex(@"\[assembly\: AssemblyFileVersionAttribute\(\""(?\d+\.\d+\.\d+\.\d+)\""\)\]"); - - private readonly System.Text.RegularExpressions.Regex RXP4 = new System.Text.RegularExpressions.Regex(@"\<\?define ProductVersion\=\""(?\d+\.\d+\.\d+\.\d+)\"" \?\>"); - - private readonly System.Text.RegularExpressions.Regex RXP5 = new System.Text.RegularExpressions.Regex(@"newVersion\=\""(?\d+\.\d+\.\d+\.\d+)\"""); - - public Form1() - { - InitializeComponent(); - panel1.Dock = DockStyle.Fill; - panel2.Dock = DockStyle.Fill; - } - - private void textBox2_TextChanged(object sender, EventArgs e) - { - panel1.Visible = false; - panel2.Visible = true; - - backgroundWorker1.RunWorkerAsync(textBox2.Text); - } - - private void Form1_Load(object sender, EventArgs e) - { - textBox2.Text = Application.StartupPath; - } - - private void button1_Click(object sender, EventArgs e) - { - if (folderBrowserDialog1.ShowDialog(this) == DialogResult.OK) - if (textBox2.Text == folderBrowserDialog1.SelectedPath) - textBox2_TextChanged(sender, e); - else - textBox2.Text = folderBrowserDialog1.SelectedPath; - } - - private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) - { - List results = new List(); - e.Result = results; - Queue folders = new Queue(); - string startfolder = e.Argument as string; - if (string.IsNullOrEmpty(startfolder)) - return; - - folders.Enqueue(startfolder); - - while (folders.Count > 0) - { - string folder = folders.Dequeue(); - - foreach (string f in System.IO.Directory.GetDirectories(folder)) - folders.Enqueue(f); - - if (backgroundWorker1.CancellationPending) - { - e.Cancel = true; - return; - } - - string file = System.IO.Path.Combine(folder, "AssemblyInfo.cs"); - if (System.IO.File.Exists(file)) - { - string content = System.IO.File.ReadAllText(file); - System.Text.RegularExpressions.Match m = RXP.Match(content); - if (!m.Success) - m = RXP2.Match(content); - if (!m.Success) - m = RXP3.Match(content); - - if (m.Success) - { - string v = m.Groups["version"].Value; - results.Add(new DisplayItem(file, new Version(v))); - } - - } - - file = System.IO.Path.Combine(folder, "UpgradeData.wxi"); - if (System.IO.File.Exists(file)) - { - string content = System.IO.File.ReadAllText(file); - System.Text.RegularExpressions.Match m = RXP4.Match(content); - - if (m.Success) - { - string v = m.Groups["version"].Value; - results.Add(new DisplayItem(file, new Version(v))); - } - } - - file = System.IO.Path.Combine(folder, "AssemblyRedirects.xml"); - if (System.IO.File.Exists(file)) - { - string content = System.IO.File.ReadAllText(file); - System.Text.RegularExpressions.Match m = RXP5.Match(content); - - if (m.Success) - { - string v = m.Groups["version"].Value; - results.Add(new DisplayItem(file, new Version(v))); - } - } - - } - } - - private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) - { - panel1.Visible =true; - panel2.Visible = false; - - if (e.Error != null) - MessageBox.Show(this, "An error occured: " + e.Error.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - - if (e.Cancelled || e.Error != null) - { - checkedListBox1.Items.Clear(); - button2.Enabled = false; - return; - } - - Dictionary overrideDefault = new Dictionary(System.Environment.OSVersion.Platform == PlatformID.MacOSX || System.Environment.OSVersion.Platform == PlatformID.Unix ? StringComparer.InvariantCulture : StringComparer.InvariantCultureIgnoreCase ); - string configfile = null; - bool updateDefault = true; - try - { - configfile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "UpdateVersionNumber.config"); - if (System.IO.File.Exists(configfile)) - { - System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); - doc.Load(configfile); - - System.Xml.XmlNode root = doc["root"]; - if (root.Attributes["update_as_default"] != null) - updateDefault = bool.Parse(root.Attributes["update_as_default"].Value); - - foreach (System.Xml.XmlNode file in root.SelectNodes("file")) - { - string filename = file.InnerText; - if (!System.IO.Path.IsPathRooted(filename)) - filename = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), filename); - - overrideDefault[filename] = bool.Parse(file.Attributes["update"].Value); - } - } - } - catch(Exception ex) - { - MessageBox.Show(this, string.Format("An error occured while reading config file \"{0}\": {1}", configfile, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - button2.Enabled = true; - List files = (List)e.Result; - checkedListBox1.Items.Clear(); - Version vmax = new Version(); - foreach (DisplayItem d in files) - { - checkedListBox1.Items.Add(d, overrideDefault.ContainsKey(d.File) ? overrideDefault[d.File] : updateDefault); - vmax = d.Version > vmax ? d.Version : vmax; - } - - textBox1.Text = vmax.ToString(); - - } - - private void button3_Click(object sender, EventArgs e) - { - if (!backgroundWorker1.CancellationPending && backgroundWorker1.IsBusy) - backgroundWorker1.CancelAsync(); - } - - private void button2_Click(object sender, EventArgs e) - { - if (checkedListBox1.CheckedItems.Count == 0) - { - MessageBox.Show(this, "No files selected", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - - Version v; - - try - { - v = new Version(textBox1.Text); - } - catch (Exception ex) - { - MessageBox.Show(this, "Invalid version number: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - - string replacement = "[assembly: AssemblyVersion(\"" + v.ToString() + "\")]"; - string replacement2 = "[assembly: AssemblyFileVersion(\"" + v.ToString() + "\")]"; - string replacement3 = "[assembly: AssemblyFileVersionAttribute(\"" + v.ToString() + "\")]"; - string replacement4 = ""; - string replacement5 = "newVersion=\"" + v.ToString() + "\""; - bool errors = false; - - foreach (DisplayItem d in checkedListBox1.CheckedItems) - { - try - { - string content = System.IO.File.ReadAllText(d.File); - if (d.File.ToLower().EndsWith(".wxi")) - content = RXP4.Replace(content, replacement4); - else if (System.IO.Path.GetFileName(d.File).Equals("AssemblyRedirects.xml", StringComparison.InvariantCultureIgnoreCase)) - { - content = RXP5.Replace(content, replacement5); - } - else - { - content = RXP.Replace(content, replacement); - content = RXP2.Replace(content, replacement2); - content = RXP3.Replace(content, replacement3); - } - System.IO.File.WriteAllText(d.File, content); - } - catch (Exception ex) - { - errors = true; - MessageBox.Show(this, "Failed to update file: " + d.File + "\r\nError: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - if (!errors) - this.Close(); - } - } -} diff --git a/BuildTools/UpdateVersionNumber/Form1.resx b/BuildTools/UpdateVersionNumber/Form1.resx deleted file mode 100644 index 583cfc846..000000000 --- a/BuildTools/UpdateVersionNumber/Form1.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 175, 17 - - \ No newline at end of file diff --git a/BuildTools/UpdateVersionNumber/Program.cs b/BuildTools/UpdateVersionNumber/Program.cs deleted file mode 100644 index 776ac62a5..000000000 --- a/BuildTools/UpdateVersionNumber/Program.cs +++ /dev/null @@ -1,39 +0,0 @@ -#region Disclaimer / License -// Copyright (C) 2011, Kenneth Skovhede -// http://www.hexad.dk, opensource@hexad.dk -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// -#endregion -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace UpdateVersionNumber -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/BuildTools/UpdateVersionNumber/Properties/AssemblyInfo.cs b/BuildTools/UpdateVersionNumber/Properties/AssemblyInfo.cs deleted file mode 100644 index 01e267f31..000000000 --- a/BuildTools/UpdateVersionNumber/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -#region Disclaimer / License -// Copyright (C) 2011, Kenneth Skovhede -// http://www.hexad.dk, opensource@hexad.dk -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// -#endregion -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("UpdateVersionNumber")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("HexaD")] -[assembly: AssemblyProduct("UpdateVersionNumber")] -[assembly: AssemblyCopyright("Copyright © HexaD 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("9118bb59-ad2d-4660-81ad-cc23f12ce450")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/BuildTools/UpdateVersionNumber/Properties/Resources.Designer.cs b/BuildTools/UpdateVersionNumber/Properties/Resources.Designer.cs deleted file mode 100644 index 4134defd4..000000000 --- a/BuildTools/UpdateVersionNumber/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.237 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace UpdateVersionNumber.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UpdateVersionNumber.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/BuildTools/UpdateVersionNumber/Properties/Resources.resx b/BuildTools/UpdateVersionNumber/Properties/Resources.resx deleted file mode 100644 index ffecec851..000000000 --- a/BuildTools/UpdateVersionNumber/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/BuildTools/UpdateVersionNumber/Properties/Settings.Designer.cs b/BuildTools/UpdateVersionNumber/Properties/Settings.Designer.cs deleted file mode 100644 index 18c66d951..000000000 --- a/BuildTools/UpdateVersionNumber/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.237 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace UpdateVersionNumber.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/BuildTools/UpdateVersionNumber/Properties/Settings.settings b/BuildTools/UpdateVersionNumber/Properties/Settings.settings deleted file mode 100644 index abf36c5d3..000000000 --- a/BuildTools/UpdateVersionNumber/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/BuildTools/UpdateVersionNumber/UpdateVersionNumber.csproj b/BuildTools/UpdateVersionNumber/UpdateVersionNumber.csproj deleted file mode 100644 index 33b5e2664..000000000 --- a/BuildTools/UpdateVersionNumber/UpdateVersionNumber.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2CD0151C-C091-4F98-B7B7-144DF02EF2E7} - WinExe - Properties - UpdateVersionNumber - UpdateVersionNumber - v2.0 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - \ No newline at end of file diff --git a/BuildTools/UpdateVersionNumber/UpdateVersionNumber.sln b/BuildTools/UpdateVersionNumber/UpdateVersionNumber.sln deleted file mode 100644 index 6c30c19c6..000000000 --- a/BuildTools/UpdateVersionNumber/UpdateVersionNumber.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateVersionNumber", "UpdateVersionNumber.csproj", "{2CD0151C-C091-4F98-B7B7-144DF02EF2E7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2CD0151C-C091-4F98-B7B7-144DF02EF2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2CD0151C-C091-4F98-B7B7-144DF02EF2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2CD0151C-C091-4F98-B7B7-144DF02EF2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2CD0151C-C091-4F98-B7B7-144DF02EF2E7}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/BuildTools/UpdateVersionStamp/Program.cs b/BuildTools/UpdateVersionStamp/Program.cs new file mode 100644 index 000000000..30138bfaf --- /dev/null +++ b/BuildTools/UpdateVersionStamp/Program.cs @@ -0,0 +1,103 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace UpdateVersionStamp +{ + public static class Program + { + private static readonly string DIR_SEP = Path.DirectorySeparatorChar.ToString(); + private static readonly Dictionary FILEMAP; + + static Program() + { + var versionre = @"(?\d+\.\d+\.(\*|(\d+(\.(\*|\d+)))?))"; + FILEMAP = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + FILEMAP.Add("AssemblyInfo.cs", new Regex(@"(\[assembly\: AssemblyVersion\(\""" + versionre + @"""\)\])|(\[assembly\: AssemblyFileVersion\(\""" + versionre + @"\""\)\])|(\[assembly\: AssemblyFileVersionAttribute\(\""" + versionre + @"\""\)\])")); + FILEMAP.Add("UpgradeData.wxi", new Regex(@"\<\?define ProductVersion\=\""" + versionre + @"\"" \?\>")); + FILEMAP.Add("AssemblyRedirects.xml", new Regex(@"newVersion\=\""" + versionre + @"\""")); + } + + private class Options + { + public string sourcefolder = Path.GetFullPath(Environment.CurrentDirectory); + public string ignorefilter = null; + public string version = null; + public string versiontag = null; + + public void Fixup() + { + sourcefolder = Duplicati.Library.Utility.Utility.AppendDirSeparator(System.IO.Path.GetFullPath(sourcefolder.Replace("/", DIR_SEP))); + if (ignorefilter != null) + ignorefilter =ignorefilter.Replace("/", DIR_SEP); + } + } + + public static void Main(string[] _args) + { + List args = new List(_args); + Dictionary options = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args); + Options opt = new Options(); + + foreach (FieldInfo fi in opt.GetType().GetFields()) + if (options.ContainsKey(fi.Name)) + fi.SetValue(opt, options[fi.Name]); + + opt.Fixup(); + + Duplicati.Library.Utility.IFilter filter = null; + if (!string.IsNullOrEmpty(opt.ignorefilter)) + filter = new Duplicati.Library.Utility.FilterExpression(opt.ignorefilter, false); + + Func isFile = (string x) => !x.EndsWith(DIR_SEP); + + var paths = Duplicati.Library.Utility.Utility.EnumerateFileSystemEntries(opt.sourcefolder, filter) + .Where(x => isFile(x) && FILEMAP.ContainsKey(Path.GetFileName(x))) + .Select(x => + { + var m = FILEMAP[Path.GetFileName(x)].Match(File.ReadAllText(x)); + return m.Success ? + new { File = x, Version = new Version(m.Groups["version"].Value.Replace("*", "0")), Display = m.Groups["version"].Value } + : null; + }) + .Where(x => x != null) + .ToArray(); //No need to re-eval + + if (paths.Count() == 0) + { + Console.WriteLine("No files found to update..."); + return; + } + + foreach (var p in paths) + Console.WriteLine("{0}\t:{1}", p.Display, p.File); + + if (string.IsNullOrWhiteSpace(opt.version)) + { + var maxv = paths.Select(x => x.Version).Max(); + opt.version = new Version( + maxv.Major, + maxv.Minor, + maxv.Build + 1, + maxv.Revision).ToString(); + } + + //Sanity check + var nv = new Version(opt.version).ToString(4); + + foreach (var p in paths) + { + var re = FILEMAP[Path.GetFileName(p.File)]; + var txt = File.ReadAllText(p.File); + var m = re.Match(txt).Groups["version"]; + txt = txt.Substring(0, m.Index) + nv + txt.Substring(m.Index + m.Length); + File.WriteAllText(p.File, txt); + } + + Console.WriteLine("Updated {0} files to version {1}", paths.Count(), opt.version); + } + } +} diff --git a/BuildTools/UpdateVersionStamp/Properties/AssemblyInfo.cs b/BuildTools/UpdateVersionStamp/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..eac5b0be4 --- /dev/null +++ b/BuildTools/UpdateVersionStamp/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle("UpdateVersionStamp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. +[assembly: AssemblyVersion("1.0.*")] +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/BuildTools/UpdateVersionStamp/UpdateVersionStamp.csproj b/BuildTools/UpdateVersionStamp/UpdateVersionStamp.csproj new file mode 100644 index 000000000..386947a9e --- /dev/null +++ b/BuildTools/UpdateVersionStamp/UpdateVersionStamp.csproj @@ -0,0 +1,47 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {1920C3B0-98A0-410F-8972-9C19FA616FE5} + Exe + UpdateVersionStamp + UpdateVersionStamp + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + --sourcefolder=../.. --version=2.0.0.0 --version-tag=20140405 + + + full + true + bin\Release + prompt + 4 + true + + + + + + + + + + + + + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65} + Duplicati.Library.Utility + + + \ No newline at end of file diff --git a/BuildTools/UpdateVersionStamp/UpdateVersionStamp.sln b/BuildTools/UpdateVersionStamp/UpdateVersionStamp.sln new file mode 100644 index 000000000..eb92b843b --- /dev/null +++ b/BuildTools/UpdateVersionStamp/UpdateVersionStamp.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateVersionStamp", "UpdateVersionStamp.csproj", "{1920C3B0-98A0-410F-8972-9C19FA616FE5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Utility", "..\..\Duplicati\Library\Utility\Duplicati.Library.Utility.csproj", "{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1920C3B0-98A0-410F-8972-9C19FA616FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1920C3B0-98A0-410F-8972-9C19FA616FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1920C3B0-98A0-410F-8972-9C19FA616FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1920C3B0-98A0-410F-8972-9C19FA616FE5}.Release|Any CPU.Build.0 = Release|Any CPU + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = UpdateVersionStamp.csproj + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal