├── .gitignore ├── AUTHORS ├── COPYING ├── Images ├── NiftyPerforce │ ├── commandwindow.png │ ├── documenttab.png │ ├── explorertab.png │ └── perforceoptions.png ├── NiftySolution │ ├── includedirs.png │ ├── quickopen.png │ └── totalsolutiontime.png ├── OpenFile.png ├── Times.png ├── config.png ├── contextmenu.png ├── multiselect.png ├── output.png ├── solutionselect.png └── toolbar.png ├── Makefile ├── NiftyPerforce ├── AssemblyInfo.cs ├── COPYING ├── CommandBar.resx ├── Commands │ ├── ItemCommandBase.cs │ ├── NiftyConfigure.cs │ ├── P4DiffItem.cs │ ├── P4DiffSolution.cs │ ├── P4Edit.cs │ ├── P4EditItem.cs │ ├── P4EditModified.cs │ ├── P4EditSolution.cs │ ├── P4RenameItem.cs │ ├── P4RevertItem.cs │ ├── P4RevisionGraphItem.cs │ ├── P4RevisionHistoryItem.cs │ ├── P4RevisionHistorySolution.cs │ ├── P4ShowItem.cs │ └── P4TimeLapseItem.cs ├── Config.cs ├── ConfigDialog.Designer.cs ├── ConfigDialog.cs ├── ConfigDialog.resx ├── Connect.cs ├── EventHandlers │ ├── AutoAddDelete.cs │ ├── AutoCheckoutOnBuild.cs │ ├── AutoCheckoutOnSave.cs │ ├── AutoCheckoutProject.cs │ ├── AutoCheckoutTextEdit.cs │ └── FindEvents.cs ├── NiftyPerforce.AddIn ├── NiftyPerforce.csproj ├── NiftyPerforce.vsct ├── NiftyPerforcePackage.cs ├── P4Operations.cs ├── PostBuild2010.cmd ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── Configure.bmp │ ├── Diff.bmp │ ├── Edit.bmp │ ├── EditAll.bmp │ ├── Icons.bmp │ ├── Icons.png │ ├── Icons.psd │ ├── Revert.bmp │ ├── RevisionGraph.bmp │ ├── RevisionHistory.bmp │ ├── Show.bmp │ └── TimeLapseView.bmp ├── ToolbarIcons.Designer.cs ├── ToolbarIcons.resx ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest ├── NiftyPlugins.sln ├── NiftySolution ├── AssemblyInfo.cs ├── COPYING ├── CommandBar.resx ├── Commands │ ├── CloseToolWindows.cs │ ├── Configure.cs │ ├── QuickOpen.cs │ └── ToggleFile.cs ├── Connect.cs ├── EventHandlers │ └── SolutionBuildTimings.cs ├── NiftySolution.AddIn ├── NiftySolution.csproj ├── NiftySolutionPackage.cs ├── NiftySolutionPackage.vsct ├── Options.cs ├── PostBuild2010.cmd ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── Configure.bmp │ ├── DeleteTool.bmp │ ├── Icons.png │ ├── Icons.psd │ ├── Open.bmp │ └── Toggle.bmp ├── SearchEntry.cs ├── SolutionFiles.cs ├── ToolbarIcons.Designer.cs ├── ToolbarIcons.resx ├── UI │ ├── ConfigDialog.cs │ ├── ConfigDialog.designer.cs │ ├── ConfigDialog.resx │ ├── QuickOpenDialog.Designer.cs │ ├── QuickOpenDialog.cs │ ├── QuickOpenDialog.resx │ ├── SearchResultControl.Designer.cs │ ├── SearchResultControl.cs │ └── SearchResultControl.resx ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest ├── README.md ├── Shared ├── AsyncProcess.cs ├── AuroraCore.csproj ├── CommandBase.cs ├── CommandRegistry.cs ├── DebugLogHandler.cs ├── Feature.cs ├── File.cs ├── Help.cs ├── Junction.cs ├── Log.cs ├── Plugin.cs ├── Process.cs ├── Properties │ └── AssemblyInfo.cs ├── Singleton.cs └── VisualStudioLogHandler.cs ├── bin ├── NiftyReset.vbs ├── build.py └── msbuildfix.reg └── makedist.cmd /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | NiftyPerforce/bin/ 3 | NiftyPerforce/obj/ 4 | NiftySolution/bin/ 5 | NiftySolution/obj/ 6 | Shared/bin/ 7 | Shared/obj/ 8 | *.csproj.user 9 | packages 10 | .vs 11 | Build -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Here is a list of contributors: 2 | 3 | NiftyPerforce: 4 | Jim Tilander 5 | Martin Ecker 6 | Tim Burris 7 | Charles Bloom 8 | Hakon Steino 9 | 10 | NiftySolution: 11 | Jim Tilander 12 | Charles Bloom 13 | Hakon Steino 14 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2006-2015 Jim Tilander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /Images/NiftyPerforce/commandwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftyPerforce/commandwindow.png -------------------------------------------------------------------------------- /Images/NiftyPerforce/documenttab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftyPerforce/documenttab.png -------------------------------------------------------------------------------- /Images/NiftyPerforce/explorertab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftyPerforce/explorertab.png -------------------------------------------------------------------------------- /Images/NiftyPerforce/perforceoptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftyPerforce/perforceoptions.png -------------------------------------------------------------------------------- /Images/NiftySolution/includedirs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftySolution/includedirs.png -------------------------------------------------------------------------------- /Images/NiftySolution/quickopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftySolution/quickopen.png -------------------------------------------------------------------------------- /Images/NiftySolution/totalsolutiontime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/NiftySolution/totalsolutiontime.png -------------------------------------------------------------------------------- /Images/OpenFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/OpenFile.png -------------------------------------------------------------------------------- /Images/Times.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/Times.png -------------------------------------------------------------------------------- /Images/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/config.png -------------------------------------------------------------------------------- /Images/contextmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/contextmenu.png -------------------------------------------------------------------------------- /Images/multiselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/multiselect.png -------------------------------------------------------------------------------- /Images/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/output.png -------------------------------------------------------------------------------- /Images/solutionselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/solutionselect.png -------------------------------------------------------------------------------- /Images/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/Images/toolbar.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION?=2.0.2 2 | SHELL = cmd.exe 3 | MSBUILD = MSBuild.exe 4 | PATH := $(PATH);C:\Program Files (x86)\MSBuild\14.0\bin\amd64 5 | 6 | 7 | all: build 8 | 9 | build: 10 | cmd /c $(MSBUILD) NiftyPlugins.sln /maxcpucount /nologo /v:m /t:Build /p:Configuration=Release /p:Platform="Any CPU" 11 | 12 | clean: 13 | 14 | dist: 15 | makedist.cmd $(VERSION) 16 | -------------------------------------------------------------------------------- /NiftyPerforce/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("Perforce plugin helper for Visual Studio")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Aurora")] 13 | [assembly: AssemblyProduct("NiftyPerforce")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Revision 24 | // Build Number 25 | // 26 | // You can specify all the value or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("2.0.2")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified - the assembly cannot be signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. 41 | // (*) If the key file and a key name attributes are both specified, the 42 | // following processing occurs: 43 | // (1) If the KeyName can be found in the CSP - that key is used. 44 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 45 | // in the file is installed into the CSP and used. 46 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 47 | // documentation for more information on this. 48 | // 49 | [assembly: AssemblyDelaySign(false)] 50 | [assembly: AssemblyKeyFile("")] 51 | [assembly: AssemblyKeyName("")] 52 | -------------------------------------------------------------------------------- /NiftyPerforce/COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2006-2010 Jim Tilander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/ItemCommandBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | 6 | namespace Aurora 7 | { 8 | namespace NiftyPerforce 9 | { 10 | // an item command is a command associated with selected items in solution explorer 11 | abstract class ItemCommandBase : CommandBase 12 | { 13 | private bool m_executeForFileItems = true; 14 | private bool m_executeForProjectItems = true; 15 | 16 | protected ItemCommandBase(string name, string canonicalName, Plugin plugin, string tooltip, bool executeForFileItems, bool executeForProjectItems) 17 | : base(name, canonicalName, plugin, tooltip) 18 | { 19 | m_executeForFileItems = executeForFileItems; 20 | m_executeForProjectItems = executeForProjectItems; 21 | } 22 | 23 | private const string m_fileItemGUID = "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}"; 24 | 25 | public override bool OnCommand() 26 | { 27 | foreach (SelectedItem sel in Plugin.App.SelectedItems) 28 | { 29 | if (m_executeForFileItems && sel.ProjectItem != null && m_fileItemGUID == sel.ProjectItem.Kind.ToUpper()) 30 | { 31 | OnExecute(sel, sel.ProjectItem.get_FileNames(0), Plugin.OutputPane); 32 | } 33 | else if (m_executeForFileItems && sel.ProjectItem == null && Plugin.App.ActiveWindow.Type == vsWindowType.vsWindowTypeDocument) 34 | { 35 | OnExecute(sel, Plugin.App.ActiveDocument.FullName, Plugin.OutputPane); 36 | } 37 | else if (m_executeForProjectItems && sel.Project != null) 38 | { 39 | OnExecute(sel, sel.Project.FullName, Plugin.OutputPane); 40 | } 41 | } 42 | 43 | return true; 44 | } 45 | 46 | public override bool IsEnabled() 47 | { 48 | return Plugin.App.SelectedItems.Count > 0; 49 | } 50 | 51 | public abstract void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/NiftyConfigure.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | 6 | namespace Aurora 7 | { 8 | namespace NiftyPerforce 9 | { 10 | class NiftyConfigure : CommandBase 11 | { 12 | public NiftyConfigure(Plugin plugin, string canonicalName) 13 | : base("Configure", canonicalName, plugin, "Opens the configuration dialog") 14 | { 15 | } 16 | 17 | override public int IconIndex { get { return 2; } } 18 | 19 | public override bool OnCommand() 20 | { 21 | Log.Debug("Launching the configure tool"); 22 | 23 | Config options = (Config)Plugin.Options; 24 | options.Save(); 25 | 26 | ConfigDialog dlg = new ConfigDialog(); 27 | dlg.propertyGrid1.SelectedObject = options; 28 | 29 | if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) 30 | { 31 | Plugin.Options = Config.Load(options.mFileName); 32 | } 33 | else 34 | { 35 | options.Save(); 36 | } 37 | 38 | return true; 39 | } 40 | 41 | public override bool IsEnabled() 42 | { 43 | return true; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4DiffItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class P4DiffItem : ItemCommandBase 13 | { 14 | public P4DiffItem(Plugin plugin, string canonicalName) 15 | : base("DiffItem", canonicalName, plugin, "Opens diff on an item", true, true) 16 | { 17 | } 18 | 19 | override public int IconIndex { get { return 3; } } 20 | 21 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 22 | { 23 | if(toolBarOnly) 24 | { 25 | _RegisterGUIBar(vsCommand, vsCommandbar); 26 | } 27 | else 28 | { 29 | _RegisterGuiContext(vsCommand, "Project"); 30 | _RegisterGuiContext(vsCommand, "Item"); 31 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 32 | } 33 | return true; 34 | } 35 | 36 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 37 | { 38 | P4Operations.DiffFile(pane, fileName); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4DiffSolution.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class P4DiffSolution : CommandBase 13 | { 14 | public P4DiffSolution(Plugin plugin, string canonicalName) 15 | : base("DiffSolution", canonicalName, plugin, "Opens the diff for the current solution") 16 | { 17 | } 18 | 19 | override public int IconIndex { get { return 3; } } 20 | 21 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 22 | { 23 | if (!toolBarOnly) 24 | { 25 | _RegisterGuiContext(vsCommand, "Solution"); 26 | } 27 | return true; 28 | } 29 | 30 | public override bool OnCommand() 31 | { 32 | if(Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty) 33 | { 34 | P4Operations.DiffFile(Plugin.OutputPane, Plugin.App.Solution.FullName); 35 | return true; 36 | } 37 | return false; 38 | } 39 | 40 | public override bool IsEnabled() 41 | { 42 | return Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4Edit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using EnvDTE; 3 | using EnvDTE80; 4 | 5 | namespace Aurora 6 | { 7 | namespace NiftyPerforce 8 | { 9 | class P4Edit 10 | { 11 | public void OnCommand(DTE2 application, OutputWindowPane pane) 12 | { 13 | // Check if we've selected stuff in the solution explorer and we currently have this as the active window. 14 | if ("Tool" == application.ActiveWindow.Kind && application.ActiveWindow.Caption.StartsWith("Solution Explorer")) 15 | { 16 | int checkoutItems = 0; 17 | foreach (SelectedItem sel in application.SelectedItems) 18 | { 19 | if (null != sel.ProjectItem) 20 | { 21 | if (P4EditItem.EditItem(sel.ProjectItem, pane)) 22 | checkoutItems++; 23 | } 24 | 25 | if (null != sel.Project) 26 | { 27 | if (P4EditItem.EditProject(sel.Project, pane)) 28 | checkoutItems++; 29 | } 30 | } 31 | 32 | if (checkoutItems > 0) 33 | return; 34 | } 35 | 36 | // Finally, let's just see if the text editor is active 37 | if ("Document" == application.ActiveWindow.Kind && application.ActiveDocument != null) 38 | { 39 | string fullName = application.ActiveDocument.FullName; 40 | 41 | if( !application.ActiveDocument.ReadOnly ) 42 | { 43 | pane.OutputString( fullName + " is already opened for edit (is writeable on disk at least)\n" ); 44 | } 45 | else 46 | { 47 | P4Operations.EditFile(pane, fullName); 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4EditItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using Microsoft.VisualStudio.CommandBars; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4EditItem : ItemCommandBase 14 | { 15 | public P4EditItem(Plugin plugin, string canonicalName) 16 | : base("EditItem", canonicalName, plugin, "Opens an item for edit", true, true) 17 | { 18 | } 19 | 20 | public override int IconIndex { get { return 1; } } 21 | 22 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 23 | { 24 | if (toolBarOnly) 25 | { 26 | _RegisterGUIBar(vsCommand, vsCommandbar); 27 | } 28 | else 29 | { 30 | _RegisterGuiContext(vsCommand, "Project"); 31 | _RegisterGuiContext(vsCommand, "Item"); 32 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 33 | _RegisterGuiContext(vsCommand, "Cross Project Multi Item"); 34 | _RegisterGuiContext(vsCommand, "Cross Project Multi Project"); 35 | } 36 | return true; 37 | } 38 | 39 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 40 | { 41 | P4Operations.EditFile(pane, fileName); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4EditModified.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | 6 | namespace Aurora 7 | { 8 | namespace NiftyPerforce 9 | { 10 | class P4EditModified : CommandBase 11 | { 12 | public P4EditModified(Plugin plugin, string canonicalName) 13 | : base("EditModified", canonicalName, plugin, "Opens all the currently modifed files for edit") 14 | { 15 | } 16 | 17 | override public int IconIndex { get { return 5; } } 18 | 19 | public override bool OnCommand() 20 | { 21 | Log.Info("P4EditModified : now checking {0} documents for modification", Plugin.App.Documents.Count); 22 | 23 | if(!Plugin.App.Solution.Saved) 24 | { 25 | P4Operations.EditFile(Plugin.OutputPane, Plugin.App.Solution.FullName); 26 | } 27 | 28 | foreach(Project p in Plugin.App.Solution.Projects) 29 | { 30 | if(!p.Saved) 31 | { 32 | P4Operations.EditFile(Plugin.OutputPane, p.FullName); 33 | } 34 | } 35 | 36 | foreach(Document doc in Plugin.App.Documents) 37 | { 38 | if(!doc.Saved) 39 | { 40 | P4Operations.EditFile(Plugin.OutputPane, doc.FullName); 41 | } 42 | } 43 | 44 | return true; 45 | } 46 | 47 | public override bool IsEnabled() 48 | { 49 | return true; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4EditSolution.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class P4EditSolution : CommandBase 13 | { 14 | public P4EditSolution(Plugin plugin, string canonicalName) 15 | : base("EditSolution", canonicalName, plugin, "Opens the solution for edit") 16 | { 17 | } 18 | 19 | public override int IconIndex { get { return 1; } } 20 | 21 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 22 | { 23 | if (!toolBarOnly) 24 | { 25 | _RegisterGuiContext(vsCommand, "Solution"); 26 | } 27 | return true; 28 | } 29 | 30 | public override bool OnCommand() 31 | { 32 | if(Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty) 33 | { 34 | P4Operations.EditFile(Plugin.OutputPane, Plugin.App.Solution.FullName); 35 | return true; 36 | } 37 | return false; 38 | } 39 | 40 | public override bool IsEnabled() 41 | { 42 | return Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4RenameItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using System.Windows.Forms; 6 | using System.IO; 7 | using Microsoft.VisualStudio.CommandBars; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4RenameItem : ItemCommandBase 14 | { 15 | public P4RenameItem(Plugin plugin, string canonicalName) 16 | : base("RenameItem", canonicalName, plugin, "Renames an item", true, false) 17 | { 18 | } 19 | 20 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 21 | { 22 | OpenFileDialog dlg = new OpenFileDialog(); 23 | dlg.Title = "Source: " + fileName; 24 | dlg.Multiselect = false; 25 | dlg.CheckFileExists = false; 26 | dlg.CheckPathExists = false; 27 | dlg.InitialDirectory = Path.GetDirectoryName(fileName); 28 | dlg.FileName = Path.GetFileName(fileName); 29 | 30 | if (DialogResult.OK == dlg.ShowDialog()) 31 | { 32 | string newName = dlg.FileName; 33 | P4Operations.IntegrateFile(pane, newName, fileName); 34 | P4Operations.EditFile(pane, item.ProjectItem.ContainingProject.FullName); 35 | item.ProjectItem.Collection.AddFromFile(newName); 36 | item.ProjectItem.Delete(); 37 | P4Operations.DeleteFile(pane, fileName); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4RevertItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Windows.Forms; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using Microsoft.VisualStudio.CommandBars; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4RevertItem : ItemCommandBase 14 | { 15 | private bool mOnlyUnchanged; 16 | 17 | public P4RevertItem(Plugin plugin, string canonicalName, bool onlyUnchanged) 18 | : base("RevertItem", canonicalName, plugin, "Reverts an opened item" + (onlyUnchanged ? ", only if unchanged" : string.Empty), true, true) 19 | { 20 | mOnlyUnchanged = onlyUnchanged; 21 | } 22 | 23 | override public int IconIndex { get { return 4; } } 24 | 25 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 26 | { 27 | if(toolBarOnly) 28 | { 29 | _RegisterGUIBar(vsCommand, vsCommandbar); 30 | } 31 | else 32 | { 33 | _RegisterGuiContext(vsCommand, "Project"); 34 | _RegisterGuiContext(vsCommand, "Item"); 35 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 36 | _RegisterGuiContext(vsCommand, "Cross Project Multi Item"); 37 | _RegisterGuiContext(vsCommand, "Cross Project Multi Project"); 38 | } 39 | return true; 40 | } 41 | 42 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 43 | { 44 | if (!mOnlyUnchanged) 45 | { 46 | string message = "You are about to revert the file '" + fileName + "'. Do you want to do this?"; 47 | if(MessageBox.Show(message, "Revert File?", MessageBoxButtons.YesNo) != DialogResult.Yes) 48 | { 49 | return; 50 | } 51 | } 52 | P4Operations.RevertFile(pane, fileName, mOnlyUnchanged); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4RevisionGraphItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using System.IO; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4RevisionGraphItem : ItemCommandBase 14 | { 15 | private bool mMainLine; 16 | 17 | public P4RevisionGraphItem(Plugin plugin, string canonicalName, bool mainLine) 18 | : base("P4RevisionGraphItem", canonicalName, plugin, "Shows the revision graph for an item" + (mainLine ? " (mainline)" : ""), true, true) 19 | { 20 | mMainLine = mainLine; 21 | } 22 | 23 | override public int IconIndex { get { return 9; } } 24 | 25 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 26 | { 27 | if (toolBarOnly) 28 | { 29 | _RegisterGUIBar(vsCommand, vsCommandbar); 30 | } 31 | else 32 | { 33 | _RegisterGuiContext(vsCommand, "Project"); 34 | _RegisterGuiContext(vsCommand, "Item"); 35 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 36 | } 37 | return true; 38 | } 39 | 40 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 41 | { 42 | string dirname = Path.GetDirectoryName(fileName); 43 | 44 | if (mMainLine) 45 | { 46 | Config options = (Config)Plugin.Options; 47 | fileName = P4Operations.RemapToMain(fileName, options.MainLinePath); 48 | } 49 | 50 | P4Operations.RevisionGraph(pane, dirname, fileName); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4RevisionHistoryItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using System.IO; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4RevisionHistoryItem : ItemCommandBase 14 | { 15 | private bool mMainLine; 16 | 17 | public P4RevisionHistoryItem(Plugin plugin, string canonicalName, bool mainLine) 18 | : base("RevisionHistoryItem", canonicalName, plugin, "Shows the revision history for an item" + (mainLine ? " (mainline)" : ""), true, true) 19 | { 20 | mMainLine = mainLine; 21 | } 22 | 23 | override public int IconIndex { get { return 10; } } 24 | 25 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 26 | { 27 | if(toolBarOnly) 28 | { 29 | _RegisterGUIBar(vsCommand, vsCommandbar); 30 | } 31 | else 32 | { 33 | _RegisterGuiContext(vsCommand, "Project"); 34 | _RegisterGuiContext(vsCommand, "Item"); 35 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 36 | } 37 | return true; 38 | } 39 | 40 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 41 | { 42 | string dirname = Path.GetDirectoryName(fileName); 43 | 44 | if (mMainLine) 45 | { 46 | Config options = (Config)Plugin.Options; 47 | fileName = P4Operations.RemapToMain(fileName, options.MainLinePath); 48 | } 49 | 50 | P4Operations.RevisionHistoryFile(pane, dirname, fileName); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4RevisionHistorySolution.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using System.IO; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4RevisionHistorySolution : CommandBase 14 | { 15 | public P4RevisionHistorySolution(Plugin plugin, string canonicalName) 16 | : base("RevisionHistorySolution", canonicalName, plugin, "Shows the revision history for the solution") 17 | { 18 | } 19 | 20 | override public int IconIndex { get { return 10; } } 21 | 22 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 23 | { 24 | if(!toolBarOnly) 25 | { 26 | _RegisterGuiContext(vsCommand, "Solution"); 27 | } 28 | return true; 29 | } 30 | 31 | public override bool OnCommand() 32 | { 33 | if(Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty) 34 | { 35 | P4Operations.RevisionHistoryFile(Plugin.OutputPane, Path.GetDirectoryName(Plugin.App.Solution.FullName), Plugin.App.Solution.FullName); 36 | return true; 37 | } 38 | return false; 39 | 40 | } 41 | 42 | public override bool IsEnabled() 43 | { 44 | return Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4ShowItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class P4ShowItem : ItemCommandBase 13 | { 14 | public P4ShowItem(Plugin plugin, string canonicalName) 15 | : base("ShowItem", canonicalName, plugin, "Shows the item in p4win", true, true) 16 | { 17 | } 18 | 19 | public override int IconIndex { get { return 8; } } 20 | 21 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 22 | { 23 | if(toolBarOnly) 24 | { 25 | _RegisterGUIBar(vsCommand, vsCommandbar); 26 | } 27 | else 28 | { 29 | _RegisterGuiContext(vsCommand, "Project"); 30 | _RegisterGuiContext(vsCommand, "Item"); 31 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 32 | } 33 | return true; 34 | } 35 | 36 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 37 | { 38 | P4Operations.P4WinShowFile(pane, fileName); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /NiftyPerforce/Commands/P4TimeLapseItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using System.IO; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftyPerforce 12 | { 13 | class P4TimeLapseItem : ItemCommandBase 14 | { 15 | private bool mMainLine; 16 | 17 | public P4TimeLapseItem(Plugin plugin, string canonicalName, bool inMainLine) 18 | : base("TimeLapseItem", canonicalName, plugin, "Shows the Time Lapse View for an item" + (inMainLine ? " (mainline)" : ""), true, true) 19 | { 20 | mMainLine = inMainLine; 21 | } 22 | 23 | override public int IconIndex { get { return 7; } } 24 | 25 | public override bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 26 | { 27 | if(toolBarOnly) 28 | { 29 | _RegisterGUIBar(vsCommand, vsCommandbar); 30 | } 31 | else 32 | { 33 | _RegisterGuiContext(vsCommand, "Project"); 34 | _RegisterGuiContext(vsCommand, "Item"); 35 | _RegisterGuiContext(vsCommand, "Easy MDI Document Window"); 36 | } 37 | return true; 38 | } 39 | 40 | public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) 41 | { 42 | string dirname = Path.GetDirectoryName(fileName); 43 | 44 | if( mMainLine ) 45 | { 46 | Config options = (Config)Plugin.Options; 47 | fileName = P4Operations.RemapToMain(fileName, options.MainLinePath); 48 | } 49 | 50 | P4Operations.TimeLapseView(pane, dirname, fileName); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /NiftyPerforce/ConfigDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Aurora 2 | { 3 | 4 | namespace NiftyPerforce 5 | { 6 | partial class ConfigDialog 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private System.ComponentModel.IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.button1 = new System.Windows.Forms.Button(); 35 | this.button2 = new System.Windows.Forms.Button(); 36 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 37 | this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); 38 | this.groupBox2.SuspendLayout(); 39 | this.SuspendLayout(); 40 | // 41 | // button1 42 | // 43 | this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; 44 | this.button1.Location = new System.Drawing.Point(70, 442); 45 | this.button1.Name = "button1"; 46 | this.button1.Size = new System.Drawing.Size(75, 23); 47 | this.button1.TabIndex = 3; 48 | this.button1.Text = "Ok"; 49 | this.button1.UseVisualStyleBackColor = true; 50 | this.button1.Click += new System.EventHandler(this.button1_Click); 51 | // 52 | // button2 53 | // 54 | this.button2.Location = new System.Drawing.Point(177, 442); 55 | this.button2.Name = "button2"; 56 | this.button2.Size = new System.Drawing.Size(75, 23); 57 | this.button2.TabIndex = 4; 58 | this.button2.Text = "Cancel"; 59 | this.button2.UseVisualStyleBackColor = true; 60 | this.button2.Click += new System.EventHandler(this.button2_Click); 61 | // 62 | // groupBox2 63 | // 64 | this.groupBox2.Controls.Add(this.propertyGrid1); 65 | this.groupBox2.Location = new System.Drawing.Point(12, 12); 66 | this.groupBox2.Name = "groupBox2"; 67 | this.groupBox2.Size = new System.Drawing.Size(299, 400); 68 | this.groupBox2.TabIndex = 9; 69 | this.groupBox2.TabStop = false; 70 | this.groupBox2.Text = "Settings"; 71 | // 72 | // propertyGrid1 73 | // 74 | this.propertyGrid1.Location = new System.Drawing.Point(6, 19); 75 | this.propertyGrid1.Name = "propertyGrid1"; 76 | this.propertyGrid1.Size = new System.Drawing.Size(287, 375); 77 | this.propertyGrid1.TabIndex = 0; 78 | // 79 | // ConfigDialog 80 | // 81 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 82 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 83 | this.ClientSize = new System.Drawing.Size(323, 477); 84 | this.Controls.Add(this.groupBox2); 85 | this.Controls.Add(this.button2); 86 | this.Controls.Add(this.button1); 87 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 88 | this.Name = "ConfigDialog"; 89 | this.Text = "NiftyPerforce configuration"; 90 | this.groupBox2.ResumeLayout(false); 91 | this.ResumeLayout(false); 92 | 93 | } 94 | 95 | #endregion 96 | 97 | public bool wasCancelled = true; 98 | private System.Windows.Forms.Button button1; 99 | private System.Windows.Forms.Button button2; 100 | private System.Windows.Forms.GroupBox groupBox2; 101 | public System.Windows.Forms.PropertyGrid propertyGrid1; 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /NiftyPerforce/ConfigDialog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Aurora 11 | { 12 | 13 | namespace NiftyPerforce 14 | { 15 | public partial class ConfigDialog : Form 16 | { 17 | public ConfigDialog() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | wasCancelled = false; 25 | Close(); 26 | } 27 | 28 | private void button2_Click(object sender, EventArgs e) 29 | { 30 | wasCancelled = true; 31 | Close(); 32 | } 33 | 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /NiftyPerforce/ConfigDialog.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/AutoAddDelete.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | 7 | namespace Aurora 8 | { 9 | namespace NiftyPerforce 10 | { 11 | // Handles registration and events for add/delete files and projects. 12 | class AutoAddDelete : Feature 13 | { 14 | private ProjectItemsEvents m_projectEvents; 15 | private SolutionEvents m_solutionEvents; 16 | private Plugin m_plugin; 17 | 18 | public AutoAddDelete(Plugin plugin) 19 | : base("AutoAddDelete", "Automatically adds and deletes files matching project add/delete") 20 | { 21 | m_plugin = plugin; 22 | 23 | m_projectEvents = ((EnvDTE80.Events2)m_plugin.App.Events).ProjectItemsEvents; 24 | m_solutionEvents = ((EnvDTE80.Events2)m_plugin.App.Events).SolutionEvents; 25 | 26 | if(((Config)m_plugin.Options).autoAdd) 27 | { 28 | Log.Info("Adding handlers for automatically add files to perforce as you add them to the project"); 29 | m_projectEvents.ItemAdded += new _dispProjectItemsEvents_ItemAddedEventHandler(OnItemAdded); 30 | m_solutionEvents.ProjectAdded += new _dispSolutionEvents_ProjectAddedEventHandler(OnProjectAdded); 31 | } 32 | 33 | if(((Config)m_plugin.Options).autoDelete) 34 | { 35 | Log.Info("Adding handlers for automatically deleting files from perforce as you remove them from the project"); 36 | m_projectEvents.ItemRemoved += new _dispProjectItemsEvents_ItemRemovedEventHandler(OnItemRemoved); 37 | m_solutionEvents.ProjectRemoved += new _dispSolutionEvents_ProjectRemovedEventHandler(OnProjectRemoved); 38 | } 39 | } 40 | 41 | public void OnItemAdded(ProjectItem item) 42 | { 43 | P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName); 44 | 45 | if (item.ProjectItems != null) 46 | { 47 | for (int i = 0; i < item.FileCount; i++) 48 | { 49 | string name = item.get_FileNames((short)i); 50 | P4Operations.AddFile(m_plugin.OutputPane, name); 51 | } 52 | } 53 | else 54 | { 55 | if(System.IO.File.Exists(item.Name)) 56 | P4Operations.AddFile(m_plugin.OutputPane, item.Name); 57 | } 58 | } 59 | 60 | public void OnItemRemoved(ProjectItem item) 61 | { 62 | P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName); 63 | 64 | for (int i = 0; i < item.FileCount; i++) 65 | { 66 | string name = item.get_FileNames((short)i); 67 | P4Operations.DeleteFile(m_plugin.OutputPane, name); 68 | } 69 | } 70 | 71 | private void OnProjectAdded(Project project) 72 | { 73 | P4Operations.EditFile(m_plugin.OutputPane, m_plugin.App.Solution.FullName); 74 | P4Operations.AddFile(m_plugin.OutputPane, project.FullName); 75 | // TODO: [jt] We should if the operation is not a add new project but rather a add existing project 76 | // step through all the project items and add them to perforce. Or maybe we want the user 77 | // to do this herself? 78 | } 79 | 80 | private void OnProjectRemoved(Project project) 81 | { 82 | P4Operations.EditFile(m_plugin.OutputPane, m_plugin.App.Solution.FullName); 83 | P4Operations.DeleteFile(m_plugin.OutputPane, project.FullName); 84 | // TODO: [jt] Do we want to automatically delete the items from perforce here? 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using System.Collections.Generic; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class AutoCheckoutOnBuild : PreCommandFeature 13 | { 14 | public AutoCheckoutOnBuild(Plugin plugin) 15 | : base(plugin, "AutoCheckoutOnBuild", "Automatically checks out the source when building") 16 | { 17 | if(!Singleton.Instance.autoCheckoutOnBuild) 18 | { 19 | return; 20 | } 21 | 22 | Log.Info("Adding handlers for automatically checking out dirty files when you hit build"); 23 | 24 | RegisterHandler("Build.BuildSolution", OnCheckoutModifiedSource); 25 | RegisterHandler("Build.Compile", OnCheckoutModifiedSource); 26 | RegisterHandler("Build.BuildOnlyProject", OnCheckoutModifiedSource); 27 | RegisterHandler("Debug.Start", OnCheckoutModifiedSource); 28 | RegisterHandler("ClassViewContextMenus.ClassViewProject.Build", OnCheckoutModifiedSource); 29 | RegisterHandler("ClassViewContextMenus.ClassViewProject.Rebuild", OnCheckoutModifiedSource); 30 | RegisterHandler("ClassViewContextMenus.ClassViewProject.Debug.Startnewinstance", OnCheckoutModifiedSource); 31 | } 32 | 33 | private void OnCheckoutModifiedSource(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 34 | { 35 | foreach(Document doc in mPlugin.App.Documents) 36 | { 37 | if(!doc.Saved && doc.ReadOnly) 38 | P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using System.Collections.Generic; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class AutoCheckoutOnSave : PreCommandFeature 13 | { 14 | public AutoCheckoutOnSave(Plugin plugin) 15 | : base(plugin, "AutoCheckoutOnSave", "Automatically checks out files on save") 16 | { 17 | if(!Singleton.Instance.autoCheckoutOnSave) 18 | return; 19 | 20 | Log.Info("Adding handlers for automatically checking out dirty files when you save"); 21 | RegisterHandler("File.SaveSelectedItems", OnSaveSelected); 22 | RegisterHandler("File.SaveAll", OnSaveAll); 23 | } 24 | 25 | private void OnSaveSelected(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 26 | { 27 | foreach(SelectedItem sel in mPlugin.App.SelectedItems) 28 | { 29 | if(sel.Project != null) 30 | P4Operations.EditFileImmediate(mPlugin.OutputPane, sel.Project.FullName); 31 | else if(sel.ProjectItem != null) 32 | P4Operations.EditFileImmediate(mPlugin.OutputPane, sel.ProjectItem.Document.FullName); 33 | else 34 | P4Operations.EditFileImmediate(mPlugin.OutputPane, mPlugin.App.Solution.FullName); 35 | } 36 | } 37 | 38 | private void OnSaveAll(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 39 | { 40 | if(!mPlugin.App.Solution.Saved) 41 | P4Operations.EditFileImmediate(mPlugin.OutputPane, mPlugin.App.Solution.FullName); 42 | 43 | foreach(Document doc in mPlugin.App.Documents) 44 | { 45 | if(doc.Saved) 46 | continue; 47 | P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName); 48 | } 49 | 50 | if(mPlugin.App.Solution.Projects == null) 51 | return; 52 | 53 | foreach(Project p in mPlugin.App.Solution.Projects) 54 | { 55 | EditProjectRecursive(p); 56 | } 57 | } 58 | 59 | private void EditProjectRecursive(Project p) 60 | { 61 | if(!p.Saved) 62 | P4Operations.EditFileImmediate(mPlugin.OutputPane, p.FullName); 63 | 64 | if(p.ProjectItems == null) 65 | return; 66 | 67 | foreach(ProjectItem pi in p.ProjectItems) 68 | { 69 | if(pi.SubProject != null) 70 | { 71 | EditProjectRecursive(pi.SubProject); 72 | } 73 | else if(!pi.Saved) 74 | { 75 | for(short i = 0; i <= pi.FileCount; i++) 76 | P4Operations.EditFileImmediate(mPlugin.OutputPane, pi.get_FileNames(i)); 77 | } 78 | } 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/AutoCheckoutProject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using System.Collections.Generic; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class AutoCheckoutProject : PreCommandFeature 13 | { 14 | public AutoCheckoutProject(Plugin plugin) 15 | : base(plugin, "AutoCheckoutProject", "Automatically checks out the project files") 16 | { 17 | if(!Singleton.Instance.autoCheckoutProject) 18 | { 19 | return; 20 | } 21 | 22 | Log.Info("Adding handlers for automatically checking out .vcproj files when you do changes to the project"); 23 | RegisterHandler("ClassViewContextMenus.ClassViewProject.Properties", OnCheckoutSelectedProjects); 24 | RegisterHandler("ClassViewContextMenus.ClassViewMultiselectProjectreferencesItems.Properties", OnCheckoutSelectedProjects); 25 | RegisterHandler("File.Properties", OnCheckoutSelectedProjects); 26 | RegisterHandler("View.PropertiesWindow", OnCheckoutSelectedProjects); 27 | RegisterHandler("Project.Properties", OnCheckoutSelectedProjects); 28 | RegisterHandler("Project.AddNewItem", OnCheckoutSelectedProjects); 29 | RegisterHandler("Project.AddExistingItem", OnCheckoutSelectedProjects); 30 | 31 | // hmm : removing a file from Solution Explorer is just Edit.Delete !? 32 | RegisterHandler("Edit.Delete", OnCheckoutSelectedProjects); 33 | //RegisterHandler("5EFC7975-14BC-11CF-9B2B-00AA00573819:17", OnCheckoutSelectedProjects); 34 | 35 | RegisterHandler("File.Remove", OnCheckoutSelectedProjects); // I don't think this actually does anything 36 | } 37 | 38 | private void OnCheckoutSelectedProjects(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 39 | { 40 | // when I get Edit.Delete : 41 | if(Guid == "{5EFC7975-14BC-11CF-9B2B-00AA00573819}" && ID == 17) 42 | { 43 | // see if the active window is SolutionExplorer : 44 | Window w = mPlugin.App.ActiveWindow; 45 | if(w.Type != EnvDTE.vsWindowType.vsWindowTypeSolutionExplorer) 46 | { 47 | // it's just a delete in the text window, get out ! 48 | return; 49 | } 50 | } 51 | 52 | foreach(Project project in (Array)mPlugin.App.ActiveSolutionProjects) 53 | { 54 | P4Operations.EditFileImmediate(mPlugin.OutputPane, project.FullName); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | using System.Collections.Generic; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftyPerforce 11 | { 12 | class AutoCheckoutTextEdit : PreCommandFeature 13 | { 14 | private EnvDTE80.TextDocumentKeyPressEvents mTextDocEvents; 15 | private EnvDTE.TextEditorEvents mTextEditorEvents; 16 | 17 | public AutoCheckoutTextEdit(Plugin plugin) 18 | : base(plugin, "AutoCheckoutTextEdit", "Automatically checks out the text file on edits") 19 | { 20 | if(!Singleton.Instance.autoCheckoutOnEdit) 21 | return; 22 | 23 | Log.Info("Adding handlers for automatically checking out text files as you edit them"); 24 | mTextDocEvents = ((EnvDTE80.Events2)plugin.App.Events).get_TextDocumentKeyPressEvents(null); 25 | mTextDocEvents.BeforeKeyPress += new _dispTextDocumentKeyPressEvents_BeforeKeyPressEventHandler(OnBeforeKeyPress); 26 | 27 | mTextEditorEvents = ((EnvDTE80.Events2)plugin.App.Events).get_TextEditorEvents(null); 28 | mTextEditorEvents.LineChanged += new _dispTextEditorEvents_LineChangedEventHandler(OnLineChanged); 29 | 30 | RegisterHandler("Edit.Delete", OnCheckoutCurrentDocument); 31 | RegisterHandler("Edit.DeleteBackwards", OnCheckoutCurrentDocument); 32 | RegisterHandler("Edit.Paste", OnCheckoutCurrentDocument); 33 | } 34 | 35 | private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection Selection, bool InStatementCompletion, ref bool CancelKeypress) 36 | { 37 | if(mPlugin.App.ActiveDocument.ReadOnly) 38 | P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName); 39 | } 40 | 41 | // [jt] This handler checks for things like paste operations. In theory we should be able to remove the handler above, but 42 | // I can't get this one to fire reliably... Wonder how much these handlers will slow down the IDE? 43 | private void OnLineChanged(TextPoint StartPoint, TextPoint EndPoint, int Hint) 44 | { 45 | if((Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 && 46 | (Hint & (int)vsTextChanged.vsTextChangedMultiLine) == 0 && 47 | (Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 && 48 | (Hint != 0)) 49 | return; 50 | if(mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved) 51 | P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName); 52 | } 53 | 54 | private void OnCheckoutCurrentDocument(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 55 | { 56 | if(mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved) 57 | P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName); 58 | } 59 | 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /NiftyPerforce/EventHandlers/FindEvents.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.IO; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | 7 | /* 8 | * Read here about command events: http://support.microsoft.com/kb/555393 9 | * */ 10 | 11 | namespace Aurora 12 | { 13 | namespace NiftyPerforce 14 | { 15 | class FindEvents : Feature 16 | { 17 | private Plugin mPlugin; 18 | private CommandEvents mCommandEvents; 19 | 20 | public FindEvents(Plugin plugin) 21 | : base("FindEvents", "For debugging") 22 | { 23 | mPlugin = plugin; 24 | mCommandEvents = mPlugin.App.DTE.Events.get_CommandEvents(null, 0); 25 | mCommandEvents.BeforeExecute += BeforeCommandExecute; 26 | mCommandEvents.AfterExecute += AfterCommandExecute; 27 | } 28 | 29 | void BeforeCommandExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) 30 | { 31 | try 32 | { 33 | Command command = mPlugin.App.DTE.Commands.Item(Guid, ID); 34 | if(command == null) 35 | return; 36 | 37 | if(command.Name.Length == 0) 38 | return; 39 | 40 | string commandName = command.Name.Length > 0 ? command.Name : ""; 41 | Log.Info("Command: {0} (GUID: {1}, ID: {2})", commandName, Guid, ID); 42 | } 43 | catch 44 | { 45 | } 46 | } 47 | 48 | void AfterCommandExecute(string Guid, int ID, object CustomIn, object CustomOut) 49 | { 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /NiftyPerforce/NiftyPerforce.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /NiftyPerforce/PostBuild2010.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: 3 | :: Postbuild step for NiftySolution toolbar. 4 | :: 5 | 6 | if "%1" == "" ( 7 | goto :HELP 8 | ) 9 | 10 | if "%2" == "" ( 11 | goto :HELP 12 | ) 13 | 14 | goto :DOIT 15 | 16 | :HELP 17 | echo Usage: ^ ^ 18 | echo. 19 | echo Needs to be called from Visual Studio 20 | goto :EOF 21 | 22 | :DOIT 23 | setlocal 24 | 25 | set PROJECTDIR=%1 26 | set OUTDIR=%2 27 | 28 | :: Guess where the resgen.exe and al.exe files are... 29 | :: You might need to change this to suit your environment!!! 30 | set SDKDIR=%ProgramFiles%\Microsoft SDKs\Windows\v7.0A 31 | 32 | set PATH=%PATH%;%SDKDIR%\Bin\NETFX 4.0 Tools;%SDKDIR%\Bin 33 | 34 | 35 | pushd "%PROJECTDIR%" 36 | mkdir "%PROJECTDIR%\%OUTDIR%\en-US" 37 | Resgen "%PROJECTDIR%\ToolbarIcons.resx" 38 | Al /embed:"%PROJECTDIR%\ToolbarIcons.resources" /culture:en-US /out:"%PROJECTDIR%\%OUTDIR%\en-US\NiftyPerforce.resources.dll" 39 | del "%PROJECTDIR%\ToolbarIcons.resources" 40 | popd 41 | endlocal 42 | -------------------------------------------------------------------------------- /NiftyPerforce/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NiftyPerforce")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NiftyPerforce")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /NiftyPerforce/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NiftyPerforce.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NiftyPerforce.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap Icons { 67 | get { 68 | object obj = ResourceManager.GetObject("Icons", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /NiftyPerforce/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\Icons.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Configure.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Configure.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Diff.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Diff.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Edit.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Edit.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/EditAll.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/EditAll.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Icons.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Icons.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Icons.png -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Icons.psd -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Revert.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Revert.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/RevisionGraph.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/RevisionGraph.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/RevisionHistory.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/RevisionHistory.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/Show.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/Show.bmp -------------------------------------------------------------------------------- /NiftyPerforce/Resources/TimeLapseView.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftyPerforce/Resources/TimeLapseView.bmp -------------------------------------------------------------------------------- /NiftyPerforce/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Nifty Perforce Extension 122 | 123 | 124 | Simple Perforce integration for Visual Studio 125 | 126 | -------------------------------------------------------------------------------- /NiftyPerforce/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NiftyPerforce/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | NiftyPerforce 6 | Simple Perforce integration for Visual Studio 7 | https://github.com/jtilander/niftyplugins 8 | COPYING 9 | perforce 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NiftyPlugins.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NiftyPerforce", "NiftyPerforce\NiftyPerforce.csproj", "{4633E0B5-D536-4FCC-988E-29D54DA113DF}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuroraCore", "Shared\AuroraCore.csproj", "{A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NiftySolution", "NiftySolution\NiftySolution.csproj", "{1627DB78-9224-4BCC-B233-A6A20743961C}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {4633E0B5-D536-4FCC-988E-29D54DA113DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {4633E0B5-D536-4FCC-988E-29D54DA113DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {4633E0B5-D536-4FCC-988E-29D54DA113DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {4633E0B5-D536-4FCC-988E-29D54DA113DF}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {1627DB78-9224-4BCC-B233-A6A20743961C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {1627DB78-9224-4BCC-B233-A6A20743961C}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {1627DB78-9224-4BCC-B233-A6A20743961C}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {1627DB78-9224-4BCC-B233-A6A20743961C}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /NiftySolution/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Revision 24 | // Build Number 25 | // 26 | // You can specify all the value or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("2.0.2")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified - the assembly cannot be signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. 41 | // (*) If the key file and a key name attributes are both specified, the 42 | // following processing occurs: 43 | // (1) If the KeyName can be found in the CSP - that key is used. 44 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 45 | // in the file is installed into the CSP and used. 46 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 47 | // documentation for more information on this. 48 | // 49 | [assembly: AssemblyDelaySign(false)] 50 | [assembly: AssemblyKeyFile("")] 51 | [assembly: AssemblyKeyName("")] 52 | -------------------------------------------------------------------------------- /NiftySolution/COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2006-2010 Jim Tilander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /NiftySolution/Commands/CloseToolWindows.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftySolution 12 | { 13 | // This command is useful for cleaning up all those pesky tool windows that take up all that space 14 | // if you have a small monitor. The alternatives are either to buy a 30" or to hide them all every 15 | // now and then. 16 | public class CloseToolWindow : CommandBase 17 | { 18 | override public int IconIndex { get { return 4; } } 19 | 20 | public CloseToolWindow(Plugin plugin, string canonicalName) 21 | : base("CloseToolWindow", canonicalName, plugin, "Closes all active tool windows") 22 | { 23 | } 24 | 25 | override public void BindToKeyboard(Command vsCommand) 26 | { 27 | object[] bindings = new object[2]; 28 | bindings[0] = "Global::ctrl+del"; 29 | bindings[1] = "Text Editor::ctrl+del"; 30 | vsCommand.Bindings = bindings; 31 | } 32 | 33 | public override bool OnCommand() 34 | { 35 | CloseToolWindows(Plugin.App); 36 | 37 | // Sometimes this really doesn't "bite", so we need to run through the list again. 38 | CloseToolWindows(Plugin.App); 39 | 40 | return true; 41 | } 42 | 43 | public override bool IsEnabled() 44 | { 45 | return true; 46 | } 47 | 48 | private void CloseToolWindows(DTE2 application) 49 | { 50 | foreach (Window w in application.Windows) 51 | { 52 | if (!w.Visible) 53 | continue; 54 | 55 | if (w.Kind == "Document") 56 | continue; 57 | 58 | w.Close(EnvDTE.vsSaveChanges.vsSaveChangesNo); 59 | } 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /NiftySolution/Commands/Configure.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftySolution 11 | { 12 | public class Configure : CommandBase 13 | { 14 | override public int IconIndex { get { return 3; } } 15 | 16 | public Configure(Plugin plugin, string canonicalName) 17 | : base("Configure", canonicalName, plugin, "Configures the plugin") 18 | { 19 | } 20 | 21 | public override bool OnCommand() 22 | { 23 | Log.Debug("Launching the configure tool"); 24 | 25 | Options options = (Options)Plugin.Options; 26 | options.Save(); 27 | 28 | ConfigDialog dlg = new ConfigDialog(); 29 | dlg.propertyGrid1.SelectedObject = options; 30 | 31 | if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) 32 | { 33 | Plugin.Options = Options.Load(options.mFileName); 34 | } 35 | else 36 | { 37 | options.Save(); 38 | } 39 | 40 | return true; 41 | } 42 | 43 | public override bool IsEnabled() 44 | { 45 | return true; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /NiftySolution/Commands/QuickOpen.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.Shell; 6 | 7 | namespace Aurora 8 | { 9 | namespace NiftySolution 10 | { 11 | // TODO: What we really should do here is to make the population of the opendialog in the background. 12 | // We should subscribe to the open and close solution as well as the project events and then 13 | // trigger rebuilding of the dialog... 14 | public class QuickOpen : CommandBase 15 | { 16 | private SolutionFiles mFiles = null; 17 | QuickOpenDialog mDialog = null; 18 | 19 | override public int IconIndex { get { return 1; } } 20 | 21 | public QuickOpen(Plugin plugin, string canonicalName) 22 | : base("QuickOpen", canonicalName, plugin, "Quickly opens any file in the solution") 23 | { 24 | } 25 | 26 | override public void BindToKeyboard(Command vsCommand) 27 | { 28 | vsCommand.Bindings = "Global::ctrl+o"; 29 | } 30 | 31 | public override bool OnCommand() 32 | { 33 | if(null == mFiles) 34 | { 35 | Log.Info("First time fast open is run, scanning solution for files"); 36 | mFiles = new SolutionFiles(Plugin); 37 | mFiles.Refresh(); 38 | } 39 | 40 | if(null == mDialog) 41 | mDialog = new QuickOpenDialog(mFiles); 42 | 43 | if(mDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) 44 | { 45 | string name = mDialog.FileToOpen; 46 | if(name.Length > 0 ) 47 | Plugin.App.DTE.ExecuteCommand("File.OpenFile", string.Format("\"{0}\"", name)); 48 | 49 | // TODO: Each time here we could save off the window position into the registry and 50 | // use it when we open the window the next time around. 51 | } 52 | 53 | return true; 54 | } 55 | 56 | public override bool IsEnabled() 57 | { 58 | return true; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /NiftySolution/Commands/ToggleFile.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftySolution 12 | { 13 | // This tries to quickly switch between the .h and the .cpp file pair 14 | // TODO: this could be done better, by searching through and making a list 15 | // of all the pairs given all the files in the projects. 16 | public class ToggleFile : CommandBase 17 | { 18 | private Dictionary m_knownExtensions; 19 | 20 | override public int IconIndex { get { return 2; } } 21 | 22 | public ToggleFile(Plugin plugin, string canonicalName) 23 | : base("ToggleFile", canonicalName, plugin, "Toggles between the header and the cpp file") 24 | { 25 | m_knownExtensions = new Dictionary(); 26 | m_knownExtensions.Add(".h", new string[] { ".inl", ".cpp", ".c", ".cc", ".cxx", ".mm", ".m" }); 27 | m_knownExtensions.Add(".c", new string[] { ".h" }); 28 | m_knownExtensions.Add(".cpp", new string[] { ".h", ".hxx", ".hpp" }); 29 | m_knownExtensions.Add(".cc", new string[] { ".h", ".hxx", ".hpp" }); 30 | m_knownExtensions.Add(".mm", new string[] { ".h", ".hxx", ".hpp" }); 31 | m_knownExtensions.Add(".m", new string[] { ".h", ".hxx", ".hpp" }); 32 | m_knownExtensions.Add(".inl", new string[] { ".cpp", ".c", ".cc", ".cxx", ".mm", ".m" }); 33 | } 34 | 35 | override public void BindToKeyboard(Command vsCommand) 36 | { 37 | //object[] bindings = new object[1]; 38 | //bindings[0] = "Global::Ctrl+G"; 39 | //bindings[0] = "Text Editor::Ctrl+Return"; 40 | //vsCommand.Bindings = bindings; 41 | } 42 | 43 | public override bool OnCommand() 44 | { 45 | if (null == Plugin.App.DTE.ActiveDocument) 46 | return false; 47 | 48 | string fullPath = Plugin.App.DTE.ActiveDocument.FullName; 49 | string extension = Path.GetExtension(fullPath); 50 | string filename = Path.Combine(Path.GetDirectoryName(fullPath), Path.GetFileNameWithoutExtension(fullPath)); 51 | 52 | // TODO: This needs to cycle though the indices based on the current extension 53 | Log.Debug("Trying to find a pair to {0} in path", filename); 54 | try 55 | { 56 | string[] candidates = m_knownExtensions[extension]; 57 | foreach (string candidate in candidates) 58 | { 59 | string candidatePath = filename + candidate; 60 | if (System.IO.File.Exists(candidatePath)) 61 | { 62 | Plugin.App.DTE.ExecuteCommand("File.OpenFile", candidatePath); 63 | return true; 64 | } 65 | } 66 | } 67 | catch (KeyNotFoundException) 68 | { 69 | return false; 70 | } 71 | 72 | try 73 | { 74 | Log.Debug("Could not find pair file to {0} in path, now checking the opened documents.", filename); 75 | 76 | // As a fallback we can just step through the currently opened documents -- should be fairly useful. 77 | string[] candidates = m_knownExtensions[extension]; 78 | foreach (string candidate in candidates) 79 | { 80 | string candidatePath = Path.GetFileName((filename + candidate).ToLower()); 81 | 82 | foreach(Document doc in Plugin.App.Documents) 83 | { 84 | if( Path.GetFileName(doc.FullName.ToLower()) == candidatePath ) 85 | { 86 | Plugin.App.DTE.ExecuteCommand("File.OpenFile", doc.FullName); 87 | return true; 88 | } 89 | } 90 | } 91 | } 92 | catch (KeyNotFoundException) 93 | { 94 | return false; 95 | } 96 | 97 | return false; 98 | } 99 | 100 | public override bool IsEnabled() 101 | { 102 | return true; 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /NiftySolution/Connect.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Connect.cs -------------------------------------------------------------------------------- /NiftySolution/EventHandlers/SolutionBuildTimings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using System.Diagnostics; 6 | using System.IO; 7 | 8 | namespace Aurora 9 | { 10 | namespace NiftySolution 11 | { 12 | class SolutionBuildTimings 13 | { 14 | private Stopwatch m_timer; 15 | private BuildEvents m_buildEvents; 16 | private DateTime m_start; 17 | private string m_logfilename; 18 | private Plugin m_plugin; 19 | 20 | public SolutionBuildTimings(Plugin plugin) 21 | { 22 | m_plugin = plugin; 23 | 24 | m_buildEvents = ((EnvDTE80.Events2)plugin.App.Events).BuildEvents; 25 | m_buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); 26 | m_buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone); 27 | 28 | m_timer = new Stopwatch(); 29 | 30 | Options options = (Options)plugin.Options; 31 | m_logfilename = options.CompileTimeLogFile; 32 | } 33 | 34 | void OnBuildDone(vsBuildScope Scope, vsBuildAction Action) 35 | { 36 | if (Scope != vsBuildScope.vsBuildScopeSolution) 37 | return; 38 | 39 | DateTime now = DateTime.Now; 40 | 41 | m_timer.Stop(); 42 | TimeSpan ts = m_timer.Elapsed; 43 | string timeMessage = String.Format("Total solution build time: {0:00}:{1:00}:{2:00}.{3:00} (started {4} {5} and ended {6} {7})\n", 44 | ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10, m_start.ToShortDateString(), m_start.ToLongTimeString(), now.ToShortDateString(), now.ToLongTimeString()); 45 | OutputWindowPane pane = Plugin.FindOutputPane(m_plugin.App, "Build"); 46 | pane.OutputString(timeMessage); 47 | 48 | m_timer.Reset(); 49 | 50 | 51 | if (m_logfilename != "") 52 | { 53 | using (StreamWriter w = new StreamWriter(m_logfilename, true)) 54 | { 55 | string logMessage = String.Format("{0} {1}|{2:00}:{3:00}:{4:00}", now.ToShortDateString(), now.ToLongTimeString(), ts.Hours, ts.Minutes, ts.Seconds ); 56 | w.WriteLine(logMessage); 57 | } 58 | } 59 | } 60 | 61 | void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) 62 | { 63 | if (Scope != vsBuildScope.vsBuildScopeSolution) 64 | return; 65 | m_timer.Start(); 66 | m_start = DateTime.Now; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /NiftySolution/NiftySolution.AddIn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/NiftySolution.AddIn -------------------------------------------------------------------------------- /NiftySolution/NiftySolutionPackage.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /NiftySolution/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | using System.ComponentModel; 5 | 6 | namespace Aurora 7 | { 8 | namespace NiftySolution 9 | { 10 | // TODO: How do we handle different versions of this XML file on disk? 11 | [Serializable] 12 | public class Options 13 | { 14 | private bool mDirty = false; 15 | private bool mEnableBindings = false; 16 | private bool mSilentDebuggerExceptions = false; 17 | private bool mIgnoreDebuggerExceptions = false; 18 | 19 | private string mExtraSearchDirectories = ""; 20 | private string mCompileTimeLogFile = ""; 21 | 22 | [XmlIgnore] 23 | public string mFileName = ""; 24 | 25 | [XmlIgnore] 26 | [BrowsableAttribute(false)] 27 | public bool Dirty 28 | { 29 | get 30 | { 31 | return mDirty; 32 | } 33 | } 34 | 35 | [Category("General"), Description("Register Key Bindings")] 36 | public bool EnableBindings 37 | { 38 | get 39 | { 40 | return mEnableBindings; 41 | } 42 | 43 | set 44 | { 45 | mEnableBindings = value; 46 | mDirty = true; 47 | } 48 | } 49 | 50 | [Category("General"), Description("Exceptions in debugger behaves as in VC6")] 51 | public bool SilentDebuggerExceptions 52 | { 53 | get 54 | { 55 | return mSilentDebuggerExceptions; 56 | } 57 | 58 | set 59 | { 60 | mSilentDebuggerExceptions = value; 61 | mDirty = true; 62 | } 63 | } 64 | 65 | [Category("General"), Description("All exceptions in debugger are ignored")] 66 | public bool IgnoreDebuggerExceptions 67 | { 68 | get 69 | { 70 | return mIgnoreDebuggerExceptions; 71 | } 72 | 73 | set 74 | { 75 | mIgnoreDebuggerExceptions = value; 76 | mDirty = true; 77 | } 78 | } 79 | 80 | [Category("NiftyOpen"), Description("Also add all the files underneath these ; delimited directories")] 81 | public string ExtraSearchDirs 82 | { 83 | get { return mExtraSearchDirectories; } 84 | set { mExtraSearchDirectories = value; mDirty = true; } 85 | } 86 | 87 | [Category("Productivity"), Description("Log the compilation time to a separate log")] 88 | public string CompileTimeLogFile 89 | { 90 | get 91 | { 92 | return mCompileTimeLogFile; 93 | } 94 | 95 | set 96 | { 97 | mCompileTimeLogFile = value; 98 | mDirty = true; 99 | } 100 | } 101 | 102 | public static Options Load(string filename) 103 | { 104 | Options o; 105 | if(System.IO.File.Exists(filename)) 106 | { 107 | o = File.LoadXML(filename); 108 | } 109 | else 110 | { 111 | o = new Options(); 112 | } 113 | o.mFileName = filename; 114 | return o; 115 | } 116 | 117 | public void Save() 118 | { 119 | if(mDirty) 120 | { 121 | File.SaveXML(mFileName, this); 122 | mDirty = false; 123 | } 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /NiftySolution/PostBuild2010.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: 3 | :: Postbuild step for NiftySolution toolbar. 4 | :: 5 | 6 | if "%1" == "" ( 7 | goto :HELP 8 | ) 9 | 10 | if "%2" == "" ( 11 | goto :HELP 12 | ) 13 | 14 | goto :DOIT 15 | 16 | :HELP 17 | echo Usage: ^ ^ 18 | echo. 19 | echo Needs to be called from Visual Studio 20 | goto :EOF 21 | 22 | :DOIT 23 | setlocal 24 | 25 | set PROJECTDIR=%1 26 | set OUTDIR=%2 27 | 28 | :: Guess where the resgen.exe and al.exe files are... 29 | :: You might need to change this to suit your environment!!! 30 | set SDKDIR=%ProgramFiles%\Microsoft SDKs\Windows\v7.0A 31 | 32 | set PATH=%PATH%;%SDKDIR%\Bin\NETFX 4.0 Tools;%SDKDIR%\Bin 33 | 34 | 35 | pushd "%PROJECTDIR%" 36 | mkdir "%PROJECTDIR%\%OUTDIR%\en-US" 37 | Resgen "%PROJECTDIR%\ToolbarIcons.resx" 38 | Al /embed:"%PROJECTDIR%\ToolbarIcons.resources" /culture:en-US /out:"%PROJECTDIR%\%OUTDIR%\en-US\NiftySolution.resources.dll" 39 | del "%PROJECTDIR%\ToolbarIcons.resources" 40 | popd 41 | endlocal 42 | -------------------------------------------------------------------------------- /NiftySolution/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NiftySolution")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NiftySolution")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /NiftySolution/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NiftySolution.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NiftySolution.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap Icons { 67 | get { 68 | object obj = ResourceManager.GetObject("Icons", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /NiftySolution/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\Icons.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /NiftySolution/Resources/Configure.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/Configure.bmp -------------------------------------------------------------------------------- /NiftySolution/Resources/DeleteTool.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/DeleteTool.bmp -------------------------------------------------------------------------------- /NiftySolution/Resources/Icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/Icons.png -------------------------------------------------------------------------------- /NiftySolution/Resources/Icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/Icons.psd -------------------------------------------------------------------------------- /NiftySolution/Resources/Open.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/Open.bmp -------------------------------------------------------------------------------- /NiftySolution/Resources/Toggle.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/NiftySolution/Resources/Toggle.bmp -------------------------------------------------------------------------------- /NiftySolution/SearchEntry.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.IO; 6 | 7 | namespace Aurora 8 | { 9 | namespace NiftySolution 10 | { 11 | public class SearchEntry 12 | { 13 | public string fullPath = ""; 14 | public string project = ""; 15 | public string description = ""; 16 | public string key = ""; 17 | public string filename = ""; 18 | 19 | public SearchEntry() 20 | { 21 | } 22 | 23 | public class CompareOnRelevance : IComparer 24 | { 25 | private string mQuery; 26 | 27 | public CompareOnRelevance(string query) 28 | { 29 | mQuery = query.ToLower(); 30 | } 31 | 32 | public int Compare(SearchEntry lhs, SearchEntry rhs) 33 | { 34 | int relevance = (lhs.filename.StartsWith(mQuery) ? 0 : 1) - (rhs.filename.StartsWith(mQuery) ? 0 : 1); 35 | if(relevance != 0) 36 | return relevance; 37 | 38 | return string.Compare(lhs.fullPath, rhs.fullPath); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /NiftySolution/SolutionFiles.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using System.IO; 8 | 9 | namespace Aurora 10 | { 11 | namespace NiftySolution 12 | { 13 | public class SolutionFiles 14 | { 15 | private Plugin mPlugin; 16 | private DTE2 m_application; 17 | private List m_solutionFiles = new List(); 18 | private List mHits = new List(); 19 | 20 | public int Count 21 | { 22 | get { return m_solutionFiles.Count; } 23 | } 24 | 25 | public SolutionFiles(Plugin plugin) 26 | { 27 | m_application = plugin.App; 28 | mPlugin = plugin; 29 | } 30 | 31 | public void Refresh() 32 | { 33 | m_solutionFiles.Clear(); 34 | 35 | foreach(Project project in m_application.Solution.Projects) 36 | { 37 | Log.Info("\tScanning project {0}", project.Name); 38 | AddProjectItems(project.ProjectItems); 39 | } 40 | Log.Info("Scanning done ({0} files in {1} projects)", Count, m_application.Solution.Projects.Count); 41 | 42 | 43 | // Now, let's add the files that were explicitly referenced from the config dialog. 44 | Options options = (Options)mPlugin.Options; 45 | string[] directories = options.ExtraSearchDirs.Split(';'); 46 | 47 | foreach(string dir in directories) 48 | { 49 | if (dir.Length == 0) 50 | continue; 51 | string expanded = Environment.ExpandEnvironmentVariables(dir); 52 | Log.Info("Scanning files from {0}", expanded); 53 | int count = AddFilesFromDir(expanded); 54 | Log.Info("Added {0} files", count); 55 | } 56 | } 57 | 58 | private int AddFilesFromDir(string dirname) 59 | { 60 | int count = 0; 61 | 62 | foreach(string file in Directory.GetFiles(dirname)) 63 | { 64 | SearchEntry entry = new SearchEntry(); 65 | entry.fullPath = file; 66 | entry.key = file.ToLower(); 67 | entry.filename = Path.GetFileName(file); 68 | m_solutionFiles.Add(entry); 69 | 70 | count++; 71 | } 72 | 73 | foreach(string dir in Directory.GetDirectories(dirname)) 74 | { 75 | count += AddFilesFromDir(dir); 76 | } 77 | 78 | return count; 79 | } 80 | 81 | private void AddProjectItems(ProjectItems projectItems) 82 | { 83 | // HACK: Horrible! But how will we know what not to include in the list? 84 | // CPP: {6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C} 85 | // H: {6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C} 86 | // Folder:{6BB5F8F0-4483-11D3-8BCF-00C04F8EC28C} 87 | // 88 | // "{5F422961-1EE4-47EB-A53B-777B4164F8DF}" <-- it's a folder ? 89 | if(null == projectItems) 90 | return; 91 | foreach(ProjectItem item in projectItems) 92 | { 93 | if("{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}" == item.Kind) 94 | { 95 | // Indices starts at 1 ... http://msdn.microsoft.com/en-us/library/envdte.projectitem.filenames.aspx 96 | for(short i = 0; i < item.FileCount; i++) 97 | { 98 | string name = item.get_FileNames((short)i); 99 | 100 | SearchEntry entry = new SearchEntry(); 101 | entry.fullPath = name; 102 | entry.key = name.ToLower(); 103 | entry.filename = Path.GetFileName(entry.key); 104 | m_solutionFiles.Add(entry); 105 | } 106 | } 107 | 108 | AddProjectItems(item.ProjectItems); 109 | 110 | if(item.SubProject != null) 111 | { 112 | AddProjectItems(item.SubProject.ProjectItems); 113 | } 114 | 115 | } 116 | } 117 | 118 | public int CandidateCount 119 | { 120 | get { return mHits.Count; } 121 | } 122 | 123 | public SearchEntry Candidate(int i) 124 | { 125 | return mHits[i]; 126 | } 127 | 128 | public void UpdateSearchQuery(string query, bool incremental) 129 | { 130 | if(query.Length > 0) 131 | { 132 | if(!incremental) 133 | { 134 | mHits = Filter(m_solutionFiles, query); 135 | } 136 | else 137 | { 138 | mHits = Filter(mHits, query); 139 | } 140 | } 141 | else 142 | { 143 | } 144 | 145 | // TODO: Sort the files based on relevance. 146 | mHits.Sort(new SearchEntry.CompareOnRelevance(query)); 147 | } 148 | 149 | private List Filter(List candidates, string query) 150 | { 151 | query = query.ToLower(); 152 | return candidates.FindAll(delegate(SearchEntry e) { return e.key.Contains(query); }); 153 | } 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /NiftySolution/ToolbarIcons.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.0 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NiftySolution { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class ToolbarIcons { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal ToolbarIcons() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NiftySolution.ToolbarIcons", typeof(ToolbarIcons).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap _1 { 67 | get { 68 | object obj = ResourceManager.GetObject("1", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap _2 { 77 | get { 78 | object obj = ResourceManager.GetObject("2", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap _3 { 87 | get { 88 | object obj = ResourceManager.GetObject("3", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap _4 { 97 | get { 98 | object obj = ResourceManager.GetObject("4", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /NiftySolution/UI/ConfigDialog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Aurora 11 | { 12 | 13 | namespace NiftySolution 14 | { 15 | public partial class ConfigDialog : Form 16 | { 17 | public ConfigDialog() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | Close(); 25 | } 26 | 27 | private void button2_Click(object sender, EventArgs e) 28 | { 29 | Close(); 30 | } 31 | 32 | private void propertyGrid1_Click(object sender, EventArgs e) 33 | { 34 | 35 | } 36 | 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /NiftySolution/UI/ConfigDialog.designer.cs: -------------------------------------------------------------------------------- 1 | namespace Aurora 2 | { 3 | namespace NiftySolution 4 | { 5 | partial class ConfigDialog 6 | { 7 | /// 8 | /// Required designer variable. 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | /// 13 | /// Clean up any resources being used. 14 | /// 15 | /// true if managed resources should be disposed; otherwise, false. 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing && (components != null)) 19 | { 20 | components.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region Windows Form Designer generated code 26 | 27 | /// 28 | /// Required method for Designer support - do not modify 29 | /// the contents of this method with the code editor. 30 | /// 31 | private void InitializeComponent() 32 | { 33 | this.button1 = new System.Windows.Forms.Button(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 36 | this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); 37 | this.groupBox2.SuspendLayout(); 38 | this.SuspendLayout(); 39 | // 40 | // button1 41 | // 42 | this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; 43 | this.button1.Location = new System.Drawing.Point(70, 442); 44 | this.button1.Name = "button1"; 45 | this.button1.Size = new System.Drawing.Size(75, 23); 46 | this.button1.TabIndex = 3; 47 | this.button1.Text = "Ok"; 48 | this.button1.UseVisualStyleBackColor = true; 49 | this.button1.Click += new System.EventHandler(this.button1_Click); 50 | // 51 | // button2 52 | // 53 | this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; 54 | this.button2.Location = new System.Drawing.Point(177, 442); 55 | this.button2.Name = "button2"; 56 | this.button2.Size = new System.Drawing.Size(75, 23); 57 | this.button2.TabIndex = 4; 58 | this.button2.Text = "Cancel"; 59 | this.button2.UseVisualStyleBackColor = true; 60 | this.button2.Click += new System.EventHandler(this.button2_Click); 61 | // 62 | // groupBox2 63 | // 64 | this.groupBox2.Controls.Add(this.propertyGrid1); 65 | this.groupBox2.Location = new System.Drawing.Point(12, 12); 66 | this.groupBox2.Name = "groupBox2"; 67 | this.groupBox2.Size = new System.Drawing.Size(299, 400); 68 | this.groupBox2.TabIndex = 9; 69 | this.groupBox2.TabStop = false; 70 | this.groupBox2.Text = "Settings"; 71 | // 72 | // propertyGrid1 73 | // 74 | this.propertyGrid1.Location = new System.Drawing.Point(6, 19); 75 | this.propertyGrid1.Name = "propertyGrid1"; 76 | this.propertyGrid1.Size = new System.Drawing.Size(287, 375); 77 | this.propertyGrid1.TabIndex = 0; 78 | this.propertyGrid1.Click += new System.EventHandler(this.propertyGrid1_Click); 79 | // 80 | // ConfigDialog 81 | // 82 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 | this.ClientSize = new System.Drawing.Size(323, 477); 85 | this.Controls.Add(this.groupBox2); 86 | this.Controls.Add(this.button2); 87 | this.Controls.Add(this.button1); 88 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 89 | this.Name = "ConfigDialog"; 90 | this.Text = "NiftySolution configuration"; 91 | this.groupBox2.ResumeLayout(false); 92 | this.ResumeLayout(false); 93 | 94 | } 95 | 96 | #endregion 97 | 98 | private System.Windows.Forms.Button button1; 99 | private System.Windows.Forms.Button button2; 100 | private System.Windows.Forms.GroupBox groupBox2; 101 | public System.Windows.Forms.PropertyGrid propertyGrid1; 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /NiftySolution/UI/ConfigDialog.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NiftySolution/UI/QuickOpenDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Aurora 2 | { 3 | 4 | namespace NiftySolution 5 | { 6 | partial class QuickOpenDialog 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private System.ComponentModel.IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Windows Form Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.mStatuStrip = new System.Windows.Forms.StatusStrip(); 35 | this.mStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); 36 | this.mSelectionInfo = new System.Windows.Forms.ToolStripStatusLabel(); 37 | this.mInputText = new System.Windows.Forms.TextBox(); 38 | this.mSearchResults = new Aurora.NiftySolution.SearchResultControl(); 39 | this.mStatuStrip.SuspendLayout(); 40 | this.SuspendLayout(); 41 | // 42 | // mStatuStrip 43 | // 44 | this.mStatuStrip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 45 | | System.Windows.Forms.AnchorStyles.Right))); 46 | this.mStatuStrip.Dock = System.Windows.Forms.DockStyle.None; 47 | this.mStatuStrip.ImageScalingSize = new System.Drawing.Size(32, 32); 48 | this.mStatuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 49 | this.mStatusLabel, 50 | this.mSelectionInfo}); 51 | this.mStatuStrip.Location = new System.Drawing.Point(0, 464); 52 | this.mStatuStrip.Name = "mStatuStrip"; 53 | this.mStatuStrip.Size = new System.Drawing.Size(95, 22); 54 | this.mStatuStrip.TabIndex = 0; 55 | this.mStatuStrip.Text = "statusStrip1"; 56 | // 57 | // mStatusLabel 58 | // 59 | this.mStatusLabel.Name = "mStatusLabel"; 60 | this.mStatusLabel.Size = new System.Drawing.Size(35, 17); 61 | this.mStatusLabel.Text = "Hello"; 62 | // 63 | // mSelectionInfo 64 | // 65 | this.mSelectionInfo.Name = "mSelectionInfo"; 66 | this.mSelectionInfo.Size = new System.Drawing.Size(28, 17); 67 | this.mSelectionInfo.Text = "Info"; 68 | // 69 | // mInputText 70 | // 71 | this.mInputText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 72 | | System.Windows.Forms.AnchorStyles.Right))); 73 | this.mInputText.Location = new System.Drawing.Point(0, 0); 74 | this.mInputText.Name = "mInputText"; 75 | this.mInputText.Size = new System.Drawing.Size(589, 20); 76 | this.mInputText.TabIndex = 0; 77 | this.mInputText.TextChanged += new System.EventHandler(this.textBox1_TextChanged); 78 | this.mInputText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown); 79 | // 80 | // mSearchResults 81 | // 82 | this.mSearchResults.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 83 | | System.Windows.Forms.AnchorStyles.Left))); 84 | this.mSearchResults.AutoValidate = System.Windows.Forms.AutoValidate.Disable; 85 | this.mSearchResults.CausesValidation = false; 86 | this.mSearchResults.ImeMode = System.Windows.Forms.ImeMode.Off; 87 | this.mSearchResults.Location = new System.Drawing.Point(0, 26); 88 | this.mSearchResults.Name = "mSearchResults"; 89 | this.mSearchResults.Size = new System.Drawing.Size(587, 438); 90 | this.mSearchResults.TabIndex = 1; 91 | // 92 | // QuickOpenDialog 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.ClientSize = new System.Drawing.Size(587, 483); 97 | this.ControlBox = false; 98 | this.Controls.Add(this.mSearchResults); 99 | this.Controls.Add(this.mInputText); 100 | this.Controls.Add(this.mStatuStrip); 101 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; 102 | this.KeyPreview = true; 103 | this.Name = "QuickOpenDialog"; 104 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 105 | this.Text = "QuickOpen"; 106 | this.Shown += new System.EventHandler(this.QuickOpenDialog_Shown); 107 | this.mStatuStrip.ResumeLayout(false); 108 | this.mStatuStrip.PerformLayout(); 109 | this.ResumeLayout(false); 110 | this.PerformLayout(); 111 | 112 | } 113 | 114 | #endregion 115 | 116 | private System.Windows.Forms.StatusStrip mStatuStrip; 117 | private System.Windows.Forms.TextBox mInputText; 118 | private SearchResultControl mSearchResults; 119 | private System.Windows.Forms.ToolStripStatusLabel mStatusLabel; 120 | private System.Windows.Forms.ToolStripStatusLabel mSelectionInfo; 121 | } 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /NiftySolution/UI/QuickOpenDialog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace Aurora 11 | { 12 | namespace NiftySolution 13 | { 14 | public partial class QuickOpenDialog : Form 15 | { 16 | SolutionFiles mFiles; 17 | string mFileToOpen = ""; 18 | 19 | public string FileToOpen 20 | { 21 | get { return mFileToOpen; } 22 | } 23 | 24 | public QuickOpenDialog(SolutionFiles files) 25 | { 26 | mFiles = files; 27 | InitializeComponent(); 28 | 29 | mSearchResults.SearchSpace = mFiles; 30 | mStatusLabel.Text = string.Format("{0} hits", mSearchResults.CandidateCount); 31 | 32 | Resize += new EventHandler(searchResultControl1_Resize); 33 | } 34 | 35 | private void searchResultControl1_Resize(object sender, EventArgs e) 36 | { 37 | 38 | } 39 | 40 | private void textBox1_KeyDown(object sender, KeyEventArgs e) 41 | { 42 | switch(e.KeyCode) 43 | { 44 | case Keys.Escape: 45 | DialogResult = DialogResult.Cancel; 46 | this.Close(); 47 | break; 48 | 49 | case Keys.Enter: 50 | mFileToOpen = mSearchResults.Selected.fullPath; 51 | DialogResult = DialogResult.OK; 52 | this.Close(); 53 | break; 54 | 55 | case Keys.Down: 56 | mSearchResults.NextMatch(); 57 | e.Handled = true; 58 | mSelectionInfo.Text = mSearchResults.Selected.fullPath; 59 | break; 60 | 61 | case Keys.Up: 62 | mSearchResults.PrevMatch(); 63 | e.Handled = true; 64 | mSelectionInfo.Text = mSearchResults.Selected.fullPath; 65 | break; 66 | 67 | case Keys.F5: 68 | mFiles.Refresh(); 69 | break; 70 | } 71 | } 72 | 73 | private void textBox1_TextChanged(object sender, EventArgs e) 74 | { 75 | mSearchResults.QueryString = mInputText.Text; 76 | mStatusLabel.Text = string.Format("{0} hits", mSearchResults.CandidateCount); 77 | } 78 | 79 | private void QuickOpenDialog_Shown(object sender, EventArgs e) 80 | { 81 | if(0 == mInputText.Text.Length) 82 | return; 83 | mInputText.SelectAll(); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /NiftySolution/UI/QuickOpenDialog.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /NiftySolution/UI/SearchResultControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Aurora.NiftySolution 2 | { 3 | partial class SearchResultControl 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if(disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // SearchResultControl 34 | // 35 | this.AutoValidate = System.Windows.Forms.AutoValidate.Disable; 36 | this.CausesValidation = false; 37 | this.ImeMode = System.Windows.Forms.ImeMode.Off; 38 | this.Name = "SearchResultControl"; 39 | this.Size = new System.Drawing.Size(315, 281); 40 | this.Paint += new System.Windows.Forms.PaintEventHandler(this.SearchResultControl_Paint); 41 | this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SearchResultControl_MouseClick); 42 | this.ResumeLayout(false); 43 | 44 | } 45 | 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /NiftySolution/UI/SearchResultControl.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Drawing; 6 | using System.Data; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.ComponentModel.Design; 10 | using System.IO; 11 | 12 | namespace Aurora.NiftySolution 13 | { 14 | public partial class SearchResultControl : UserControl 15 | { 16 | private string mQueryString = ""; 17 | private int mHighlighted = -1; 18 | private SolutionFiles mFiles = null; 19 | private int mBorder = 3; 20 | 21 | public SolutionFiles SearchSpace 22 | { 23 | set { mFiles = value; } 24 | } 25 | 26 | public int CandidateCount 27 | { 28 | get { return mFiles.CandidateCount; } 29 | } 30 | 31 | public SearchEntry Selected 32 | { 33 | get 34 | { 35 | if(mFiles.CandidateCount == 0) 36 | return new SearchEntry(); 37 | if(mHighlighted == -1) 38 | return mFiles.Candidate(0); 39 | return mFiles.Candidate(mHighlighted); 40 | } 41 | } 42 | 43 | public string QueryString 44 | { 45 | set 46 | { 47 | bool incremental = 1 < value.Length && mQueryString.Length < value.Length; 48 | 49 | mQueryString = value; 50 | UpdateSearchQuery(incremental); 51 | } 52 | } 53 | 54 | public SearchResultControl() 55 | { 56 | InitializeComponent(); 57 | } 58 | 59 | private void SearchResultControl_Paint(object sender, PaintEventArgs e) 60 | { 61 | if(DesignMode == true) 62 | return; 63 | 64 | Graphics graphics = e.Graphics; 65 | graphics.ResetClip(); 66 | 67 | graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; 68 | 69 | int rowHeight = Font.Height + mBorder; 70 | int maxRows = ClientRectangle.Height / rowHeight; 71 | 72 | Rectangle drawArea = Rectangle.Inflate(ClientRectangle, -mBorder, -mBorder); 73 | 74 | int lines = Math.Min(maxRows, mFiles.CandidateCount); 75 | 76 | for(int i = 0; i < lines; i++) 77 | { 78 | string lineText = Path.GetFileName(mFiles.Candidate(i).fullPath); 79 | 80 | RectangleF layoutRect = new RectangleF(drawArea.Left, drawArea.Top + i * rowHeight, drawArea.Width, rowHeight); 81 | 82 | 83 | if(i == mHighlighted) 84 | { 85 | 86 | //graphics.FillRectangle(Brushes.AliceBlue, layoutRect); 87 | graphics.FillRectangle(Brushes.DeepSkyBlue, layoutRect); 88 | RectangleF outline = new RectangleF(layoutRect.X, layoutRect.Y, layoutRect.Width - 1, layoutRect.Height - 1); 89 | graphics.DrawRectangle(Pens.Silver, Rectangle.Round(outline)); 90 | } 91 | 92 | graphics.DrawString(lineText, Font, Brushes.Black, layoutRect); 93 | } 94 | } 95 | 96 | public void NextMatch() 97 | { 98 | mHighlighted += 1; 99 | ValidateHighlightIndex(); 100 | Invalidate(); 101 | } 102 | 103 | public void PrevMatch() 104 | { 105 | mHighlighted -= 1; 106 | ValidateHighlightIndex(); 107 | Invalidate(); 108 | } 109 | 110 | private void UpdateSearchQuery(bool incrementalSearch) 111 | { 112 | mFiles.UpdateSearchQuery(mQueryString, incrementalSearch); 113 | 114 | if(mFiles.CandidateCount == 0) 115 | { 116 | mHighlighted = -1; 117 | } 118 | else if(mFiles.CandidateCount < mHighlighted) 119 | { 120 | mHighlighted = mFiles.CandidateCount - 1; 121 | } 122 | 123 | Invalidate(); 124 | } 125 | 126 | private void SearchResultControl_MouseClick(object sender, MouseEventArgs e) 127 | { 128 | int rowHeight = Font.Height + mBorder; 129 | mHighlighted = (e.Y - mBorder) / rowHeight; 130 | if(!ValidateHighlightIndex()) 131 | mHighlighted = -1; 132 | Invalidate(); 133 | } 134 | 135 | private bool ValidateHighlightIndex() 136 | { 137 | if(mFiles.CandidateCount == 0) 138 | { 139 | mHighlighted = -1; 140 | return false; 141 | } 142 | if(mHighlighted < 0) 143 | { 144 | mHighlighted = mFiles.CandidateCount - 1; 145 | return false; 146 | } 147 | if(mHighlighted >= mFiles.CandidateCount) 148 | { 149 | mHighlighted = 0; 150 | return false; 151 | } 152 | return true; 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /NiftySolution/UI/SearchResultControl.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /NiftySolution/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Nifty Solution Extension 122 | 123 | 124 | Open solution file and toggle header/cpp 125 | 126 | -------------------------------------------------------------------------------- /NiftySolution/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NiftySolution/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | NiftySolution 6 | Nifty Solution 7 | https://github.com/jtilander/niftyplugins 8 | COPYING 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | 4 | This is a small collection of C# plugins for Visual Studio. 5 | 6 | NiftyPerforce 7 | ============= 8 | 9 | Adds some automation and IDE support for common perforce operations. 10 | The goal of the plugin is to be very lightweight and unobtrusive. 11 | 12 | NiftySolution 13 | ============= 14 | 15 | Adds a open files in solution dialog. 16 | Adds a toggle header/cpp file command. 17 | Adds a build timing hook. 18 | 19 | 20 | 21 | Jim Tilander 22 | San Francisco, 2006 23 | -------------------------------------------------------------------------------- /Shared/AuroraCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.50727 7 | 2.0 8 | {A2D1CBE2-C37F-46E7-BF45-FCA62A79F2EE} 9 | Library 10 | Properties 11 | AuroraCore 12 | AuroraCore 13 | v4.5 14 | 15 | 16 | 2.0 17 | 18 | 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | false 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | false 38 | 39 | 40 | 41 | 42 | 43 | False 44 | ..\..\..\Program Files\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Microsoft.VisualStudio.CommandBars.dll 45 | 46 | 47 | False 48 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.0.23107\lib\Microsoft.VisualStudio.Shell.14.0.dll 49 | 50 | 51 | False 52 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 53 | 54 | 55 | False 56 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 57 | 58 | 59 | False 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /Shared/CommandBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using Microsoft.VisualStudio.CommandBars; 6 | using Microsoft.VisualStudio.Shell; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using stdole; 9 | using System.Windows.Forms; 10 | using System.Drawing; 11 | 12 | namespace Aurora 13 | { 14 | 15 | public abstract class CommandBase 16 | { 17 | private readonly Plugin mPlugin; 18 | private readonly string mName; 19 | private readonly string mCanonicalName; 20 | private readonly string mTooltip; 21 | 22 | public Plugin Plugin { get { return mPlugin; } } 23 | public string Name { get { return mName; } } 24 | public string CanonicalName { get { return mCanonicalName; } } 25 | public string AbsName { get { return mPlugin.Prefix + "." + mCanonicalName; } } 26 | public string Tooltip { get { return mTooltip; } } 27 | public virtual int IconIndex { get { return 0; } } 28 | 29 | public CommandBase(string name, string canonicalName, Plugin plugin, string tooltip) 30 | { 31 | mName = name; 32 | mCanonicalName = canonicalName; 33 | mPlugin = plugin; 34 | mTooltip = tooltip; 35 | } 36 | 37 | public virtual bool RegisterGUI(OleMenuCommand vsCommand, CommandBar vsCommandbar, bool toolBarOnly) 38 | { 39 | // The default command is registered in the toolbar. 40 | if (IconIndex >= 0 && toolBarOnly) 41 | { 42 | _RegisterGUIBar(vsCommand, vsCommandbar); 43 | } 44 | 45 | return true; 46 | } 47 | 48 | public virtual void BindToKeyboard(Command vsCommand) 49 | { 50 | } 51 | 52 | protected void AssignIcon(CommandBarButton target) 53 | { 54 | target.Picture = ImageConverter.LoadPictureFromImage(Plugin.Icons.Images[(int)IconIndex]); 55 | } 56 | 57 | public abstract bool OnCommand(); // returns if the command was dispatched or not. 58 | public abstract bool IsEnabled(); // is the command active? 59 | 60 | protected void _RegisterGUIBar(OleMenuCommand vsCommand, CommandBar vsCommandbar) 61 | { 62 | CommandBarButton bn = null; 63 | try 64 | { 65 | CommandBarControl existingButton = vsCommandbar.Controls[CanonicalName]; 66 | bn = existingButton as CommandBarButton; 67 | } catch (Exception) { 68 | } 69 | 70 | if (bn == null) 71 | { 72 | object newButton; 73 | int res = Plugin.ProfferCommands.AddCommandBarControl(CanonicalName, vsCommandbar, (uint)vsCommandbar.Controls.Count, (uint)vsCommandBarType.vsCommandBarTypeToolbar, out newButton); 74 | if (res != 0) 75 | { 76 | // something went wrong 77 | } 78 | bn = newButton as CommandBarButton; 79 | } 80 | if (bn != null) 81 | { 82 | AssignIcon(bn); 83 | } 84 | } 85 | 86 | protected void _RegisterGuiContext(OleMenuCommand vsCommand, string name) 87 | { 88 | CommandBar b = ((CommandBars)Plugin.App.CommandBars)[name]; 89 | if(null != b) 90 | { 91 | _RegisterGUIBar(vsCommand, b); 92 | } 93 | } 94 | } 95 | 96 | /// 97 | /// Gives access to the otherwise protected GetIPictureDispFromPicture() 98 | /// 99 | class ImageConverter : AxHost 100 | { 101 | private ImageConverter() : base("63109182-966B-4e3c-A8B2-8BC4A88D221C") 102 | { 103 | } 104 | 105 | public static StdPicture LoadPictureFromImage(Image i) 106 | { 107 | return (StdPicture)GetIPictureDispFromPicture(i); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Shared/CommandRegistry.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using System.Collections.Generic; 6 | using Microsoft.VisualStudio.CommandBars; 7 | using System.ComponentModel.Design; 8 | using Microsoft.VisualStudio.Shell; 9 | 10 | namespace Aurora 11 | { 12 | // Holds a dictionary between local command names and the instance that holds 13 | // the logic to execute and update the command itself. 14 | public class CommandRegistry 15 | { 16 | private Dictionary mCommands; 17 | private Dictionary mCommandsById; 18 | private Plugin mPlugin; 19 | private CommandBar mCommandBar; 20 | private Guid mPackageGuid; 21 | private Guid mCmdGroupGuid; 22 | 23 | public CommandRegistry(Plugin plugin, CommandBar commandBar, Guid packageGuid, Guid cmdGroupGuid) 24 | { 25 | mCommands = new Dictionary(); 26 | mCommandsById = new Dictionary(); 27 | mPlugin = plugin; 28 | mCommandBar = commandBar; 29 | mPackageGuid = packageGuid; 30 | mCmdGroupGuid = cmdGroupGuid; 31 | } 32 | 33 | public void RegisterCommand(bool doBindings, CommandBase commandHandler) 34 | { 35 | RegisterCommand(doBindings, commandHandler, true); 36 | } 37 | 38 | public void RegisterCommand(bool doBindings, CommandBase commandHandler, bool onlyToolbar) 39 | { 40 | OleMenuCommand command = RegisterCommandPrivate(commandHandler, onlyToolbar); 41 | 42 | if(command != null && doBindings) 43 | { 44 | try 45 | { 46 | Command cmd = mPlugin.Commands.Item(commandHandler.CanonicalName, -1); 47 | commandHandler.BindToKeyboard(cmd); 48 | } 49 | catch(ArgumentException e) 50 | { 51 | Log.Error("Failed to register keybindings for {0}: {1}", commandHandler.CanonicalName, e.ToString()); 52 | } 53 | } 54 | 55 | mCommands.Add(commandHandler.CanonicalName, commandHandler); 56 | } 57 | 58 | private OleMenuCommand RegisterCommandPrivate(CommandBase commandHandler, bool toolbarOnly) 59 | { 60 | OleMenuCommand vscommand = null; 61 | uint cmdId = 0; 62 | try 63 | { 64 | Command existingCmd = mPlugin.Commands.Item(commandHandler.CanonicalName, -1); 65 | cmdId = (uint)existingCmd.ID; 66 | } 67 | catch(System.ArgumentException) 68 | { 69 | } 70 | 71 | if (cmdId == 0) 72 | { 73 | Log.Info("Registering the command {0} from scratch", commandHandler.Name); 74 | int result = mPlugin.ProfferCommands.AddNamedCommand(mPackageGuid, mCmdGroupGuid, commandHandler.CanonicalName, out cmdId, commandHandler.CanonicalName, commandHandler.CanonicalName, commandHandler.Tooltip, null, 0, (uint)commandHandler.IconIndex, 0, 0, null); 75 | } 76 | 77 | if (cmdId != 0) 78 | { 79 | OleMenuCommandService menuCommandService = mPlugin.MenuCommandService; 80 | CommandID commandID = new CommandID(mCmdGroupGuid, (int)cmdId); 81 | 82 | vscommand = new OleMenuCommand(OleMenuCommandCallback, commandID); 83 | vscommand.BeforeQueryStatus += this.OleMenuCommandBeforeQueryStatus; 84 | menuCommandService.AddCommand(vscommand); 85 | mCommandsById[cmdId] = commandHandler; 86 | } 87 | // Register the graphics controls for this command as well. 88 | // First let the command itself have a stab at register whatever it needs. 89 | // Then by default we always register ourselves in the main toolbar of the application. 90 | if(!commandHandler.RegisterGUI(vscommand, mCommandBar, toolbarOnly)) 91 | { 92 | } 93 | 94 | return vscommand; 95 | } 96 | 97 | private void OleMenuCommandBeforeQueryStatus(object sender, EventArgs e) 98 | { 99 | 100 | try 101 | { 102 | OleMenuCommand oleMenuCommand = sender as OleMenuCommand; 103 | 104 | if (oleMenuCommand != null) 105 | { 106 | CommandID commandId = oleMenuCommand.CommandID; 107 | 108 | if (commandId != null) 109 | { 110 | if(mCommandsById.ContainsKey((uint)commandId.ID)) 111 | { 112 | oleMenuCommand.Supported = true; 113 | oleMenuCommand.Enabled = mCommandsById[(uint)commandId.ID].IsEnabled(); 114 | oleMenuCommand.Visible = true; 115 | } 116 | } 117 | } 118 | } 119 | catch (Exception ex) 120 | { 121 | System.Diagnostics.Debug.WriteLine(ex.ToString()); 122 | } 123 | } 124 | 125 | private void OleMenuCommandCallback(object sender, EventArgs e) 126 | { 127 | try 128 | { 129 | OleMenuCommand oleMenuCommand = sender as OleMenuCommand; 130 | 131 | if (oleMenuCommand != null) 132 | { 133 | CommandID commandId = oleMenuCommand.CommandID; 134 | if (commandId != null) 135 | { 136 | Log.Debug("Trying to execute command id \"{0}\"", commandId.ID); 137 | 138 | if(mCommandsById.ContainsKey((uint)commandId.ID)) 139 | { 140 | bool dispatched = mCommandsById[(uint)commandId.ID].OnCommand(); 141 | if (dispatched) 142 | { 143 | Log.Debug("{0} was dispatched", commandId.ID); 144 | } 145 | } 146 | } 147 | } 148 | } 149 | catch (Exception ex) 150 | { 151 | System.Diagnostics.Debug.WriteLine(ex.ToString()); 152 | } 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /Shared/DebugLogHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Diagnostics; 6 | 7 | namespace Aurora 8 | { 9 | public class DebugLogHandler : Log.Handler 10 | { 11 | public void OnMessage(Log.Level level, string message, string formattedLine) 12 | { 13 | Debug.Write(formattedLine); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Shared/Feature.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using EnvDTE; 5 | using EnvDTE80; 6 | 7 | namespace Aurora 8 | { 9 | public abstract class Feature 10 | { 11 | private string mName; 12 | private string mTooltip; 13 | 14 | public string Name { get { return mName; } } 15 | 16 | public Feature(string name, string tooltip) 17 | { 18 | mName = name; 19 | mTooltip = tooltip; 20 | } 21 | 22 | public virtual bool Execute() 23 | { 24 | return true; 25 | } 26 | }; 27 | 28 | public abstract class PreCommandFeature : Feature 29 | { 30 | private List mEvents = new List(); 31 | protected Plugin mPlugin; 32 | 33 | public PreCommandFeature(Plugin plugin, string name, string tooltip) 34 | : base(name, tooltip) 35 | { 36 | mPlugin = plugin; 37 | } 38 | 39 | protected void RegisterHandler(string commandName, _dispCommandEvents_BeforeExecuteEventHandler handler) 40 | { 41 | CommandEvents events = mPlugin.FindCommandEvents(commandName); 42 | if(null == events) 43 | return; 44 | events.BeforeExecute += handler; 45 | mEvents.Add(events); 46 | } 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /Shared/File.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml.Serialization; 4 | using System.Collections.Generic; 5 | 6 | namespace Aurora 7 | { 8 | public static class File 9 | { 10 | public static Type LoadXML(string pathname) where Type : class 11 | { 12 | using(StreamReader reader = new StreamReader(pathname)) 13 | { 14 | XmlSerializer serializer = new XmlSerializer(typeof(Type)); 15 | return (Type)serializer.Deserialize(reader); 16 | } 17 | } 18 | 19 | public static void SaveXML(string pathname, Type obj) where Type : class 20 | { 21 | using(StreamWriter writer = new StreamWriter(pathname)) 22 | { 23 | XmlSerializer serializer = new XmlSerializer(typeof(Type)); 24 | serializer.Serialize(writer, obj); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Shared/Help.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Aurora 5 | { 6 | public static class Help 7 | { 8 | public static string FindFileInPath(string filename) 9 | { 10 | string pathenv = Environment.GetEnvironmentVariable("PATH"); 11 | string[] items = pathenv.Split(';'); 12 | 13 | foreach(string item in items) 14 | { 15 | string candidate = Path.Combine(item, filename); 16 | if(System.IO.File.Exists(candidate)) 17 | return candidate; 18 | } 19 | 20 | return null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Shared/Log.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Aurora 7 | { 8 | public static class Log 9 | { 10 | // Internal enumeration. Only used in handlers to identify the type of message 11 | public enum Level 12 | { 13 | Debug, 14 | Info, 15 | Warn, 16 | Error, 17 | } 18 | 19 | // This needs to be implemented by all clients. 20 | public interface Handler 21 | { 22 | void OnMessage(Level level, string message, string formattedLine); 23 | } 24 | 25 | // Helper class to keep the indent levels balanced (with the help of the using statement) 26 | 27 | 28 | // Log class implement below 29 | public static string Prefix 30 | { 31 | get { return mPrefix; } 32 | set { mPrefix = value; } 33 | } 34 | 35 | public static int HandlerCount 36 | { 37 | get { return mHandlers.Count; } 38 | } 39 | 40 | static Log() 41 | { 42 | mHandlers = new List(); 43 | mPrefix = ""; 44 | mIndent = 0; 45 | } 46 | 47 | public static void AddHandler(Handler handler) 48 | { 49 | if(null == handler) 50 | return; 51 | 52 | lock(mHandlers) 53 | { 54 | mHandlers.Add(handler); 55 | } 56 | } 57 | 58 | public static void RemoveHandler(Handler handler) 59 | { 60 | lock(mHandlers) 61 | { 62 | mHandlers.Remove(handler); 63 | } 64 | } 65 | 66 | public static void ClearHandlers() 67 | { 68 | lock(mHandlers) 69 | { 70 | mHandlers.Clear(); 71 | } 72 | } 73 | 74 | public static void IncIndent() 75 | { 76 | mIndent++; 77 | } 78 | 79 | public static void DecIndent() 80 | { 81 | mIndent--; 82 | } 83 | 84 | public static void Debug(string message, params object[] args) 85 | { 86 | #if DEBUG 87 | OnMessage(Level.Debug, message, args); 88 | #endif 89 | } 90 | 91 | public static void Info(string message, params object[] args) 92 | { 93 | OnMessage(Level.Info, message, args); 94 | } 95 | 96 | public static void Warning(string message, params object[] args) 97 | { 98 | OnMessage(Level.Warn, message, args); 99 | } 100 | 101 | public static void Error(string message, params object[] args) 102 | { 103 | OnMessage(Level.Error, message, args); 104 | } 105 | 106 | private static void OnMessage(Level level, string format, object[] args) 107 | { 108 | string message = string.Format(format, args); 109 | string formattedLine; 110 | string indent = ""; 111 | string levelName = level.ToString().PadLeft(5, ' '); 112 | 113 | for(int i = 0; i < mIndent; i++) 114 | { 115 | indent += " "; 116 | } 117 | 118 | if(mPrefix.Length > 0) 119 | { 120 | formattedLine = mPrefix + " (" + levelName + "): " + indent + message + "\n"; 121 | } 122 | else 123 | { 124 | formattedLine = levelName + ": " + indent + message + "\n"; 125 | } 126 | 127 | lock(mHandlers) 128 | { 129 | foreach(Handler handler in mHandlers) 130 | { 131 | handler.OnMessage(level, message, formattedLine); 132 | } 133 | } 134 | } 135 | 136 | private static List mHandlers; 137 | private static string mPrefix; 138 | private static int mIndent; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Shared/Process.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using System.Threading; 4 | 5 | namespace Aurora 6 | { 7 | public static class Process 8 | { 9 | public class Error : System.Exception 10 | { 11 | public string info; 12 | public Error(string info_, params object[] vaargs_) { info = string.Format(info_, vaargs_); } 13 | }; 14 | 15 | // Helper class to capture output correctly and send an event once we've reached the end of the file. 16 | public class Handler : IDisposable 17 | { 18 | public string buffer; 19 | public ManualResetEvent sentinel; 20 | 21 | public Handler() 22 | { 23 | buffer = ""; 24 | sentinel = new ManualResetEvent(false); 25 | } 26 | 27 | public void Dispose() 28 | { 29 | sentinel.Close(); 30 | } 31 | 32 | public void OnOutput(object sender, System.Diagnostics.DataReceivedEventArgs e) 33 | { 34 | if( e.Data == null ) 35 | { 36 | sentinel.Set(); 37 | } 38 | else 39 | { 40 | buffer = buffer + e.Data + "\n"; 41 | } 42 | } 43 | }; 44 | 45 | public static string Execute(string executable, string workingdir, string arguments, params object[] vaargs) 46 | { 47 | using( System.Diagnostics.Process process = new System.Diagnostics.Process() ) 48 | { 49 | process.StartInfo.UseShellExecute = false; 50 | process.StartInfo.FileName = executable; 51 | process.StartInfo.RedirectStandardOutput = true; 52 | process.StartInfo.RedirectStandardError = true; 53 | process.StartInfo.CreateNoWindow = true; 54 | process.StartInfo.WorkingDirectory = workingdir; 55 | process.StartInfo.Arguments = string.Format(arguments, vaargs); 56 | 57 | if(!process.Start()) 58 | { 59 | throw new Error("{0}: Failed to start {1}.", executable, process.StartInfo.Arguments); 60 | } 61 | 62 | using( Handler stderr = new Handler(), stdout = new Handler() ) 63 | { 64 | process.OutputDataReceived += stdout.OnOutput; 65 | process.BeginOutputReadLine(); 66 | 67 | process.ErrorDataReceived += stderr.OnOutput; 68 | process.BeginErrorReadLine(); 69 | 70 | process.WaitForExit(); 71 | 72 | if(0 != process.ExitCode) 73 | { 74 | throw new Error("Failed to execute {0} {1}, exit code was {2}", executable, process.StartInfo.Arguments, process.ExitCode); 75 | } 76 | 77 | stderr.sentinel.WaitOne(); 78 | stdout.sentinel.WaitOne(); 79 | 80 | return stdout.buffer + "\n" + stderr.buffer; 81 | } 82 | } 83 | } 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /Shared/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AuroraCore")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Aurora")] 12 | [assembly: AssemblyProduct("AuroraCore")] 13 | [assembly: AssemblyCopyright("Copyright © Aurora 2008")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1dfba225-a7ce-4366-9f9a-cf6a40f73a31")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Shared/Singleton.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | 4 | namespace Aurora 5 | { 6 | public sealed class Singleton where T : class, new() 7 | { 8 | private Singleton() {} 9 | public static T Instance = new T(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Shared/VisualStudioLogHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details. 2 | using System; 3 | using EnvDTE; 4 | using EnvDTE80; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Aurora 9 | { 10 | public class VisualStudioLogHandler : Log.Handler 11 | { 12 | private Plugin mPlugin; 13 | 14 | public VisualStudioLogHandler(Plugin plugin) 15 | { 16 | mPlugin = plugin; 17 | } 18 | 19 | public void OnMessage(Log.Level level, string message, string formattedLine) 20 | { 21 | OutputWindowPane pane = mPlugin.OutputPane; 22 | if (null == pane) 23 | return; 24 | 25 | pane.OutputString(formattedLine); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bin/NiftyReset.vbs: -------------------------------------------------------------------------------- 1 | ' Some references: 2 | ' http://www.herongyang.com/VBScript/ 3 | ' http://www.edgewordstraining.co.uk/downloads/howto.pdf 4 | ' 5 | 6 | ' 7 | ' Given a visual studio version and a full path to a plugin (C# class name) we can unregister the plugin properly. 8 | ' 9 | Sub ResetPlugin(ByVal vsVersion, ByVal pluginName) 10 | 11 | Set shell = CreateObject("WScript.Shell") 12 | 13 | On Error Resume Next 14 | vsKey = "HKLM\SOFTWARE\Microsoft\VisualStudio\" & vsVersion & "\InstallDir" 15 | 'Wscript.echo("VSKEY=" & vsKey) 16 | installDir8 = shell.RegRead(vsKey) 17 | On Error Goto 0 18 | 19 | 'Wscript.echo("INSTALLDIR=" & installDir8) 20 | If installDir8 <> "" Then 21 | commandline = Chr(34) & installDir8 & "devenv.exe" & Chr(34) & " /ResetAddIn " & pluginName & " /command File.Exit" 22 | 'Wscript.echo("CMD=" & commandline) 23 | shell.Run commandline, 2, true 24 | End If 25 | Set shell = Nothing 26 | End Sub 27 | 28 | Call ResetPlugin("8.0", "Aurora.NiftyPerforce.Connect") 29 | Call ResetPlugin("9.0", "Aurora.NiftyPerforce.Connect") 30 | Call ResetPlugin("10.0", "Aurora.NiftyPerforce.Connect") 31 | Call ResetPlugin("8.0", "Aurora.NiftySolution.Connect") 32 | Call ResetPlugin("9.0", "Aurora.NiftySolution.Connect") 33 | Call ResetPlugin("10.0", "Aurora.NiftySolution.Connect") 34 | -------------------------------------------------------------------------------- /bin/build.py: -------------------------------------------------------------------------------- 1 | # 2 | # Creates 2010 archive for NiftyPlugins. 3 | # 4 | import zipfile 5 | import os 6 | import sys 7 | import logging 8 | import re 9 | import shutil 10 | 11 | QUIET = 0 12 | DEVENV = '' 13 | 14 | if 'VS140COMNTOOLS' in os.environ.keys(): 15 | DEVENV = os.path.abspath(os.path.join(os.environ['VS140COMNTOOLS'], '..', 'IDE', 'devenv.com')) 16 | else: 17 | print "No visual studio found!" 18 | sys.exit(1) 19 | 20 | SETUP_PROJECTS = [ 21 | r'NiftyPerforce\source.extension.vsixmanifest', 22 | r'NiftySolution\source.extension.vsixmanifest', 23 | ] 24 | 25 | ASSEMBLY_INFOS = [ 26 | r'NiftySolution\AssemblyInfo.cs', 27 | r'NiftyPerforce\AssemblyInfo.cs', 28 | ] 29 | 30 | EXPERIMENTAL_FILES = [ 31 | (r'NiftyPerforce\bin\Release\NiftyPerforce.vsix', 'NiftyPerforce'), 32 | (r'NiftySolution\bin\Release\NiftySolution.vsix', 'NiftySolution'), 33 | ] 34 | 35 | BASE=os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) 36 | DISTDIR=os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'Build')) 37 | SOLUTION='NiftyPlugins.sln' 38 | 39 | TARGET_DIR = os.path.abspath( os.path.join(os.path.dirname( __file__ ), '..', 'Build') ) 40 | 41 | def execute(commandline, silent = 1): 42 | """ 43 | Executes a command line and if the command fails, exits. 44 | """ 45 | if QUIET: 46 | silent = 1 47 | 48 | logfile = os.path.abspath(os.path.join(os.environ['TEMP'], 'capture_tmp.txt')) 49 | batchfile = os.path.abspath(os.path.join(os.environ['TEMP'], 'capture_tmp.cmd')) 50 | 51 | try: 52 | os.unlink(logfile) 53 | except WindowsError: 54 | pass 55 | 56 | if silent: 57 | open(batchfile, 'wt').write( 58 | '@echo off\n\n%s > "%s" 2>&1' % (commandline, logfile) 59 | ) 60 | else: 61 | open(batchfile, 'wt').write( 62 | '%s' % (commandline) 63 | ) 64 | 65 | result = os.system(batchfile) 66 | # We failed. Damn. 67 | if 0 != result: 68 | lines = open(logfile).readlines() 69 | filtered = [] 70 | pattern = re.compile('error ([^:]+):', re.I) 71 | for line in lines: 72 | if pattern.search(line): 73 | filtered.append(line) 74 | 75 | if silent: 76 | print '>>> The output from the program was: ' 77 | print ''.join(filtered) 78 | print '>>> execution stopped due to error (truncated output above)' 79 | else: 80 | print '>>> execution stopped due to error' 81 | sys.exit(result) 82 | 83 | def cleanSolution(solutionfile, config): 84 | devenv = DEVENV 85 | execute( '"%(devenv)s" "%(solutionfile)s" /clean "%(config)s"' % locals() ) 86 | 87 | 88 | def buildSolution(solutionfile, config): 89 | devenv = DEVENV 90 | execute( '"%(devenv)s" "%(solutionfile)s" /build "%(config)s"' % locals(), 0 ) 91 | 92 | 93 | def msbuild(solution, config, command): 94 | MSBUILD=r'%s\Microsoft.NET\Framework64\v4.0.30319\MsBuild.exe' % os.environ['windir'] 95 | cmdline = '%(MSBUILD)s /nologo /verbosity:minimal "%(solution)s" /t:%(command)s /p:Configuration="%(config)s"' % locals() 96 | res = os.system(cmdline) 97 | if 0 != res: 98 | print 'Failed to execute %s' % cmdline 99 | print 'Result: %s' % res 100 | sys.exit(res) 101 | 102 | def generateUUID(name): 103 | text = name 104 | import md5 105 | hexdigest = md5.new( text ).hexdigest() 106 | # HexDigest is 32 hex characters long, the UUID is 8-4-4-4-12 characters long == 32. 107 | result = '%s-%s-%s-%s-%s' % (hexdigest[0:8], hexdigest[8:12], hexdigest[12:16], hexdigest[16:20], hexdigest[20:32]) 108 | return result.upper() 109 | 110 | def replaceText(filename, pattern, versionstring): 111 | #print "Opening %s" % filename 112 | data = open(filename, 'rt').read() 113 | 114 | p = re.compile(pattern, re.I) 115 | 116 | result = '' 117 | prev = 0 118 | for m in p.finditer(data): 119 | #print "Found hit: %s" % m.group(0) 120 | start = m.start(1) 121 | end = m.end(1) 122 | groupend = m.end(0) 123 | result = result + data[prev:start] + versionstring + data[end:groupend] 124 | 125 | prev = groupend 126 | 127 | result = result + data[prev:] 128 | open(filename,'wt').write(result) 129 | 130 | def updateVersion(versionstring): 131 | for csproj in SETUP_PROJECTS: 132 | replaceText(csproj, r' %s" % (oldname, newname) 148 | 149 | def main(args): 150 | """ 151 | Usage: build.py 152 | """ 153 | 154 | if len(args) != 1: 155 | print main.__doc__ 156 | return 1 157 | 158 | versionstring = args[0] 159 | 160 | print "Updating versions to \"%s\"..." % versionstring 161 | updateVersion(versionstring) 162 | 163 | print "Cleaning solution..." 164 | cleanSolution(os.path.join(BASE, SOLUTION), 'Release') 165 | 166 | print "Building installers..." 167 | buildSolution(os.path.join(BASE, SOLUTION), 'Release') 168 | 169 | print "Publishing the installers..." 170 | moveOutputIntoPlace(versionstring) 171 | 172 | if __name__ == '__main__': 173 | sys.exit( main(sys.argv[1:]) ) 174 | -------------------------------------------------------------------------------- /bin/msbuildfix.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtilander/niftyplugins/7e2178c3098705f4f86f775786fd4be3f256a67c/bin/msbuildfix.reg -------------------------------------------------------------------------------- /makedist.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | set VERSION=%1 5 | 6 | if "%1" == "" ( 7 | echo Usage: makedist.cmd ^ 8 | goto :EOF 9 | ) 10 | 11 | rem http://stackoverflow.com/questions/8648428/an-error-occurred-while-validating-hresult-8000000a 12 | regedit /s bin\msbuildfix.reg 13 | 14 | 15 | python bin\build.py %VERSION% 16 | 17 | endlocal 18 | --------------------------------------------------------------------------------