public VersioningStyle(VersioningStyle other)
 {
     Major    = other.Major;
     Minor    = other.Minor;
     Build    = other.Build;
     Revision = other.Revision;
 }
        public override void Save()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            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");
            var startDate = $"{StartDate.Year}/{StartDate.Month}/{StartDate.Day}";

            GlobalVariables.SetGlobalVariable(SolutionItem.Globals,
                                              Resources.GlobalVarName_startDate,
                                              startDate,
                                              "2000/01/01");
            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 Reset()
        {
            var versioningStyle = VersioningStyle.GetDefaultGlobalVariable();

            VersioningStyle.FromGlobalVariable(versioningStyle);
            AutoUpdateAssemblyVersion = false;
            AutoUpdateFileVersion     = false;
            BuildAction          = BuildActionType.Both;
            StartDate            = new DateTime(2000, 1, 1);
            ReplaceNonNumerics   = true;
            IncrementBeforeBuild = true;
            AssemblyInfoFilename = String.Empty;
            ConfigurationName    = "Any";
            UseGlobalSettings    = false;
            IsUniversalTime      = false;
            DetectChanges        = true;
        }
Beispiel #4
0
        public override void Reset()
        {
            AutoUpdateAssemblyVersion = false;
            AutoUpdateFileVersion     = false;

            BuildAction = BuildActionType.Both;

            var versioningStyle = VersioningStyle.GetDefaultGlobalVariable();

            VersioningStyle.FromGlobalVariable(versioningStyle);

            IsUniversalTime      = false;
            StartDate            = new DateTime(2000, 1, 1);
            ReplaceNonNumerics   = true;
            IncrementBeforeBuild = true;
            DetectChanges        = true;

            Apply = ApplyGlobalSettings.OnlyWhenChosen;
        }
 public virtual void CopyFrom(IncrementSettingsBase source)
 {
     try
     {
         VersioningStyle           = new VersioningStyle(source.VersioningStyle);
         AutoUpdateAssemblyVersion = source.AutoUpdateAssemblyVersion;
         AutoUpdateFileVersion     = source.AutoUpdateFileVersion;
         BuildAction          = source.BuildAction;
         DetectChanges        = source.DetectChanges;
         IncrementBeforeBuild = source.IncrementBeforeBuild;
         IsUniversalTime      = source.IsUniversalTime;
         ReplaceNonNumerics   = source.ReplaceNonNumerics;
         StartDate            = source.StartDate;
     }
     catch (Exception ex)
     {
         Logger.Write($"Exception occured while copying settings:\n{ex}");
     }
 }
Beispiel #6
0
        public override void Load()
        {
            var vs = new VersioningStyle();

            vs.FromGlobalVariable(
                $"{Settings.Default.GlobalMajor}.{Settings.Default.GlobalMinor}.{Settings.Default.GlobalBuild}.{Settings.Default.GlobalRevision}");
            VersioningStyle = vs;

            BuildAction =
                (BuildActionType)Enum.Parse(typeof(BuildActionType), Settings.Default.GlobalBuildAction);
            AutoUpdateAssemblyVersion = Settings.Default.GlobalAutoUpdateAssemblyVersion;
            AutoUpdateFileVersion     = Settings.Default.GlobalAutoUpdateFileVersion;
            ReplaceNonNumerics        = Settings.Default.GlobalReplaceNonNumeric;
            IsUniversalTime           = Settings.Default.GlobalUseUniversalClock;
            IncrementBeforeBuild      = Settings.Default.GlobalIncrementBeforeBuild;
            StartDate     = Settings.Default.GlobalStartDate;
            DetectChanges = Settings.Default.DetectChanges;
            Apply         =
                (ApplyGlobalSettings)Enum.Parse(typeof(ApplyGlobalSettings), Settings.Default.GlobalApply);
        }
 public override void Load()
 {
     try
     {
         var 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,
                                                              "2000/01/01"));
         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}",
             LogLevel.Error);
     }
 }