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 #3
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 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);
     }
 }