/// <summary> /// Loads the settings into this instance. /// </summary> public override void Load() { try { string versioningStyle = GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildVersioningStyle, VersioningStyle.GetDefaultGlobalVariable()); VersioningStyle.FromGlobalVariable(versioningStyle); AutoUpdateAssemblyVersion = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateAssemblyVersion, "false")); AutoUpdateFileVersion = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateFileVersion, "false")); try { BuildAction = (BuildActionType)Enum.Parse(typeof(BuildActionType), GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildAction, "Both")); } catch (ArgumentException) { BuildAction = BuildActionType.Both; } StartDate = DateTime.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_startDate, "1975/10/21")); ReplaceNonNumerics = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_replaceNonNumerics, "true")); IncrementBeforeBuild = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_incrementBeforeBuild, "true")); AssemblyInfoFilename = GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_assemblyInfoFilename, ""); ConfigurationName = GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_configurationName, "Any"); UseGlobalSettings = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useGlobalSettings, (GlobalIncrementSettings.ApplySettings == GlobalIncrementSettings.ApplyGlobalSettings.AsDefault).ToString())); IsUniversalTime = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useUniversalClock, "false")); DetectChanges = bool.Parse(GlobalVariables.GetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_detectChanges, "true")); } catch (Exception ex) { Logger.Write("Error occured while reading BuildVersionIncrement settings from \"" + SolutionItem.Filename + "\"\n" + ex.ToString(), LogLevel.Error); } }
public VersioningStyle(VersioningStyle other) { this.Major = other.Major; this.Minor = other.Minor; this.Build = other.Build; this.Revision = other.Revision; }
/// <summary> /// Saves the settings of this instance. /// </summary> public override void Save() { GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildVersioningStyle, VersioningStyle.ToGlobalVariable(), VersioningStyle.GetDefaultGlobalVariable()); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateAssemblyVersion, AutoUpdateAssemblyVersion.ToString(), "false"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_updateFileVersion, AutoUpdateFileVersion.ToString(), "false"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_buildAction, BuildAction.ToString(), "Both"); string startDate = string.Format("{0}/{1}/{2}", StartDate.Year, StartDate.Month, StartDate.Day); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_startDate, startDate, "1975/10/21"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_replaceNonNumerics, ReplaceNonNumerics.ToString(), "true"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_incrementBeforeBuild, IncrementBeforeBuild.ToString(), "true"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_assemblyInfoFilename, AssemblyInfoFilename, ""); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_configurationName, ConfigurationName, "Any"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useGlobalSettings, UseGlobalSettings.ToString(), "false"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_useUniversalClock, IsUniversalTime.ToString(), "false"); GlobalVariables.SetGlobalVariable(SolutionItem.Globals, Resources.GlobalVarName_detectChanges, DetectChanges.ToString(), "true"); }
public override void Load() { VersioningStyle versioningStyle = new VersioningStyle(); versioningStyle.FromGlobalVariable(string.Concat(new string[] { GlobalAddinSettings.Default.GlobalMajor, ".", GlobalAddinSettings.Default.GlobalMinor, ".", GlobalAddinSettings.Default.GlobalBuild, ".", GlobalAddinSettings.Default.GlobalRevision })); base.VersioningStyle = versioningStyle; base.BuildAction = (BuildActionType)Enum.Parse(typeof(BuildActionType), GlobalAddinSettings.Default.GlobalBuildAction); base.AutoUpdateAssemblyVersion = GlobalAddinSettings.Default.GlobalAutoUpdateAssemblyVersion; base.AutoUpdateFileVersion = GlobalAddinSettings.Default.GlobalAutoUpdateFileVersion; base.ReplaceNonNumerics = GlobalAddinSettings.Default.GlobalReplaceNonNumeric; base.IsUniversalTime = GlobalAddinSettings.Default.GlobalUseUniversalClock; base.IncrementBeforeBuild = GlobalAddinSettings.Default.GlobalIncrementBeforeBuild; base.StartDate = GlobalAddinSettings.Default.GlobalStartDate; base.DetectChanges = GlobalAddinSettings.Default.DetectChanges; this.Apply = (GlobalIncrementSettings.ApplyGlobalSettings)Enum.Parse(typeof(GlobalIncrementSettings.ApplyGlobalSettings), GlobalAddinSettings.Default.GlobalApply); }
/// <summary> /// Initializes a new instance of the <see cref="VersioningStyle"/> class. /// </summary> /// <param name="other">Another instances to copy the values from.</param> public VersioningStyle(VersioningStyle other) { Major = other.Major; Minor = other.Minor; Build = other.Build; Revision = other.Revision; }
/// <summary> /// Copies settings from another instance. /// </summary> /// <param name="source">The source to copy the settings from.</param> public virtual void CopyFrom(IncrementSettings source) { VersioningStyle = new VersioningStyle(source.VersioningStyle); AutoUpdateAssemblyVersion = source.AutoUpdateAssemblyVersion; AutoUpdateFileVersion = source.AutoUpdateFileVersion; BuildAction = source.BuildAction; StartDate = source.StartDate; IsUniversalTime = source.IsUniversalTime; ReplaceNonNumerics = source.ReplaceNonNumerics; IncrementBeforeBuild = source.IncrementBeforeBuild; }
public override void Reset() { base.AutoUpdateAssemblyVersion = false; base.AutoUpdateFileVersion = false; base.BuildAction = BuildActionType.Both; string defaultGlobalVariable = VersioningStyle.GetDefaultGlobalVariable(); base.VersioningStyle.FromGlobalVariable(defaultGlobalVariable); base.IsUniversalTime = false; base.StartDate = new DateTime(1975, 10, 21); base.ReplaceNonNumerics = true; base.IncrementBeforeBuild = true; base.DetectChanges = true; this.Apply = GlobalIncrementSettings.ApplyGlobalSettings.OnlyWhenChosen; }
/// <summary> /// Resets the settings to the defaults /// </summary> public override void Reset() { string versioningStyle = VersioningStyle.GetDefaultGlobalVariable(); VersioningStyle.FromGlobalVariable(versioningStyle); AutoUpdateAssemblyVersion = false; AutoUpdateFileVersion = false; BuildAction = BuildActionType.Both; StartDate = new DateTime(1975, 10, 21); ReplaceNonNumerics = true; IncrementBeforeBuild = true; AssemblyInfoFilename = String.Empty; ConfigurationName = "Any"; UseGlobalSettings = false; IsUniversalTime = false; DetectChanges = true; }
public override void Reset() { string defaultGlobalVariable = VersioningStyle.GetDefaultGlobalVariable(); base.VersioningStyle.FromGlobalVariable(defaultGlobalVariable); base.AutoUpdateAssemblyVersion = false; base.AutoUpdateFileVersion = false; base.BuildAction = BuildActionType.Both; base.StartDate = new DateTime(1975, 10, 21); base.ReplaceNonNumerics = true; base.IncrementBeforeBuild = true; this.AssemblyInfoFilename = string.Empty; this.ConfigurationName = "Any"; this.UseGlobalSettings = false; base.IsUniversalTime = false; base.DetectChanges = true; }
/// <summary> /// Resets the settings to it's defaults. /// </summary> public override void Reset() { AutoUpdateAssemblyVersion = false; AutoUpdateFileVersion = false; BuildAction = BuildActionType.Both; string versioningStyle = VersioningStyle.GetDefaultGlobalVariable(); VersioningStyle.FromGlobalVariable(versioningStyle); IsUniversalTime = false; StartDate = new DateTime(1975, 10, 21); ReplaceNonNumerics = true; IncrementBeforeBuild = true; DetectChanges = true; Apply = ApplyGlobalSettings.OnlyWhenChosen; }
/// <summary> /// Copies settings from another instance. /// </summary> /// <param name="source">The source to copy the settings from.</param> public virtual void CopyFrom(BaseIncrementSettings source) { try { VersioningStyle = new VersioningStyle(source.VersioningStyle); AutoUpdateAssemblyVersion = source.AutoUpdateAssemblyVersion; AutoUpdateFileVersion = source.AutoUpdateFileVersion; BuildAction = source.BuildAction; StartDate = source.StartDate; IsUniversalTime = source.IsUniversalTime; ReplaceNonNumerics = source.ReplaceNonNumerics; IncrementBeforeBuild = source.IncrementBeforeBuild; DetectChanges = source.DetectChanges; } catch (Exception ex) { Logger.Write("Exception occured while copying settings: " + ex.ToString(), LogLevel.Error); } }
/// <summary> /// Loads the settings into this instance. /// </summary> public override void Load() { // set the increment style VersioningStyle vs = new VersioningStyle(); vs.FromGlobalVariable(GlobalAddinSettings.Default.GlobalMajor + "." + GlobalAddinSettings.Default.GlobalMinor + "." + GlobalAddinSettings.Default.GlobalBuild + "." + GlobalAddinSettings.Default.GlobalRevision); this.VersioningStyle = vs; // get the rest BuildAction = (BuildActionType)Enum.Parse(typeof(BuildActionType), GlobalAddinSettings.Default.GlobalBuildAction); AutoUpdateAssemblyVersion = GlobalAddinSettings.Default.GlobalAutoUpdateAssemblyVersion; AutoUpdateFileVersion = GlobalAddinSettings.Default.GlobalAutoUpdateFileVersion; ReplaceNonNumerics = GlobalAddinSettings.Default.GlobalReplaceNonNumeric; IsUniversalTime = GlobalAddinSettings.Default.GlobalUseUniversalClock; IncrementBeforeBuild = GlobalAddinSettings.Default.GlobalIncrementBeforeBuild; StartDate = GlobalAddinSettings.Default.GlobalStartDate; /* ?? No idea why this was done by parsing * * DateTime parsedValue = new DateTime(1975, 10, 21); * * try * { * parsedValue = DateTime.ParseExact(GlobalAddinSettings.Default.GlobalStartDate, "yyyy/MM/dd", null, System.Globalization.DateTimeStyles.None); * } * catch (Exception ex) * { * Logger.Write("Error occured while parsing the global start date \"" + GlobalAddinSettings.Default.GlobalStartDate + "\".\r\n" + ex.ToString(), LogLevel.Error); * } * * StartDate = parsedValue;*/ DetectChanges = GlobalAddinSettings.Default.DetectChanges; Apply = (ApplyGlobalSettings)Enum.Parse(typeof(ApplyGlobalSettings), GlobalAddinSettings.Default.GlobalApply); }
public virtual void CopyFrom(BaseIncrementSettings source) { try { this.VersioningStyle = new VersioningStyle(source.VersioningStyle); this.AutoUpdateAssemblyVersion = source.AutoUpdateAssemblyVersion; this.AutoUpdateFileVersion = source.AutoUpdateFileVersion; this.BuildAction = source.BuildAction; this.StartDate = source.StartDate; this.IsUniversalTime = source.IsUniversalTime; this.ReplaceNonNumerics = source.ReplaceNonNumerics; this.IncrementBeforeBuild = source.IncrementBeforeBuild; this.DetectChanges = source.DetectChanges; } catch (Exception ex) { Logger.Write("Exception occured while copying settings: " + ex.ToString(), LogLevel.Error); } }