diff --git a/vsSolutionBuildEvent/API/EventLevel.cs b/vsSolutionBuildEvent/API/EventLevel.cs index 27bb75f8..9a78c9cb 100644 --- a/vsSolutionBuildEvent/API/EventLevel.cs +++ b/vsSolutionBuildEvent/API/EventLevel.cs @@ -547,14 +547,13 @@ protected void refreshComponents() var data = AppSettings.CfgManager.Config.Data; - foreach(IComponent c in loader.Soba.Registered) { - if(data.Components == null || data.Components.Length < 1) { - //c.Enabled = true; - continue; - } - - var found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault(); - if(found == null) { + foreach(IComponent c in loader.Soba.Registered) + { + var found = data.Components?.FirstOrDefault(p => p.ClassName == c.GetType().Name); + if(found == null) + { + // Each component provides its default state for IComponent.Enabled + // We'll just continue 'as is' if this component is not presented in config. continue; } diff --git a/vsSolutionBuildEvent/Config.cs b/vsSolutionBuildEvent/Config.cs index b50b2573..9e2becaa 100644 --- a/vsSolutionBuildEvent/Config.cs +++ b/vsSolutionBuildEvent/Config.cs @@ -22,6 +22,7 @@ using net.r_eg.MvsSln.Extensions; using net.r_eg.vsSBE.Configuration; using net.r_eg.vsSBE.Exceptions; +using SysVersion = System.Version; namespace net.r_eg.vsSBE { @@ -41,7 +42,7 @@ public struct Entity /// Config version. /// Version of app managed by Package! /// - public static readonly System.Version Version = new System.Version(0, 9); + public static readonly SysVersion Version = new SysVersion(0, 12, 4); /// /// To file system @@ -144,84 +145,70 @@ public void unload() protected virtual bool loadByLink(string link) { InRAM = false; - Log.Debug("Configuration: trying to load - '{0}'", link); + var newCfg = new SolutionEvents(); + try { - using(StreamReader stream = new StreamReader(link, Encoding.UTF8, true)) - { - Data = deserialize(stream); - if(Data == null) { - throw new UnspecSBEException("file is empty"); - } - compatibility(stream); - } - Log.Info("Loaded settings (v{0}): '{1}'", Data.Header.Compatibility, Settings.WPath); + Data = loadJsonConfig(link); + warnAboutJsonConfig(SysVersion.Parse(Data.Header.Compatibility)); } catch(FileNotFoundException) { - Data = new SolutionEvents(); + Data = newCfg; InRAM = true; Log.Info("Initialized with new settings."); } catch(Newtonsoft.Json.JsonException ex) { - Data = _xmlTryUpgrade(link, ex); + warnAboutXmlConfig(); + Log.Error($"Incorrect configuration data: {ex.Message}"); + Data = newCfg; //xml -> json 0.8-0.9 } catch(Exception ex) { - Log.Error("Configuration file is corrupt - '{0}'", ex.Message); - Data = new SolutionEvents(); //TODO: actions in UI, e.g.: restore, new.. + Log.Error($"Configuration file `{link}` is corrupted: {ex.Message}"); + Data = newCfg; //TODO: actions in UI, e.g.: restore, new.. InRAM = true; } - // Now we work with latest version + // Now we'll work with latest version Data.Header.Compatibility = Entity.Version.ToString(); Updated(this, new DataArgs() { Data = Data }); return !InRAM; } - /// - /// Checks version and reorganizes structure if needed.. - /// - /// - private void compatibility(StreamReader stream) + private SolutionEvents loadJsonConfig(string link) { - System.Version cfg = System.Version.Parse(Data.Header.Compatibility); + using(StreamReader stream = new StreamReader(link, Encoding.UTF8, true)) + { + var ret = deserialize(stream); + if(ret == null) { + throw new UnspecSBEException("file is empty"); + } - if(cfg.Major > Entity.Version.Major || (cfg.Major == Entity.Version.Major && cfg.Minor > Entity.Version.Minor)) { - Log.Warn( - "Version {0} of configuration file is higher supported version {1}. Please update application. Several settings may be not correctly loaded.", - cfg.ToString(2), Entity.Version.ToString(2) - ); + Log.Info($"Loaded settings (v{ ret.Header.Compatibility}): '{Settings.WPath}'"); + return ret; } + } - if(cfg.Major == 0 && cfg.Minor < 4) + private void warnAboutJsonConfig(SysVersion cfgVer) + { + if(cfgVer > Entity.Version) { - Log._.show(); - Log.Info("Upgrading configuration for <= v0.3.x"); - //Upgrade.Migration03_04.migrate(stream); - Log.Warn("[Obsolete] Not supported. Use of any v0.4.x - v0.8.x for upgrading <= v0.3.x"); + Log.Warn( + $"Configuration file v{cfgVer} is higher than supported v{Entity.Version}. Update app for best known behavior." + ); + return; } } - /// - /// Upgrades from xml. - /// - /// Configuration file - /// - /// - private ISolutionEvents _xmlTryUpgrade(string file, Newtonsoft.Json.JsonException inner) + private void warnAboutXmlConfig() { - try { - ISolutionEvents ret = Upgrade.v08.Migration08_09.migrate(file); - Log.Info("Successfully upgraded settings. *Save manually! :: -> {0}", Entity.NAME); - return ret; - } - catch(Exception ex) { - Log.Error("Incorrect configuration data: '{0}' -> '{1}'. Initialize new.", inner.Message, ex.Message); - } - return new SolutionEvents(); + const string _MSG = "Please use any version from `{0}` for auto-upgrading configuration `{1}`."; + + Log.Warn(_MSG, "0.4.x - 0.8.x", "<= v0.3"); + Log.Warn(_MSG, "0.9.x - 1.14.0", "<= v0.8"); } } } diff --git a/vsSolutionBuildEvent/Configuration/Header.cs b/vsSolutionBuildEvent/Configuration/Header.cs index cac7c965..976664a0 100644 --- a/vsSolutionBuildEvent/Configuration/Header.cs +++ b/vsSolutionBuildEvent/Configuration/Header.cs @@ -20,25 +20,12 @@ namespace net.r_eg.vsSBE.Configuration { public class Header { - public string[] _ = new string[] + public string[] _ => new string[] { - " This requires vsSolutionBuildEvent engine.", - " Free plugin for Visual Studio or MSBuild Tools:", - " * https://github.com/3F/vsSolutionBuildEvent" + " This file for vsSolutionBuildEvent ", + " https://github.com/3F/vsSolutionBuildEvent " }; - /// - /// Compatibility of configurations. - /// - public string Compatibility - { - get { return compatibility; } - set { compatibility = value; } - } - /// - /// The version below used by default if current attr is not found. - /// - private string compatibility = "0.1"; - + public string Compatibility { get; set; } = "0.1"; } } diff --git a/vsSolutionBuildEvent/Configuration/User/Global.cs b/vsSolutionBuildEvent/Configuration/User/Global.cs index 3f95ca13..93bd4729 100644 --- a/vsSolutionBuildEvent/Configuration/User/Global.cs +++ b/vsSolutionBuildEvent/Configuration/User/Global.cs @@ -22,36 +22,11 @@ namespace net.r_eg.vsSBE.Configuration.User { public class Global: IGlobal { - /// - /// Debug mode for application. - /// - public bool DebugMode - { - get; - set; - } + /// + public bool DebugMode { get; set; } - /// - /// Suppress the 'Command__' property for main configuration if true. - /// - /// This property is temporary and used for compatibility with format v0.9 of conf. file. - /// However, this can be inconvenient and while we can't upgrade format, we should also provide a some option to turn off one field at least. - /// - public bool SuppressDualCommand - { - get; - set; - } - - /// - /// List of levels for disabling from logger. - /// + /// //[JsonProperty(TypeNameHandling = TypeNameHandling.None, ItemTypeNameHandling = TypeNameHandling.All)] - public Dictionary LogIgnoreLevels - { - get { return logIgnoreLevels; } - set { logIgnoreLevels = value; } - } - private Dictionary logIgnoreLevels = new Dictionary(); + public Dictionary LogIgnoreLevels { get; set; } = new Dictionary(); } } diff --git a/vsSolutionBuildEvent/Configuration/User/IGlobal.cs b/vsSolutionBuildEvent/Configuration/User/IGlobal.cs index 18760082..c16daef5 100644 --- a/vsSolutionBuildEvent/Configuration/User/IGlobal.cs +++ b/vsSolutionBuildEvent/Configuration/User/IGlobal.cs @@ -30,14 +30,6 @@ public interface IGlobal /// bool DebugMode { get; set; } - /// - /// Suppress the 'Command__' property for main configuration if true. - /// - /// This property is temporary and used for compatibility with format v0.9 of conf. file. - /// However, this can be inconvenient and while we can't upgrade format, we should also provide a some option to turn off one field at least. - /// - bool SuppressDualCommand { get; set; } - /// /// List of levels for disabling from logger. /// diff --git a/vsSolutionBuildEvent/Events/CommandEvent.cs b/vsSolutionBuildEvent/Events/CommandEvent.cs index 5ad85622..47fe3421 100644 --- a/vsSolutionBuildEvent/Events/CommandEvent.cs +++ b/vsSolutionBuildEvent/Events/CommandEvent.cs @@ -26,15 +26,8 @@ namespace net.r_eg.vsSBE.Events /// public class CommandEvent: SBEEvent, ISolutionEvent, ICommandEvent { - /// - /// Conditions of work Commands - /// + /// [JsonProperty(TypeNameHandling = TypeNameHandling.All)] - public IFilter[] Filters - { - get { return filters; } - set { filters = value; } - } - private IFilter[] filters; + public IFilter[] Filters { get; set; } } } diff --git a/vsSolutionBuildEvent/Events/EventProcess.cs b/vsSolutionBuildEvent/Events/EventProcess.cs index abd314aa..e3a99794 100644 --- a/vsSolutionBuildEvent/Events/EventProcess.cs +++ b/vsSolutionBuildEvent/Events/EventProcess.cs @@ -16,38 +16,46 @@ * along with this program. If not, see . */ +using net.r_eg.MvsSln.Extensions; + namespace net.r_eg.vsSBE.Events { public class EventProcess: IEventProcess { - /// - /// Waiting completion - /// - public bool Waiting - { - get { return waiting; } - set { waiting = value; } - } - private bool waiting = true; + /// + public bool Waiting { get; set; } = true; + + /// + public bool Hidden { get; set; } = true; + + /// + public int TimeLimit { get; set; } = 30; - /// - /// Hiding of processing or not - /// - public bool Hidden + public static bool operator ==(EventProcess a, EventProcess b) => a.Equals(b); + + public static bool operator !=(EventProcess a, EventProcess b) => !(a == b); + + public override bool Equals(object obj) { - get { return hidden; } - set { hidden = value; } + if(obj is null || !(obj is EventProcess)) { + return false; + } + + var b = (EventProcess)obj; + + return Waiting == b.Waiting + && Hidden == b.Hidden + && TimeLimit == b.TimeLimit; } - private bool hidden = true; - /// - /// How long to wait the execution, in seconds. 0 value - infinitely - /// - public int TimeLimit + public override int GetHashCode() { - get { return timeLimit; } - set { timeLimit = value; } + return 0.CalculateHashCode + ( + Waiting, + Hidden, + TimeLimit + ); } - private int timeLimit = 30; } -} +} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Events/Mapping/Json/ModeCommand.cs b/vsSolutionBuildEvent/Events/Mapping/Json/ModeCommand.cs index 2099776f..1dcae4dc 100644 --- a/vsSolutionBuildEvent/Events/Mapping/Json/ModeCommand.cs +++ b/vsSolutionBuildEvent/Events/Mapping/Json/ModeCommand.cs @@ -38,12 +38,12 @@ public abstract class ModeCommand: ICommand /// And, how about all as a ICommandArray ? this used with ModeOperation for example. /// [Browsable(false)] + [JsonIgnore] // "Command" removed after 1.14.0. Minimal 0.12.4 public string Command { - get { - return command; - } - set { + get => command; + set + { if(value != null) { _command = value.Replace("\r\n", "\n").Split('\n'); } @@ -59,14 +59,9 @@ public string Command [JsonProperty(PropertyName = "Command__")] protected string[] _Command { - get + get => _command; + set { - if(Settings.CfgUser != null && Settings.CfgUser.Global.SuppressDualCommand) { - return null; - } - return _command; - } - set { if(value != null) { command = String.Join("\n", value); } diff --git a/vsSolutionBuildEvent/Events/SBEEvent.cs b/vsSolutionBuildEvent/Events/SBEEvent.cs index 83f49cee..a14c6b91 100644 --- a/vsSolutionBuildEvent/Events/SBEEvent.cs +++ b/vsSolutionBuildEvent/Events/SBEEvent.cs @@ -24,102 +24,36 @@ namespace net.r_eg.vsSBE.Events { public class SBEEvent: ISolutionEvent { - /// - /// Status of activation. - /// - public bool Enabled - { - get { return enabled; } - set { enabled = value; } - } - private bool enabled = false; + private Guid id = Guid.NewGuid(); - /// - /// Unique name for identification. - /// - public string Name - { - get; - set; - } + /// + public bool Enabled { get; set; } = true; - /// - /// About event. - /// - public string Caption - { - get { return caption; } - set { caption = value; } - } - private string caption = String.Empty; + /// + public string Name { get; set; } - /// - /// Support of the MSBuild engine. - /// - public bool SupportMSBuild - { - get { return supportMSBuild; } - set { supportMSBuild = value; } - } - private bool supportMSBuild = true; + /// + public string Caption { get; set; } = string.Empty; - /// - /// Support of the SBE-Scripts engine. - /// - public bool SupportSBEScripts - { - get { return supportSBEScripts; } - set { supportSBEScripts = value; } - } - private bool supportSBEScripts = true; + /// + public bool SupportMSBuild { get; set; } = true; - /// - /// Ignore all actions if the build failed - /// - public bool IgnoreIfBuildFailed - { - get { return ignoreIfBuildFailed; } - set { ignoreIfBuildFailed = value; } - } - private bool ignoreIfBuildFailed = false; + /// + public bool SupportSBEScripts { get; set; } = true; - /// - /// The context of action. - /// - public BuildType BuildType - { - get { return buildType; } - set { buildType = value; } - } - private BuildType buildType = BuildType.Common; + /// + public bool IgnoreIfBuildFailed { get; set; } = false; - /// - /// User interaction. - /// Waiting until user presses yes/no etc, - /// - public bool Confirmation - { - get { return confirmation; } - set { confirmation = value; } - } - private bool confirmation = false; - - /// - /// Run only for a specific configuration of solution - /// strings format as: - /// 'configname'|'platformname' - /// Compatible with: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivscfg.get_displayname.aspx - /// - public string[] ToConfiguration - { - get { return toConfiguration; } - set { toConfiguration = value; } - } - private string[] toConfiguration = null; - - /// - /// Run for selected projects with the Execution-Order - /// + /// + public BuildType BuildType { get; set; } = BuildType.Common; + + /// + public bool Confirmation { get; set; } = false; + + /// + public string[] ToConfiguration { get; set; } = null; + + /// [JsonProperty(TypeNameHandling = TypeNameHandling.All)] public IExecutionOrder[] ExecutionOrder { @@ -128,9 +62,7 @@ public IExecutionOrder[] ExecutionOrder } private ExecutionOrder[] executionOrder = null; - /// - /// Handling process - /// + /// [JsonProperty(TypeNameHandling = TypeNameHandling.All)] public IEventProcess Process { @@ -139,27 +71,23 @@ public IEventProcess Process } private EventProcess process = new EventProcess(); - /// - /// Used mode. - /// + /// [JsonProperty(TypeNameHandling = TypeNameHandling.All)] - public IMode Mode - { - get { return mode; } - set { mode = value; } - } - private IMode mode = new ModeFile(); + public IMode Mode { get; set; } = new ModeFile(); - /// - /// Unique identifier at runtime. - /// + /// [JsonIgnore] - public Guid Id - { - get { - return id; - } - } - private Guid id = Guid.NewGuid(); + public Guid Id => id; + + public bool ShouldSerializeEnabled() => !Enabled; + public bool ShouldSerializeCaption() => !string.IsNullOrEmpty(Caption); + public bool ShouldSerializeSupportMSBuild() => !SupportMSBuild; + public bool ShouldSerializeSupportSBEScripts() => !SupportSBEScripts; + public bool ShouldSerializeIgnoreIfBuildFailed() => IgnoreIfBuildFailed; + public bool ShouldSerializeBuildType() => BuildType != BuildType.Common; + public bool ShouldSerializeConfirmation() => Confirmation; + public bool ShouldSerializeToConfiguration() => ToConfiguration?.Length > 0; + public bool ShouldSerializeExecutionOrder() => ExecutionOrder?.Length > 0; + public bool ShouldSerializeProcess() => new EventProcess() != Process as EventProcess; } } diff --git a/vsSolutionBuildEvent/Events/SBEEventEW.cs b/vsSolutionBuildEvent/Events/SBEEventEW.cs index dfefc505..f6dff1d9 100644 --- a/vsSolutionBuildEvent/Events/SBEEventEW.cs +++ b/vsSolutionBuildEvent/Events/SBEEventEW.cs @@ -24,27 +24,11 @@ namespace net.r_eg.vsSBE.Events /// Support of the Errors + Warnings Event type /// public class SBEEventEW: SBEEvent, ISolutionEvent, ISolutionEventEW - { - /// - /// List of monitored codes - /// Format: [any text] {error | warning} code####: localizable string - /// http://msdn.microsoft.com/en-us/library/yxkt8b26%28v=vs.120%29.aspx - /// - public List Codes - { - get { return codes; } - set { codes = value; } - } - private List codes = new List(); + { + /// + public List Codes { get; set; } = new List(); - /// - /// Whitelist or Blacklist for current codes - /// - public bool IsWhitelist - { - get { return isWhitelist; } - set { isWhitelist = value; } - } - private bool isWhitelist = true; + /// + public bool IsWhitelist { get; set; } = true; } } diff --git a/vsSolutionBuildEvent/Events/SBEEventOWP.cs b/vsSolutionBuildEvent/Events/SBEEventOWP.cs index 17c36735..ee431ae5 100644 --- a/vsSolutionBuildEvent/Events/SBEEventOWP.cs +++ b/vsSolutionBuildEvent/Events/SBEEventOWP.cs @@ -25,14 +25,8 @@ namespace net.r_eg.vsSBE.Events /// public class SBEEventOWP: SBEEvent, ISolutionEvent, ISolutionEventOWP { - /// - /// List of statements from OWP. - /// + /// [JsonProperty(TypeNameHandling = TypeNameHandling.All, ItemTypeNameHandling = TypeNameHandling.All)] - public IMatchWords[] Match - { - get; - set; - } + public IMatchWords[] Match { get; set; } } } diff --git a/vsSolutionBuildEvent/Pkg.cs b/vsSolutionBuildEvent/Pkg.cs index 51f37c58..f67c7b80 100644 --- a/vsSolutionBuildEvent/Pkg.cs +++ b/vsSolutionBuildEvent/Pkg.cs @@ -224,6 +224,7 @@ public int OnAfterCloseSolution(object pUnkReserved) mainToolCmd.closeConfigForm(); sToolCmd?.detachEvents(); + resetErrors(); //Log._.paneDetach((IVsOutputWindow)GetGlobalService(typeof(SVsOutputWindow))); return VSConstants.S_OK; } @@ -239,10 +240,10 @@ public int OnAfterCloseSolution(object pUnkReserved) public int UpdateSolution_Begin(ref int pfCancelUpdate) { - try { + try + { UI.Plain.State.BuildBegin(); - sToolCmd?.ToolContent.resetCounter(); - errorList.clear(); + resetErrors(); } catch(Exception ex) { Log.Debug("Failed reset of warnings counter: '{0}'", ex.Message); @@ -481,6 +482,12 @@ private void initAppEvents(CancellationToken cancellationToken) }; } + private void resetErrors() + { + sToolCmd?.ToolContent.resetCounter(); + errorList.clear(); + } + private void _showCriticalVsMsg(IVsUIShell uiShell, Exception ex) { #if VSSDK_15_AND_NEW diff --git a/vsSolutionBuildEvent/SolutionEvents.cs b/vsSolutionBuildEvent/SolutionEvents.cs index 3d59596a..948b02e7 100644 --- a/vsSolutionBuildEvent/SolutionEvents.cs +++ b/vsSolutionBuildEvent/SolutionEvents.cs @@ -20,159 +20,52 @@ using net.r_eg.SobaScript.Exceptions; using net.r_eg.vsSBE.Configuration; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; namespace net.r_eg.vsSBE { [Serializable] public class SolutionEvents: ISolutionEvents { - /// - /// Header of information. - /// - public Header Header - { - get { return header; } - set { header = value; } - } - [NonSerialized] - private Header header = new Header(); + /// + public Header Header { get; set; } = new Header(); - /// - /// Configuration of components. - /// - public Component[] Components - { - get; - set; - } - - /// - /// Before assembling. - /// - public SBEEvent[] PreBuild - { - get { return preBuild; } - set { preBuild = value; } - } - [NonSerialized] - private SBEEvent[] preBuild = new SBEEvent[] { new SBEEvent() }; + /// + public Component[] Components { get; set; } - /// - /// After assembling. - /// - public SBEEvent[] PostBuild - { - get { return postBuild; } - set { postBuild = value; } - } - [NonSerialized] - private SBEEvent[] postBuild = new SBEEvent[] { }; + /// + public SBEEvent[] PreBuild { get; set; } = new[] { new SBEEvent() }; - /// - /// When build has been canceled by user or when occurs error. - /// - public SBEEvent[] CancelBuild - { - get { return cancelBuild; } - set { cancelBuild = value; } - } - [NonSerialized] - private SBEEvent[] cancelBuild = new SBEEvent[] { }; + /// + public SBEEvent[] PostBuild { get; set; } = new SBEEvent[] { }; - /// - /// Warnings during assembly processing. - /// - public SBEEventEW[] WarningsBuild - { - get { return warningsBuild; } - set { warningsBuild = value; } - } - [NonSerialized] - private SBEEventEW[] warningsBuild = new SBEEventEW[] { }; + /// + public SBEEvent[] CancelBuild { get; set; } = new SBEEvent[] { }; - /// - /// Errors during assembly processing. - /// - public SBEEventEW[] ErrorsBuild - { - get { return errorsBuild; } - set { errorsBuild = value; } - } - [NonSerialized] - private SBEEventEW[] errorsBuild = new SBEEventEW[] { }; + /// + public SBEEventEW[] WarningsBuild { get; set; } = new SBEEventEW[] { }; - /// - /// Customization from the Output. - /// - public SBEEventOWP[] OWPBuild - { - get { return owpBuild; } - set { owpBuild = value; } - } - [NonSerialized] - private SBEEventOWP[] owpBuild = new SBEEventOWP[] { }; + /// + public SBEEventEW[] ErrorsBuild { get; set; } = new SBEEventEW[] { }; - /// - /// Transmission of the build-data to outer handler. - /// - public SBETransmitter[] Transmitter - { - get { return transmitter; } - set { transmitter = value; } - } - [NonSerialized] - private SBETransmitter[] transmitter = new SBETransmitter[] { }; + /// + public SBEEventOWP[] OWPBuild { get; set; } = new SBEEventOWP[] { }; - /// - /// Provides command events from EnvDTE. - /// - public CommandEvent[] CommandEvent - { - get { return commandEvent; } - set { commandEvent = value; } - } - [NonSerialized] - private CommandEvent[] commandEvent = new CommandEvent[] { }; + /// + public SBETransmitter[] Transmitter { get; set; } = new SBETransmitter[] { }; - /// - /// All processes with internal logging. - /// - public LoggingEvent[] Logging - { - get { return logging; } - set { logging = value; } - } - [NonSerialized] - private LoggingEvent[] logging = new LoggingEvent[] { }; + /// + public CommandEvent[] CommandEvent { get; set; } = new CommandEvent[] { }; - /// - /// Solution has been opened. - /// - public SBEEvent[] SlnOpened - { - get { return slnOpened; } - set { slnOpened = value; } - } - [NonSerialized] - private SBEEvent[] slnOpened = new SBEEvent[] { }; + /// + public LoggingEvent[] Logging { get; set; } = new LoggingEvent[] { }; - /// - /// Solution has been closed. - /// - public SBEEvent[] SlnClosed - { - get { return slnClosed; } - set { slnClosed = value; } - } - [NonSerialized] - private SBEEvent[] slnClosed = new SBEEvent[] { }; + /// + public SBEEvent[] SlnOpened { get; set; } = new SBEEvent[] { }; + /// + public SBEEvent[] SlnClosed { get; set; } = new SBEEvent[] { }; - /// - /// The event by type. - /// - /// Available event. + /// /// public ISolutionEvent[] getEvent(SolutionEventType type) { @@ -215,5 +108,18 @@ public ISolutionEvent[] getEvent(SolutionEventType type) throw new NotFoundException(type); } + + public bool ShouldSerializeComponents() => Components?.Length > 0; + public bool ShouldSerializePreBuild() => PreBuild?.Length > 0; + public bool ShouldSerializePostBuild() => PostBuild?.Length > 0; + public bool ShouldSerializeCancelBuild() => CancelBuild?.Length > 0; + public bool ShouldSerializeWarningsBuild() => WarningsBuild?.Length > 0; + public bool ShouldSerializeErrorsBuild() => ErrorsBuild?.Length > 0; + public bool ShouldSerializeOWPBuild() => OWPBuild?.Length > 0; + public bool ShouldSerializeTransmitter() => Transmitter?.Length > 0; + public bool ShouldSerializeCommandEvent() => CommandEvent?.Length > 0; + public bool ShouldSerializeLogging() => Logging?.Length > 0; + public bool ShouldSerializeSlnOpened() => SlnOpened?.Length > 0; + public bool ShouldSerializeSlnClosed() => SlnClosed?.Length > 0; } } diff --git a/vsSolutionBuildEvent/UI/WForms/EventsFrm.Designer.cs b/vsSolutionBuildEvent/UI/WForms/EventsFrm.Designer.cs index 2d941c68..bd6992df 100644 --- a/vsSolutionBuildEvent/UI/WForms/EventsFrm.Designer.cs +++ b/vsSolutionBuildEvent/UI/WForms/EventsFrm.Designer.cs @@ -86,8 +86,6 @@ private void InitializeComponent() this.toolStripMenuPlugin = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuCopyPath = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuPluginDir = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); - this.menuCfgSuppressDualCmd = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuSBEPanel = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuHelp = new System.Windows.Forms.ToolStripSplitButton(); this.tsMenuItemExamples = new System.Windows.Forms.ToolStripMenuItem(); @@ -311,62 +309,62 @@ private void InitializeComponent() this.toolStripSeparator8, this.menuActionsReset}); this.contextMenuActions.Name = "contextMenuManager"; - this.contextMenuActions.Size = new System.Drawing.Size(143, 154); + this.contextMenuActions.Size = new System.Drawing.Size(142, 154); // // menuActionsTogglePanel // this.menuActionsTogglePanel.Name = "menuActionsTogglePanel"; - this.menuActionsTogglePanel.Size = new System.Drawing.Size(142, 22); + this.menuActionsTogglePanel.Size = new System.Drawing.Size(141, 22); this.menuActionsTogglePanel.Text = "Toggle Panel"; this.menuActionsTogglePanel.Click += new System.EventHandler(this.menuActionsTogglePanel_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(138, 6); // // menuActionsAdd // this.menuActionsAdd.Name = "menuActionsAdd"; - this.menuActionsAdd.Size = new System.Drawing.Size(142, 22); + this.menuActionsAdd.Size = new System.Drawing.Size(141, 22); this.menuActionsAdd.Text = "Add"; this.menuActionsAdd.Click += new System.EventHandler(this.menuActionsAdd_Click); // // menuActionsClone // this.menuActionsClone.Name = "menuActionsClone"; - this.menuActionsClone.Size = new System.Drawing.Size(142, 22); + this.menuActionsClone.Size = new System.Drawing.Size(141, 22); this.menuActionsClone.Text = "Clone"; this.menuActionsClone.Click += new System.EventHandler(this.menuActionsClone_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(138, 6); // // menuActionsEdit // this.menuActionsEdit.Name = "menuActionsEdit"; - this.menuActionsEdit.Size = new System.Drawing.Size(142, 22); + this.menuActionsEdit.Size = new System.Drawing.Size(141, 22); this.menuActionsEdit.Text = "Edit Name"; this.menuActionsEdit.Click += new System.EventHandler(this.menuActionsEdit_Click); // // menuActionsRemove // this.menuActionsRemove.Name = "menuActionsRemove"; - this.menuActionsRemove.Size = new System.Drawing.Size(142, 22); + this.menuActionsRemove.Size = new System.Drawing.Size(141, 22); this.menuActionsRemove.Text = "Remove"; this.menuActionsRemove.Click += new System.EventHandler(this.menuActionsRemove_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(138, 6); // // menuActionsReset // this.menuActionsReset.Name = "menuActionsReset"; - this.menuActionsReset.Size = new System.Drawing.Size(142, 22); + this.menuActionsReset.Size = new System.Drawing.Size(141, 22); this.menuActionsReset.Text = "Reset"; this.menuActionsReset.Click += new System.EventHandler(this.menuActionsReset_Click); // @@ -465,7 +463,7 @@ private void InitializeComponent() // this.toolStripMenuApply.Name = "toolStripMenuApply"; this.toolStripMenuApply.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.toolStripMenuApply.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuApply.Size = new System.Drawing.Size(180, 22); this.toolStripMenuApply.Text = "Apply"; this.toolStripMenuApply.Click += new System.EventHandler(this.toolStripMenuApply_Click); // @@ -473,7 +471,7 @@ private void InitializeComponent() // this.menuActionExec.Name = "menuActionExec"; this.menuActionExec.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); - this.menuActionExec.Size = new System.Drawing.Size(154, 22); + this.menuActionExec.Size = new System.Drawing.Size(180, 22); this.menuActionExec.Text = "Execute"; this.menuActionExec.ToolTipText = "Try current action (Common Context)"; this.menuActionExec.Click += new System.EventHandler(this.menuActionExec_Click); @@ -482,14 +480,14 @@ private void InitializeComponent() // this.toolStripMenuReset.Name = "toolStripMenuReset"; this.toolStripMenuReset.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); - this.toolStripMenuReset.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuReset.Size = new System.Drawing.Size(180, 22); this.toolStripMenuReset.Text = "Reset"; this.toolStripMenuReset.Click += new System.EventHandler(this.toolStripMenuReset_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(151, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6); // // toolStripMenuTools // @@ -502,53 +500,53 @@ private void InitializeComponent() this.toolStripMenuDTECmdExec, this.menuItemSniffer}); this.toolStripMenuTools.Name = "toolStripMenuTools"; - this.toolStripMenuTools.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuTools.Size = new System.Drawing.Size(180, 22); this.toolStripMenuTools.Text = "Tools"; // // menuSBEScript // this.menuSBEScript.Name = "menuSBEScript"; - this.menuSBEScript.Size = new System.Drawing.Size(215, 22); + this.menuSBEScript.Size = new System.Drawing.Size(178, 22); this.menuSBEScript.Text = "Testing tool"; this.menuSBEScript.Click += new System.EventHandler(this.menuSBEScript_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(212, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(175, 6); // // toolStripMenuMSBuildProp // this.toolStripMenuMSBuildProp.Name = "toolStripMenuMSBuildProp"; - this.toolStripMenuMSBuildProp.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuMSBuildProp.Size = new System.Drawing.Size(178, 22); this.toolStripMenuMSBuildProp.Text = "MSBuild Properties"; this.toolStripMenuMSBuildProp.Click += new System.EventHandler(this.toolStripMenuMSBuildProp_Click); // // toolStripMenuEvaluatingProperty // this.toolStripMenuEvaluatingProperty.Name = "toolStripMenuEvaluatingProperty"; - this.toolStripMenuEvaluatingProperty.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuEvaluatingProperty.Size = new System.Drawing.Size(178, 22); this.toolStripMenuEvaluatingProperty.Text = "Evaluate Property"; this.toolStripMenuEvaluatingProperty.Click += new System.EventHandler(this.toolStripMenuEvaluatingProperty_Click); // // toolStripMenuDTECmd // this.toolStripMenuDTECmd.Name = "toolStripMenuDTECmd"; - this.toolStripMenuDTECmd.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuDTECmd.Size = new System.Drawing.Size(178, 22); this.toolStripMenuDTECmd.Text = "DTE-Commands"; this.toolStripMenuDTECmd.Click += new System.EventHandler(this.toolStripMenuDTECmd_Click); // // toolStripMenuDTECmdExec // this.toolStripMenuDTECmdExec.Name = "toolStripMenuDTECmdExec"; - this.toolStripMenuDTECmdExec.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuDTECmdExec.Size = new System.Drawing.Size(178, 22); this.toolStripMenuDTECmdExec.Text = "Execute commands"; this.toolStripMenuDTECmdExec.Click += new System.EventHandler(this.toolStripMenuDTECmdExec_Click); // // menuItemSniffer // this.menuItemSniffer.Name = "menuItemSniffer"; - this.menuItemSniffer.Size = new System.Drawing.Size(215, 22); + this.menuItemSniffer.Size = new System.Drawing.Size(178, 22); this.menuItemSniffer.Text = "EnvDTE Sniffer"; this.menuItemSniffer.Click += new System.EventHandler(this.menuItemSniffer_Click); // @@ -557,7 +555,7 @@ private void InitializeComponent() this.menuWizards.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuWizardVersion}); this.menuWizards.Name = "menuWizards"; - this.menuWizards.Size = new System.Drawing.Size(154, 22); + this.menuWizards.Size = new System.Drawing.Size(180, 22); this.menuWizards.Text = "Wizards"; // // menuWizardVersion @@ -573,7 +571,7 @@ private void InitializeComponent() this.menuTplTargets, this.menuTplCSharp}); this.toolStripMenuTpl.Name = "toolStripMenuTpl"; - this.toolStripMenuTpl.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuTpl.Size = new System.Drawing.Size(180, 22); this.toolStripMenuTpl.Text = "Templates"; // // menuTplTargets @@ -581,7 +579,7 @@ private void InitializeComponent() this.menuTplTargets.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuTplTargetsDefault}); this.menuTplTargets.Name = "menuTplTargets"; - this.menuTplTargets.Size = new System.Drawing.Size(146, 22); + this.menuTplTargets.Size = new System.Drawing.Size(145, 22); this.menuTplTargets.Text = "Targets Mode"; // // menuTplTargetsDefault @@ -596,7 +594,7 @@ private void InitializeComponent() this.menuTplCSharp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuTplCSharpDefault}); this.menuTplCSharp.Name = "menuTplCSharp"; - this.menuTplCSharp.Size = new System.Drawing.Size(146, 22); + this.menuTplCSharp.Size = new System.Drawing.Size(145, 22); this.menuTplCSharp.Text = "C# Mode"; // // menuTplCSharpDefault @@ -609,7 +607,7 @@ private void InitializeComponent() // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(151, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(177, 6); // // toolStripMenuCI // @@ -617,7 +615,7 @@ private void InitializeComponent() this.toolStripMenuCIMSBuild, this.toolStripMenuDevenv}); this.toolStripMenuCI.Name = "toolStripMenuCI"; - this.toolStripMenuCI.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuCI.Size = new System.Drawing.Size(180, 22); this.toolStripMenuCI.Text = "CI Utilities"; // // toolStripMenuCIMSBuild @@ -637,58 +635,42 @@ private void InitializeComponent() // toolStripMenuAPI // this.toolStripMenuAPI.Name = "toolStripMenuAPI"; - this.toolStripMenuAPI.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuAPI.Size = new System.Drawing.Size(180, 22); this.toolStripMenuAPI.Text = "API"; this.toolStripMenuAPI.Click += new System.EventHandler(this.toolStripMenuAPI_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(151, 6); + this.toolStripSeparator11.Size = new System.Drawing.Size(177, 6); // // toolStripMenuPlugin // this.toolStripMenuPlugin.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuCopyPath, - this.toolStripMenuPluginDir, - this.toolStripSeparator12, - this.menuCfgSuppressDualCmd}); + this.toolStripMenuPluginDir}); this.toolStripMenuPlugin.Name = "toolStripMenuPlugin"; - this.toolStripMenuPlugin.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuPlugin.Size = new System.Drawing.Size(180, 22); this.toolStripMenuPlugin.Text = "Plugin"; // // toolStripMenuCopyPath // this.toolStripMenuCopyPath.Name = "toolStripMenuCopyPath"; - this.toolStripMenuCopyPath.Size = new System.Drawing.Size(245, 22); + this.toolStripMenuCopyPath.Size = new System.Drawing.Size(216, 22); this.toolStripMenuCopyPath.Text = "Copy path to plugin"; this.toolStripMenuCopyPath.Click += new System.EventHandler(this.toolStripMenuCopyPath_Click); // // toolStripMenuPluginDir // this.toolStripMenuPluginDir.Name = "toolStripMenuPluginDir"; - this.toolStripMenuPluginDir.Size = new System.Drawing.Size(245, 22); + this.toolStripMenuPluginDir.Size = new System.Drawing.Size(216, 22); this.toolStripMenuPluginDir.Text = "Open directory with plugin"; this.toolStripMenuPluginDir.Click += new System.EventHandler(this.toolStripMenuPluginDir_Click); // - // toolStripSeparator12 - // - this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(242, 6); - // - // menuCfgSuppressDualCmd - // - this.menuCfgSuppressDualCmd.Name = "menuCfgSuppressDualCmd"; - this.menuCfgSuppressDualCmd.Size = new System.Drawing.Size(245, 22); - this.menuCfgSuppressDualCmd.Text = "Suppress \'Command__\' property"; - this.menuCfgSuppressDualCmd.ToolTipText = "The \'Command__\' property in configuration file is temporary and used for compatib" + - "ility with format v0.9.\r\nHowever, you can disable this if needed."; - this.menuCfgSuppressDualCmd.Click += new System.EventHandler(this.menuCfgSuppressDualCmd_Click); - // // toolStripMenuSBEPanel // this.toolStripMenuSBEPanel.Name = "toolStripMenuSBEPanel"; - this.toolStripMenuSBEPanel.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuSBEPanel.Size = new System.Drawing.Size(180, 22); this.toolStripMenuSBEPanel.Text = "Quick Panel"; this.toolStripMenuSBEPanel.Click += new System.EventHandler(this.toolStripMenuSBEPanel_Click); // @@ -1225,7 +1207,7 @@ private void InitializeComponent() this.checkBoxSBEScriptSupport.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxSBEScriptSupport.Location = new System.Drawing.Point(8, 105); this.checkBoxSBEScriptSupport.Name = "checkBoxSBEScriptSupport"; - this.checkBoxSBEScriptSupport.Size = new System.Drawing.Size(120, 17); + this.checkBoxSBEScriptSupport.Size = new System.Drawing.Size(116, 17); this.checkBoxSBEScriptSupport.TabIndex = 21; this.checkBoxSBEScriptSupport.Text = "SobaScript support"; this.checkBoxSBEScriptSupport.UseVisualStyleBackColor = true; @@ -1644,7 +1626,7 @@ private void InitializeComponent() this.owpRemove}); dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -1786,7 +1768,7 @@ private void InitializeComponent() this.dgvOrderType}); dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -1992,7 +1974,7 @@ private void InitializeComponent() this.dgvCESniffer.ContextMenuStrip = this.contextMenuSniffer; dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -2170,7 +2152,7 @@ private void InitializeComponent() this.dgvCEFiltersColumnRemove}); dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -2362,7 +2344,7 @@ private void InitializeComponent() this.dgvComponents.ContextMenuStrip = this.contextMenuComponents; dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -2480,7 +2462,7 @@ private void InitializeComponent() this.dgvComponentInfo.ContextMenuStrip = this.contextMenuComponents; dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(248)))), ((int)(((byte)(252)))), ((int)(((byte)(248))))); dataGridViewCellStyle11.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); @@ -2865,8 +2847,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripMenuItem menuItemSniffer; private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; - private System.Windows.Forms.ToolStripMenuItem menuCfgSuppressDualCmd; private System.Windows.Forms.LinkLabel linkAddAction; private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; private System.Windows.Forms.ToolStripMenuItem menuLogMsg; diff --git a/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs b/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs index b2e344bc..dc5015c9 100644 --- a/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs @@ -189,7 +189,6 @@ public EventsFrm(Bootloader loader) #else toolStripMenuVersion.Text = $"v{Version.S_NUM}+{Version.B_SHA1}"; #endif - menuCfgSuppressDualCmd.Checked = Settings.CfgUser.Global.SuppressDualCommand; //TODO: it was before with original dataGridView... need to check with DataGridViewExt and move it inside if still needed foreach(Control ctrl in Util.getControls(this, c => c.GetType() == typeof(DataGridViewExt))) { @@ -1343,11 +1342,6 @@ private void toolStripMenuDebugMode_Click(object sender, EventArgs e) logic.updateUserCfg(); } - private void menuCfgSuppressDualCmd_Click(object sender, EventArgs e) - { - Settings.CfgUser.Global.SuppressDualCommand = menuCfgSuppressDualCmd.Checked = !menuCfgSuppressDualCmd.Checked; - } - private void toolStripMenuSBEPanel_Click(object sender, EventArgs e) { logic.Env.exec("View.vsSBE.Panel"); diff --git a/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs b/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs index 29bb7dd5..bd870baf 100644 --- a/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs +++ b/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs @@ -480,12 +480,9 @@ public void fillComponents(DataGridView grid) bool enabled = c.Enabled; string className = c.GetType().Name; - Configuration.Component[] cfg = SlnEvents.Components; - if(cfg != null && cfg.Length > 0) { - Configuration.Component v = cfg.Where(p => p.ClassName == className).FirstOrDefault(); - if(v != null) { - enabled = v.Enabled; - } + Component v = SlnEvents.Components?.FirstOrDefault(p => p.ClassName == className); + if(v != null) { + enabled = v.Enabled; } cInfo[className] = new List(); @@ -526,9 +523,10 @@ public void fillComponents(DataGridView grid) public void updateComponents(Configuration.Component[] components) { - SlnEvents.Components = components; + SlnEvents.Components = components.Where(c => !c.Enabled).ToArray(); // L-585 + foreach(IComponent c in Loader.Soba.Registered) { - Configuration.Component found = components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault(); + Component found = components.FirstOrDefault(p => p.ClassName == c.GetType().Name); if(found != null) { c.Enabled = found.Enabled; } diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEvent.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEvent.cs deleted file mode 100644 index 2003335e..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEvent.cs +++ /dev/null @@ -1,135 +0,0 @@ - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public interface ISolutionEvent - { - /// - /// execution of shell command - /// - string command { get; set; } - - /// - /// output information to "Output" window or something else... - /// - string caption { get; set; } - - /// - /// status of activate - /// - bool enabled { get; set; } - - /// - /// Hide Process - /// - bool processHide { get; set; } - - /// - /// not close after completion - /// - bool processKeep { get; set; } - - /// - /// processing mode - /// - TModeCommands mode { get; set; } - - /// - /// stream processor - /// - string interpreter { get; set; } - - /// - /// treat newline as - /// - string newline { get; set; } - - /// - /// symbol wrapper for commands or script - /// - string wrapper { get; set; } - - /// - /// Wait until terminates script handling - /// - bool waitForExit { get; set; } - - /// - /// support of MSBuild environment variables (properties) - /// - bool parseVariablesMSBuild { get; set; } - - /// - /// Ignore all actions if the build failed - /// - bool buildFailedIgnore { get; set; } - - /// - /// Run only for a specific configuration of solution - /// strings format as: - /// 'configname'|'platformname' - /// Compatible with: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivscfg.get_displayname.aspx - /// - string[] toConfiguration { get; set; } - - /// - /// Run for selected projects with execution order - /// - TExecutionOrder[] executionOrder { get; set; } - - /// - /// Common Environment Visual Studio. Executes the specified commands - /// TODO: custom list - /// - TOperation dteExec { get; set; } - } - - /// - /// Processing mode - /// - public enum TModeCommands - { - /// - /// external commands - /// - File, - /// - /// command script - /// - Interpreter, - /// - /// DTE commands - /// - Operation, - } - - /// - /// Atomic DTE operation - /// - public class TOperation - { - /// - /// exec-command - /// - public string[] cmd = new string[] { "" }; - /// - /// optional ident - /// - public string caption = ""; - /// - /// Abort operations on first error - /// - public bool abortOnFirstError = false; - } - - public struct TExecutionOrder - { - public string project; - public Type order; - - public enum Type - { - Before, - After - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventEW.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventEW.cs deleted file mode 100644 index ea8fee04..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventEW.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - /// - /// Errors + Warnings - /// - public interface ISolutionEventEW: ISolutionEvent - { - /// - /// list of code#### - /// ..and "for all" if empty - /// - List codes { get; set; } - - /// - /// Whitelist or Blacklist codes - /// - bool isWhitelist { get; set; } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventOWP.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventOWP.cs deleted file mode 100644 index 09523a95..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/ISolutionEventOWP.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - /// - /// Errors + Warnings - /// - public interface ISolutionEventOWP: ISolutionEvent - { - /// - /// List of term - /// - List eventsOWP { get; set; } - } - - public enum TEventOWPTerm - { - Default, - Regexp, - Wildcards - } - - /// - /// Customization of OutputWindowPane - /// - public struct TEventOWP - { - /// - /// various condition - /// - public string term { get; set; } - - /// - /// type of recognition - /// - public TEventOWPTerm type { get; set; } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEvent.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEvent.cs deleted file mode 100644 index 4f6c5a99..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEvent.cs +++ /dev/null @@ -1,157 +0,0 @@ - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public class SBEEvent: ISolutionEvent - { - private string _command = ""; - /// - /// execution of shell command - /// - public string command - { - get { return _command; } - set { _command = value; } - } - - private string _caption = ""; - /// - /// output information to "Output" window or something else... - /// - public string caption - { - get { return _caption; } - set { _caption = value; } - } - - private bool _enabled = false; - /// - /// status of activate - /// - public bool enabled - { - get { return _enabled; } - set { _enabled = value; } - } - - private bool _processHide = true; - public bool processHide - { - get { return _processHide; } - set { _processHide = value; } - } - - private TModeCommands _mode = TModeCommands.Interpreter; - /// - /// processing mode - /// - public TModeCommands mode - { - get { return _mode; } - set { _mode = value; } - } - - private bool _processKeep = false; - /// - /// not close after completion - /// - public bool processKeep - { - get { return _processKeep; } - set { _processKeep = value; } - } - - private string _interpreter = ""; - /// - /// stream processor - /// - public string interpreter - { - get { return _interpreter; } - set { _interpreter = value; } - } - - private string _newline = ""; - /// - /// treat newline as - /// - public string newline - { - get { return _newline; } - set { _newline = value; } - } - - private string _wrapper = ""; - /// - /// symbol wrapper for commands or script - /// - public string wrapper - { - get { return _wrapper; } - set { _wrapper = value; } - } - - private bool _waitForExit = true; - /// - /// Wait until terminates script handling - /// - public bool waitForExit - { - get { return _waitForExit; } - set { _waitForExit = value; } - } - - private bool _parseVariablesMSBuild = true; - /// - /// support of MSBuild environment variables (properties) - /// - public bool parseVariablesMSBuild - { - get { return _parseVariablesMSBuild; } - set { _parseVariablesMSBuild = value; } - } - - private bool _buildFailedIgnore = false; - /// - /// Ignore all actions if the build failed - /// - public bool buildFailedIgnore - { - get { return _buildFailedIgnore; } - set { _buildFailedIgnore = value; } - } - - private string[] _toConfiguration = null; - /// - /// Run only for a specific configuration of solution - /// strings format as: - /// 'configname'|'platformname' - /// Compatible with: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivscfg.get_displayname.aspx - /// - public string[] toConfiguration - { - get { return _toConfiguration; } - set { _toConfiguration = value; } - } - - private TExecutionOrder[] _executionOrder; - /// - /// Run for selected projects with execution order - /// - public TExecutionOrder[] executionOrder - { - get { return _executionOrder; } - set { _executionOrder = value; } - } - - private TOperation _dteExec = new TOperation(); - /// - /// Common Environment Visual Studio. Executes the specified commands - /// TODO: custom list - /// - public TOperation dteExec - { - get { return _dteExec; } - set { _dteExec = value; } - } - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventEW.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventEW.cs deleted file mode 100644 index ff9ae96d..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventEW.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public class SBEEventEW: SBEEvent, ISolutionEventEW - { - private List _codes = new List(); - /// - /// list of code#### - /// ..and "for all" if empty - /// - public List codes - { - get { return _codes; } - set { _codes = value; } - } - - private bool _isWhitelist = true; - /// - /// Whitelist or Blacklist codes - /// - public bool isWhitelist - { - get { return _isWhitelist; } - set { _isWhitelist = value; } - } - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventOWP.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventOWP.cs deleted file mode 100644 index afc03ba6..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SBEEventOWP.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public class SBEEventOWP: SBEEvent, ISolutionEventOWP - { - private List _eventsOWP = new List(); - /// - /// List of term - /// - public List eventsOWP - { - get { return _eventsOWP; } - set { _eventsOWP = value; } - } - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SBESettings.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SBESettings.cs deleted file mode 100644 index c9506313..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SBESettings.cs +++ /dev/null @@ -1,23 +0,0 @@ - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public class SBESettings - { - /// - /// this value used by default if current attr not found after deserialize - /// :: v0.2.x/v0.1.x - /// - private string _compatibility = "0.1"; - /// - /// for identification of compatibility between versions - /// - public string compatibility - { - get { return _compatibility; } - set { _compatibility = value; } - } - - //TODO: direct.. - public string application = "http://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/"; - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SBETransmitter.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SBETransmitter.cs deleted file mode 100644 index d374eb94..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SBETransmitter.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - public class SBETransmitter: SBEEvent - { - - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Events/SolutionEvents.cs b/vsSolutionBuildEvent/Upgrade/v08/Events/SolutionEvents.cs deleted file mode 100644 index d198a422..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Events/SolutionEvents.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; - -namespace net.r_eg.vsSBE.Upgrade.v08.Events -{ - [Serializable] - public class SolutionEvents - { - [NonSerialized] - private SBESettings _settings = new SBESettings(); - /// - /// global settings - /// - public SBESettings settings - { - get { return _settings; } - set { _settings = value; } - } - - [NonSerialized] - private SBEEvent _preBuild = new SBEEvent(); - /// - /// Before building solution - /// - public SBEEvent preBuild - { - get { return _preBuild; } - set { _preBuild = value; } - } - - [NonSerialized] - private SBEEvent _postBuild = new SBEEvent(); - /// - /// After building solution - /// - public SBEEvent postBuild - { - get { return _postBuild; } - set { _postBuild = value; } - } - - [NonSerialized] - private SBEEvent _cancelBuild = new SBEEvent(); - /// - /// When cancel building solution - /// e.g. fatal error of compilation or cancel of user - /// - public SBEEvent cancelBuild - { - get { return _cancelBuild; } - set { _cancelBuild = value; } - } - - [NonSerialized] - private SBEEventEW _warningsBuild = new SBEEventEW(); - /// - /// Warnings during assembly - /// - public SBEEventEW warningsBuild - { - get { return _warningsBuild; } - set { _warningsBuild = value; } - } - - [NonSerialized] - private SBEEventEW _errorsBuild = new SBEEventEW(); - /// - /// Errors during assembly - /// - public SBEEventEW errorsBuild - { - get { return _errorsBuild; } - set { _errorsBuild = value; } - } - - [NonSerialized] - private SBEEventOWP _outputCustomBuild = new SBEEventOWP(); - /// - /// Output-Build customization - /// - public SBEEventOWP outputCustomBuild - { - get { return _outputCustomBuild; } - set { _outputCustomBuild = value; } - } - - [NonSerialized] - private SBETransmitter _transmitter = new SBETransmitter(); - /// - /// Transfer output data to outer handler - /// - public SBETransmitter transmitter - { - get { return _transmitter; } - set { _transmitter = value; } - } - } - - public enum SolutionEventType - { - Pre, Post, Cancel, Warnings, Errors, OWP, Transmitter, - /// - /// Without identification - all ISolutionEvent - /// - General, - /// - /// Errors + Warnings - /// - EW, - /// - /// By individual projects - /// - ProjectPre, - ProjectPost, - /// - /// The 'PRE' as deferred action of existing projects - /// - DeferredPre, - } -} diff --git a/vsSolutionBuildEvent/Upgrade/v08/Migration08_09.cs b/vsSolutionBuildEvent/Upgrade/v08/Migration08_09.cs deleted file mode 100644 index cd44eef6..00000000 --- a/vsSolutionBuildEvent/Upgrade/v08/Migration08_09.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Xml.Serialization; -using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Extensions; -using Newtonsoft.Json; -using NewSBEEvent = net.r_eg.vsSBE.Events.SBEEvent; -using NewSBEEventEW = net.r_eg.vsSBE.Events.SBEEventEW; -using NewSBEEventOWP = net.r_eg.vsSBE.Events.SBEEventOWP; -using NewSBETransmitter = net.r_eg.vsSBE.Events.SBETransmitter; -using NewSolutionEvents = net.r_eg.vsSBE.SolutionEvents; -using OldSBEEvent = net.r_eg.vsSBE.Upgrade.v08.Events.SBEEvent; -using OldSBEEventEW = net.r_eg.vsSBE.Upgrade.v08.Events.SBEEventEW; -using OldSBEEventOWP = net.r_eg.vsSBE.Upgrade.v08.Events.SBEEventOWP; -using OldSBETransmitter = net.r_eg.vsSBE.Upgrade.v08.Events.SBETransmitter; -using OldSolutionEvents = net.r_eg.vsSBE.Upgrade.v08.Events.SolutionEvents; - -namespace net.r_eg.vsSBE.Upgrade.v08 -{ - public class Migration08_09 - { - public static NewSolutionEvents migrate(string cfgFile) - { - return defineFrom(loadCfg(cfgFile)); - } - - protected static OldSolutionEvents loadCfg(string cfgFile) - { - using(StreamReader stream = new StreamReader(cfgFile, Encoding.UTF8, true)) - { - XmlSerializer xml = new XmlSerializer(typeof(OldSolutionEvents)); - return (OldSolutionEvents)xml.Deserialize(stream); - } - } - - protected static NewSolutionEvents defineFrom(OldSolutionEvents data) - { - NewSolutionEvents ret = new NewSolutionEvents(); - - ret.PreBuild[0] = defineFrom(data.preBuild); - ret.CancelBuild[0] = defineFrom(data.cancelBuild); - ret.PostBuild[0] = defineFrom(data.postBuild); - ret.WarningsBuild[0] = defineFrom(data.warningsBuild); - ret.ErrorsBuild[0] = defineFrom(data.errorsBuild); - ret.OWPBuild[0] = defineFrom(data.outputCustomBuild); - ret.Transmitter[0] = defineFrom(data.transmitter); - return ret; - } - - protected static NewSBEEvent defineFrom(OldSBEEvent evt) - { - NewSBEEventEW ret = new NewSBEEventEW(); - - ret.Caption = evt.caption; - ret.Enabled = evt.enabled; - ret.IgnoreIfBuildFailed = evt.buildFailedIgnore; - ret.Name = "Act1"; - ret.Process.Hidden = evt.processHide; - ret.Process.Waiting = evt.waitForExit; - ret.SupportMSBuild = evt.parseVariablesMSBuild; - ret.SupportSBEScripts = true; - ret.ToConfiguration = evt.toConfiguration; - - if(evt.mode == Events.TModeCommands.File) - { - ret.Mode = new ModeFile(); - ((IModeFile)ret.Mode).Command = evt.command; - } - else if(evt.mode == Events.TModeCommands.Interpreter) - { - ret.Mode = new ModeInterpreter(); - ((IModeInterpreter)ret.Mode).Command = evt.command; - ((IModeInterpreter)ret.Mode).Handler = evt.interpreter; - ((IModeInterpreter)ret.Mode).Newline = evt.newline; - ((IModeInterpreter)ret.Mode).Wrapper = evt.wrapper; - } - else if(evt.mode == Events.TModeCommands.Operation) - { - ret.Mode = new ModeOperation(); - ((IModeOperation)ret.Mode).AbortOnFirstError = evt.dteExec.abortOnFirstError; - ((IModeOperation)ret.Mode).Caption = evt.dteExec.caption; - ((IModeOperation)ret.Mode).Command = evt.dteExec.cmd; - } - - if(evt.executionOrder != null) - { - int len = evt.executionOrder.Length; - ret.ExecutionOrder = new ExecutionOrder[len]; - for(int i = 0; i < len; ++i) { - ret.ExecutionOrder[i] = new ExecutionOrder() { - Project = evt.executionOrder[i].project, - Order = (ExecutionOrderType)evt.executionOrder[i].order - }; - } - } - return ret; - } - - protected static NewSBEEventEW defineFrom(OldSBEEventEW evt) - { - NewSBEEventEW ret = (NewSBEEventEW)defineFrom((OldSBEEvent)evt); - ret.Codes = evt.codes; - ret.IsWhitelist = evt.isWhitelist; - return ret; - } - - protected static NewSBEEventOWP defineFrom(OldSBEEventOWP evt) - { - NewSBEEventOWP ret = defineFrom((OldSBEEvent)evt).CloneBySerializationWithType(); - - if(evt.eventsOWP == null || evt.eventsOWP.Count < 1){ - return ret; - } - - int count = evt.eventsOWP.Count; - ret.Match = new MatchWords[count]; - - for(int i = 0; i < count; ++i) { - ret.Match[i] = new MatchWords() { - Condition = evt.eventsOWP[i].term, - Type = (ComparisonType)evt.eventsOWP[i].type - }; - } - return ret; - } - - protected static NewSBETransmitter defineFrom(OldSBETransmitter evt) - { - return defineFrom((OldSBEEvent)evt).CloneBySerializationWithType(); - } - } -} diff --git a/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj b/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj index 573563c1..dda3ad1b 100644 --- a/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj +++ b/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj @@ -563,16 +563,6 @@ StatusToolControl.xaml - - - - - - - - - - True