Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Backup/Whut.AttachTo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Whut.AttachTo", "Whut.AttachTo\Whut.AttachTo.csproj", "{557B4FF9-0BBA-4631-9101-FA5DF4D519A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{557B4FF9-0BBA-4631-9101-FA5DF4D519A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{557B4FF9-0BBA-4631-9101-FA5DF4D519A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{557B4FF9-0BBA-4631-9101-FA5DF4D519A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{557B4FF9-0BBA-4631-9101-FA5DF4D519A3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
53 changes: 53 additions & 0 deletions Backup/Whut.AttachTo/AttachToPackage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.ComponentModel.Design;
using System.Linq;
using System.Runtime.InteropServices;
using EnvDTE;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;

namespace Whut.AttachTo
{
//// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is a package.
[PackageRegistration(UseManagedResourcesOnly = true)]
//// This attribute is used to register the informations needed to show the this package in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
//// This attribute is needed to let the shell know that this package exposes some menus.
[ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(GuidList.guidAttachToPkgString)]
[ProvideOptionPage(typeof(GeneralOptionsPage), "Whut.AttachTo", "General", 110, 120, false)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)]
[ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)]
public sealed class AttachToPackage : Package
{
protected override void Initialize()
{
base.Initialize();

OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

this.AddAttachToCommand(mcs, PkgCmdIDList.cmdidWhutAttachToIIS, gop => gop.ShowAttachToIIS, "w3wp.exe");
this.AddAttachToCommand(mcs, PkgCmdIDList.cmdidWhutAttachToIISExpress, gop => gop.ShowAttachToIISExpress, "iisexpress.exe");
this.AddAttachToCommand(mcs, PkgCmdIDList.cmdidWhutAttachToNUnit, gop => gop.ShowAttachToNUnit, "nunit-agent.exe", "nunit.exe", "nunit-console.exe", "nunit-agent-x86.exe", "nunit-x86.exe", "nunit-console-x86.exe");
}

private void AddAttachToCommand(OleMenuCommandService mcs, uint commandId, Func<GeneralOptionsPage, bool> isVisible, params string[] programsToAttach)
{
OleMenuCommand menuItemCommand = new OleMenuCommand(
delegate(object sender, EventArgs e)
{
DTE dte = (DTE)this.GetService(typeof(DTE));
foreach (Process process in dte.Debugger.LocalProcesses)
{
if (programsToAttach.Any(p => process.Name.EndsWith(p)))
{
process.Attach();
}
}
},
new CommandID(GuidList.guidAttachToCmdSet, (int)commandId));
menuItemCommand.BeforeQueryStatus += (s, e) => menuItemCommand.Visible = isVisible((GeneralOptionsPage)this.GetDialogPage(typeof(GeneralOptionsPage)));
mcs.AddCommand(menuItemCommand);
}
}
}
33 changes: 33 additions & 0 deletions Backup/Whut.AttachTo/GeneralOptionsPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.ComponentModel;
using Microsoft.VisualStudio.Shell;

namespace Whut.AttachTo
{
public class GeneralOptionsPage : DialogPage
{
public GeneralOptionsPage()
{
this.ShowAttachToIIS = true;
this.ShowAttachToIISExpress = true;
this.ShowAttachToNUnit = true;
}

[Category("General")]
[DisplayName("Show 'Attach to IIS' command")]
[Description("Show 'Attach to IIS' command in Tools menu.")]
[DefaultValue(true)]
public bool ShowAttachToIIS { get; set; }

[Category("General")]
[DisplayName("Show 'Attach to IIS Express command")]
[Description("Show 'Attach to IIS Express command in Tools menu.")]
[DefaultValue(true)]
public bool ShowAttachToIISExpress { get; set; }

[Category("General")]
[DisplayName("Show 'Attach to NUnit' command")]
[Description("Show 'Attach to NUnit' command in Tools menu.")]
[DefaultValue(true)]
public bool ShowAttachToNUnit { get; set; }
}
}
15 changes: 15 additions & 0 deletions Backup/Whut.AttachTo/Guids.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Guids.cs
// MUST match guids.h
using System;

namespace Whut.AttachTo
{
public static class GuidList
{
public const string guidAttachToPkgString = "8d6080f0-7276-44d7-8dc4-6378fb6ce225";

public const string guidAttachToCmdSetString = "16e2ac5c-ec3d-4ff1-a237-11ccef54fe0f";

public static readonly Guid guidAttachToCmdSet = new Guid(guidAttachToCmdSetString);
}
}
Binary file added Backup/Whut.AttachTo/Key.snk
Binary file not shown.
14 changes: 14 additions & 0 deletions Backup/Whut.AttachTo/PkgCmdID.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// PkgCmdID.cs
// MUST match PkgCmdID.h

namespace Whut.AttachTo
{
public static class PkgCmdIDList
{
public const uint cmdidWhutAttachToIIS = 0x100;

public const uint cmdidWhutAttachToIISExpress = 0x101;

public const uint cmdidWhutAttachToNUnit = 0x102;
}
}
31 changes: 31 additions & 0 deletions Backup/Whut.AttachTo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Reflection;
using System.Resources;
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("AttachTo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Whut")]
[assembly: AssemblyProduct("AttachTo")]
[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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
64 changes: 64 additions & 0 deletions Backup/Whut.AttachTo/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions Backup/Whut.AttachTo/Resources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
VS SDK Notes: This resx file contains the resources that will be consumed directly by your package.
For example, if you chose to create a tool window, there is a resource with ID 'CanNotCreateWindow'. This
is used in VsPkg.cs to determine the string to show the user if there is an error when attempting to create
the tool window.

Resources that are accessed directly from your package *by Visual Studio* are stored in the VSPackage.resx
file.
-->
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file added Backup/Whut.AttachTo/Resources/Images_32bit.bmp
Binary file not shown.
Binary file added Backup/Whut.AttachTo/Resources/Package.ico
Binary file not shown.
Loading