diff --git a/VsDingExtension.sln b/VsDingExtension.sln index b15e144..64709a1 100644 --- a/VsDingExtension.sln +++ b/VsDingExtension.sln @@ -1,8 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 2012 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BD9D4DB-8683-4698-8D24-01EE7306F73A}" ProjectSection(SolutionItems) = preProject IntegrationTests.testsettings = IntegrationTests.testsettings @@ -11,6 +9,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsDingExtensionProject", "VsDingExtensionProject\VsDingExtensionProject.csproj", "{3BEC1E8B-59C5-439E-AE97-8FF4B3E6B0C1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VsDingExtensionFor2012", "VsDingExtensionFor2012\VsDingExtensionFor2012.csproj", "{F37A5870-9786-4196-A3BE-51FEC6155623}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +21,10 @@ Global {3BEC1E8B-59C5-439E-AE97-8FF4B3E6B0C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BEC1E8B-59C5-439E-AE97-8FF4B3E6B0C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BEC1E8B-59C5-439E-AE97-8FF4B3E6B0C1}.Release|Any CPU.Build.0 = Release|Any CPU + {F37A5870-9786-4196-A3BE-51FEC6155623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F37A5870-9786-4196-A3BE-51FEC6155623}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F37A5870-9786-4196-A3BE-51FEC6155623}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F37A5870-9786-4196-A3BE-51FEC6155623}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VsDingExtensionFor2012/GlobalSuppressions.cs b/VsDingExtensionFor2012/GlobalSuppressions.cs new file mode 100644 index 0000000..a893f9d --- /dev/null +++ b/VsDingExtensionFor2012/GlobalSuppressions.cs @@ -0,0 +1,11 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. Project-level +// suppressions either have no target or are given a specific target +// and scoped to a namespace, type, member, etc. +// +// To add a suppression to this file, right-click the message in the +// Error List, point to "Suppress Message(s)", and click "In Project +// Suppression File". You do not need to add suppressions to this +// file manually. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] diff --git a/VsDingExtensionFor2012/Guids.cs b/VsDingExtensionFor2012/Guids.cs new file mode 100644 index 0000000..6362409 --- /dev/null +++ b/VsDingExtensionFor2012/Guids.cs @@ -0,0 +1,15 @@ +// Guids.cs +// MUST match guids.h + +using System; + +namespace VitaliiGanzha.VsDingExtension +{ + static class GuidList + { + public const string guidVsDingExtensionProjectPkgString = "26ba08d0-0d25-4479-8684-3054dd122876"; + public const string guidVsDingExtensionProjectCmdSetString = "85fa6948-b83a-4626-85da-51b8bb350053"; + + public static readonly Guid guidVsDingExtensionProjectCmdSet = new Guid(guidVsDingExtensionProjectCmdSetString); + }; +} \ No newline at end of file diff --git a/VsDingExtensionFor2012/Properties/AssemblyInfo.cs b/VsDingExtensionFor2012/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f795072 --- /dev/null +++ b/VsDingExtensionFor2012/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VsDingExtensionFor2012")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Bing")] +[assembly: AssemblyProduct("VsDingExtensionFor2012")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: NeutralResourcesLanguage("en-US")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + + + diff --git a/VsDingExtensionFor2012/Resources.Designer.cs b/VsDingExtensionFor2012/Resources.Designer.cs new file mode 100644 index 0000000..d98eab0 --- /dev/null +++ b/VsDingExtensionFor2012/Resources.Designer.cs @@ -0,0 +1,90 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18449 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace VitaliiGanzha.VsDingExtension { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VitaliiGanzha.VsDingExtension.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + internal static System.IO.UnmanagedMemoryStream build { + get { + return ResourceManager.GetStream("build", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + internal static System.IO.UnmanagedMemoryStream debug { + get { + return ResourceManager.GetStream("debug", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + internal static System.IO.UnmanagedMemoryStream ding { + get { + return ResourceManager.GetStream("ding", resourceCulture); + } + } + } +} diff --git a/VsDingExtensionFor2012/Resources.resx b/VsDingExtensionFor2012/Resources.resx new file mode 100644 index 0000000..4a8cf71 --- /dev/null +++ b/VsDingExtensionFor2012/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\build.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Resources\debug.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Resources\ding.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VsDingExtensionFor2012/Resources/Package.ico b/VsDingExtensionFor2012/Resources/Package.ico new file mode 100644 index 0000000..449296f Binary files /dev/null and b/VsDingExtensionFor2012/Resources/Package.ico differ diff --git a/VsDingExtensionFor2012/Resources/build.wav b/VsDingExtensionFor2012/Resources/build.wav new file mode 100644 index 0000000..f837519 Binary files /dev/null and b/VsDingExtensionFor2012/Resources/build.wav differ diff --git a/VsDingExtensionFor2012/Resources/debug.wav b/VsDingExtensionFor2012/Resources/debug.wav new file mode 100644 index 0000000..ed6ed85 Binary files /dev/null and b/VsDingExtensionFor2012/Resources/debug.wav differ diff --git a/VsDingExtensionFor2012/Resources/ding.wav b/VsDingExtensionFor2012/Resources/ding.wav new file mode 100644 index 0000000..44ee7bd Binary files /dev/null and b/VsDingExtensionFor2012/Resources/ding.wav differ diff --git a/VsDingExtensionFor2012/Resources/speaker.ico b/VsDingExtensionFor2012/Resources/speaker.ico new file mode 100644 index 0000000..f7a3433 Binary files /dev/null and b/VsDingExtensionFor2012/Resources/speaker.ico differ diff --git a/VsDingExtensionFor2012/VSPackage.resx b/VsDingExtensionFor2012/VSPackage.resx new file mode 100644 index 0000000..80ade04 --- /dev/null +++ b/VsDingExtensionFor2012/VSPackage.resx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + VsDingExtensionProject + + + Information about my package + + + Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/VsDingExtensionFor2012/VsDingExtensionFor2012.csproj b/VsDingExtensionFor2012/VsDingExtensionFor2012.csproj new file mode 100644 index 0000000..0346eb5 --- /dev/null +++ b/VsDingExtensionFor2012/VsDingExtensionFor2012.csproj @@ -0,0 +1,164 @@ + + + + 11.0 + 11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + 2.0 + {F37A5870-9786-4196-A3BE-51FEC6155623} + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + Bing.VsDingExtensionFor2012 + VsDingExtensionFor2012 + True + + + v4.5 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + + + + + + + true + + + + + + + + + + + + + + $(DevEnvDir)\PublicAssemblies\Microsoft.VisualStudio.ComponentModelHost.dll + + + $(DevEnvDir)\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestWindow.Interfaces.dll + + + + + {80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2} + 8 + 0 + 0 + primary + False + False + + + {26AD1324-4B7C-44BC-84F8-B86AED45729F} + 10 + 0 + 0 + primary + False + False + + + {1A31287A-4D7D-413E-8E32-3B374931BD89} + 8 + 0 + 0 + primary + False + False + + + {2CE2370E-D744-4936-A090-3FFFE667B0E1} + 9 + 0 + 0 + primary + False + False + + + {1CBA492E-7263-47BB-87FE-639000619B15} + 8 + 0 + 0 + primary + False + False + + + {00020430-0000-0000-C000-000000000046} + 2 + 0 + 0 + primary + False + False + + + + + + + + + + + + Designer + + + + + + + + + + + + + Always + true + + + + true + + + + + \ No newline at end of file diff --git a/VsDingExtensionFor2012/VsDingExtensionProjectPackage.cs b/VsDingExtensionFor2012/VsDingExtensionProjectPackage.cs new file mode 100644 index 0000000..e55f103 --- /dev/null +++ b/VsDingExtensionFor2012/VsDingExtensionProjectPackage.cs @@ -0,0 +1,95 @@ +using System; +using System.Diagnostics; +using System.Globalization; +using System.Media; +using System.Runtime.InteropServices; +using EnvDTE; +using EnvDTE80; +using Microsoft.VisualStudio.ComponentModelHost; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.TestWindow.Extensibility; + +namespace VitaliiGanzha.VsDingExtension +{ + [PackageRegistration(UseManagedResourcesOnly = true)] + [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] + [Guid(GuidList.guidVsDingExtensionProjectPkgString)] + [ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")] + public sealed class VsDingExtensionProjectPackage : Package + { + private DTE2 applicationObject; + private AddIn addInInstance; + private BuildEvents buildEvents; + private DebuggerEvents debugEvents; + private SoundPlayer buildCompleteSoundPlayer; + private SoundPlayer debugSoundPlayer; + private SoundPlayer testCompleteSoundPlayer; + + public VsDingExtensionProjectPackage() + { + Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString())); + } + + #region Package Members + + protected override void Initialize() + { + Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", + this.ToString())); + base.Initialize(); + + buildCompleteSoundPlayer = new SoundPlayer(Resources.build); + debugSoundPlayer = new SoundPlayer(Resources.debug); + testCompleteSoundPlayer = new SoundPlayer(Resources.ding); + + applicationObject = (DTE2) GetService(typeof (DTE)); + + this.buildEvents = applicationObject.Events.BuildEvents; + this.debugEvents = applicationObject.Events.DebuggerEvents; + + buildEvents.OnBuildDone += (scope, action) => PlaySafe(buildCompleteSoundPlayer); + debugEvents.OnEnterBreakMode += delegate(dbgEventReason reason, ref dbgExecutionAction action) + { + if (reason != dbgEventReason.dbgEventReasonStep) + { + PlaySafe(debugSoundPlayer); + } + }; + + var componentModel = + Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof (SComponentModel)) as IComponentModel; + + if (componentModel == null) + { + Debug.WriteLine("componentModel is null"); + return; + } + + var operationState = componentModel.GetService(); + operationState.StateChanged += OperationStateOnStateChanged; + } + + private void PlaySafe(SoundPlayer soundPlayer) + { + try + { + soundPlayer.Play(); + } + catch (Exception ex) + { + ActivityLog.LogError(this.GetType().FullName, ex.Message); + } + } + + private void OperationStateOnStateChanged(object sender, OperationStateChangedEventArgs operationStateChangedEventArgs) + { + + if (operationStateChangedEventArgs.State.HasFlag(TestOperationStates.TestExecutionFinished)) + { + PlaySafe(testCompleteSoundPlayer); + } + } + #endregion + + } +} diff --git a/VsDingExtensionFor2012/source.extension.vsixmanifest b/VsDingExtensionFor2012/source.extension.vsixmanifest new file mode 100644 index 0000000..9718855 --- /dev/null +++ b/VsDingExtensionFor2012/source.extension.vsixmanifest @@ -0,0 +1,32 @@ + + + + + Visual Studio Ding extension for VS 2012 + This small extension will play notification sounds when following events occur: +- Build Complete +- Entering debugger mode (breakpoint hit, etc) +- Unit tests finished to run + +Useful when working with big solutions or when build/test run/hitting a breakpoint takes a lot of time and developer can be distructed on other things while he waits. + +Just install it and it is ready to use! + +This is an open source project, join! + +Twitter: @GanzhaVitalii</Description> + https://github.com/thecoderok/vsdingextension + Resources\speaker.ico + Productivity + + + + + + + + + + + +