Skip to content

Commit

Permalink
Add all files
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Apr 25, 2016
0 parents commit ba84816
Show file tree
Hide file tree
Showing 2,103 changed files with 288,120 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto
*.cs text diff=csharp
*.sln text eol=crlf
*.csproj text eol=crlf
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vs/
bin/
obj/
*.suo
*.user
_ReSharper*/
*.ReSharper
*.patch
/packages
*.ide/
*.tmp_proj
project.lock.json
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "Libraries/dnlib"]
path = Libraries/dnlib
url = https://github.com/0xd4d/dnlib.git
[submodule "Plugins/ILSpy.Decompiler/NRefactory"]
path = Plugins/ILSpy.Decompiler/NRefactory
url = https://github.com/0xd4d/nrefactory.git
[submodule "Libraries/ICSharpCode.AvalonEdit"]
path = Libraries/ICSharpCode.AvalonEdit
url = https://github.com/0xd4d/avalonedit.git
[submodule "Libraries/ICSharpCode.TreeView"]
path = Libraries/ICSharpCode.TreeView
url = [email protected]:0xd4d/icsharpcode.treeview.git
[submodule "Plugins/ILSpy.Decompiler/ICSharpCode.Decompiler"]
path = Plugins/ILSpy.Decompiler/ICSharpCode.Decompiler
url = [email protected]:0xd4d/icsharpcode.decompiler.git
1 change: 1 addition & 0 deletions Libraries/ICSharpCode.AvalonEdit
Submodule ICSharpCode.AvalonEdit added at f5647d
1 change: 1 addition & 0 deletions Libraries/ICSharpCode.TreeView
Submodule ICSharpCode.TreeView added at d1e06e
1 change: 1 addition & 0 deletions Libraries/dnlib
Submodule dnlib added at f77429
31 changes: 31 additions & 0 deletions Licenses/CREDITS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
dnSpy credits:

0xd4d
Ki


ILSpy decompiler and analyzer credits:

Daniel Grunwald
David Srbecky
Ed Harvey
Siegfried Pammer
Artur Zgodzinski
Eusebiu Marcu
Pent Ploompuu
Ki
0xd4d


Translators:

Chinese Simplified
Ulysses Wu
YanJun Sun
iFish
SquallATF
linkinshi

Russian
Igor
Konctantin
674 changes: 674 additions & 0 deletions Licenses/GPLv3.txt

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Licenses/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dnSpy is released under the GPLv3 license, see GPLv3.txt for more information.

Copyright (C) 2014-2016 [email protected]

This file is part of dnSpy

dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with dnSpy. If not, see <http://www.gnu.org/licenses/>.
73 changes: 73 additions & 0 deletions Licenses/OtherLicenses.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Original licenses of code or other libraries used by dnSpy. Some or all of them have been modified and are now released under the GPLv3 license, like dnSpy. The following license info is the original licenses.

***********************************************************************************
dnlib:

Copyright (C) 2012-2016 [email protected]

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:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

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.

***********************************************************************************
BAML Decompiler:

Copyright (c) 2015 Ki

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:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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.

***********************************************************************************
Analyzer:
AvalonEdit:
ICSharpCode.Decompiler:
ICSharpCode.NRefactory:
ICSharpCode.TreeView:

Copyright (c) 2011-2014 AlphaSierraPapa for the SharpDevelop team

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:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

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.
168 changes: 168 additions & 0 deletions Plugins/Examples/Example1.Plugin/CodeCtxMenus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
using System;
using System.ComponentModel.Composition;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Input;
using dnlib.DotNet;
using dnSpy.Contracts.Controls;
using dnSpy.Contracts.Files.Tabs.TextEditor;
using dnSpy.Contracts.Menus;
using dnSpy.Contracts.Plugin;
using dnSpy.Shared.Menus;

// Adds menu items to the text editor context menu
// If you have many similar commands, it's better to create a base class and derive from
// MenuItemBase<TContext> instead of MenuItemBase, see TreeViewCtxMenus.cs for an example.

namespace Example1.Plugin {
static class Constants {
//TODO: Use your own guids
// The first number is the order of the group, and the guid is the guid of the group,
// see eg. dnSpy.Contracts.Menus.MenuConstants.GROUP_CTX_CODE_HEX etc
public const string GROUP_TEXTEDITOR = "20000,3567EC95-E68E-44CE-932C-98A686FDCACF";
public const string GROUP_TREEVIEW = "20000,77ACC18E-D8EB-483B-8D93-3581574B8891";
}

// This gets loaded by dnSpy and is used to add the Ctrl+Alt+Q command
[ExportAutoLoaded]
sealed class CommandLoader : IAutoLoaded {
static readonly RoutedCommand Option1Command = new RoutedCommand("Option1Command", typeof(CommandLoader));

[ImportingConstructor]
CommandLoader(IWpfCommandManager wpfCommandManager, MySettings mySettings) {
var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_TEXTEDITOR_UICONTEXT);
// This command will be added to all text editors
cmds.Add(Option1Command,
(s, e) => mySettings.BoolOption1 = !mySettings.BoolOption1,
(s, e) => e.CanExecute = true,
ModifierKeys.Control | ModifierKeys.Alt, Key.Q);
}
}

[ExportMenuItem(Header = "Option 1", InputGestureText = "Ctrl+Alt+Q", Group = Constants.GROUP_TEXTEDITOR, Order = 0)]
sealed class TextEditorCommand1 : MenuItemBase {
readonly MySettings mySettings;

[ImportingConstructor]
TextEditorCommand1(MySettings mySettings) {
this.mySettings = mySettings;
}

public override bool IsChecked(IMenuItemContext context) {
return mySettings.BoolOption1;
}

public override void Execute(IMenuItemContext context) {
// Toggle value
mySettings.BoolOption1 = !mySettings.BoolOption1;
}

public override bool IsVisible(IMenuItemContext context) {
// Only show this in the text editor
return context.CreatorObject.Guid == new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID);
}
}

[ExportMenuItem(Header = "Option 2", Group = Constants.GROUP_TEXTEDITOR, Order = 10)]
sealed class TextEditorCommand2 : MenuItemBase {
readonly MySettings mySettings;

[ImportingConstructor]
TextEditorCommand2(MySettings mySettings) {
this.mySettings = mySettings;
}

public override bool IsChecked(IMenuItemContext context) {
return mySettings.BoolOption2;
}

public override void Execute(IMenuItemContext context) {
// Toggle value
mySettings.BoolOption2 = !mySettings.BoolOption2;
}

public override bool IsVisible(IMenuItemContext context) {
// Only show this in the text editor
return context.CreatorObject.Guid == new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID);
}
}

[ExportMenuItem(Group = Constants.GROUP_TEXTEDITOR, Order = 20)]
sealed class TextEditorCommand3 : MenuItemBase {
public override void Execute(IMenuItemContext context) {
var md = GetTokenObj(context);
if (md != null) {
try {
Clipboard.SetText(string.Format("{0:X8}", md.MDToken.Raw));
}
catch (ExternalException) { }
}
}

public override string GetHeader(IMenuItemContext context) {
var md = GetTokenObj(context);
if (md == null)
return "Copy token";
return string.Format("Copy token {0:X8}", md.MDToken.Raw);
}

IMDTokenProvider GetTokenObj(IMenuItemContext context) {
// Only show this in the text editor
if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID))
return null;

// All references in the text editor are stored in CodeReferences
var codeRef = context.Find<CodeReference>();
if (codeRef == null)
return null;

return codeRef.Reference as IMDTokenProvider;
}

public override bool IsVisible(IMenuItemContext context) {
// Only show this in the text editor
return context.CreatorObject.Guid == new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID);
}

public override bool IsEnabled(IMenuItemContext context) {
return GetTokenObj(context) != null;
}
}

[ExportMenuItem(Group = Constants.GROUP_TEXTEDITOR, Order = 30)]
sealed class TextEditorCommand4 : MenuItemBase {
public override void Execute(IMenuItemContext context) {
var uiContext = GetUIContext(context);
if (uiContext != null) {
try {
Clipboard.SetText(string.Format("Line,col: {0},{1}", uiContext.Location.Line, uiContext.Location.Column));
}
catch (ExternalException) { }
}
}

public override string GetHeader(IMenuItemContext context) {
var uiContext = GetUIContext(context);
if (uiContext == null)
return "Copy line and column";
return string.Format("Copy line,col {0},{1}", uiContext.Location.Line, uiContext.Location.Column);
}

ITextEditorUIContext GetUIContext(IMenuItemContext context) {
// Only show this in the text editor
if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID))
return null;

return context.Find<ITextEditorUIContext>();
}

public override bool IsVisible(IMenuItemContext context) {
// Only show this in the text editor
return context.CreatorObject.Guid == new Guid(MenuConstants.GUIDOBJ_TEXTEDITORCONTROL_GUID);
}

public override bool IsEnabled(IMenuItemContext context) {
return GetUIContext(context) != null;
}
}
}
Loading

0 comments on commit ba84816

Please sign in to comment.