Browse Source

change formatting settings to be consistent with the rest of ILSpy

pull/512/head
Siegfried Pammer 11 years ago
parent
commit
4725c17185
  1. 8
      .editorconfig
  2. 9
      ILSpy.AddIn/ILSpyAddInPackage.cs
  3. 37
      ILSpy.AddIn/Utils.cs

8
.editorconfig

@ -5,11 +5,6 @@ root = true @@ -5,11 +5,6 @@ root = true
indent_style = tab
indent_size = 4
# The indentation (and source formatting!) of the addin sources are different than the rest of the solution.
[ILSpy.AddIn/*]
indent_style = space
indent_size = 4
[*.il]
indent_style = space
indent_size = 2
@ -23,3 +18,6 @@ indent_size = 2 @@ -23,3 +18,6 @@ indent_size = 2
[*.vsixmanifest]
indent_style = space
indent_size = 2
[*.vsct]
indent_style = space
indent_size = 2

9
ILSpy.AddIn/ILSpyAddInPackage.cs

@ -64,8 +64,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -64,8 +64,7 @@ namespace ICSharpCode.ILSpy.AddIn
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
if (null != mcs) {
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenInILSpy);
MenuCommand menuItem = new MenuCommand(OpenInILSpyCallback, menuCommandID);
@ -89,8 +88,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -89,8 +88,7 @@ namespace ICSharpCode.ILSpy.AddIn
var explorer = ((EnvDTE80.DTE2)GetGlobalService(typeof(EnvDTE.DTE))).ToolWindows.SolutionExplorer;
var items = explorer.SelectedItems as EnvDTE.UIHierarchyItem[];
foreach (var item in items)
{
foreach (var item in items) {
dynamic obj = item.Object;
OpenAssemblyInILSpy(obj.Path);
}
@ -110,8 +108,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -110,8 +108,7 @@ namespace ICSharpCode.ILSpy.AddIn
private void OpenAssemblyInILSpy(string assemblyFileName)
{
if (!File.Exists(assemblyFileName))
{
if (!File.Exists(assemblyFileName)) {
ShowMessage("Could not find assembly '{0}', please ensure the project and all references were built correctly!", assemblyFileName);
return;
}

37
ILSpy.AddIn/Utils.cs

@ -36,17 +36,13 @@ namespace ICSharpCode.ILSpy.AddIn @@ -36,17 +36,13 @@ namespace ICSharpCode.ILSpy.AddIn
char** arr = CommandLineToArgvW(commandLine, out numberOfArgs);
if (arr == null)
throw new Win32Exception();
try
{
try {
string[] result = new string[numberOfArgs];
for (int i = 0; i < numberOfArgs; i++)
{
for (int i = 0; i < numberOfArgs; i++) {
result[i] = new string(arr[i]);
}
return result;
}
finally
{
} finally {
// Free memory obtained by CommandLineToArgW.
LocalFree(new IntPtr(arr));
}
@ -68,8 +64,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -68,8 +64,7 @@ namespace ICSharpCode.ILSpy.AddIn
if (arguments == null)
return null;
StringBuilder b = new StringBuilder();
for (int i = 0; i < arguments.Length; i++)
{
for (int i = 0; i < arguments.Length; i++) {
if (i > 0)
b.Append(' ');
AppendArgument(b, arguments[i]);
@ -79,33 +74,23 @@ namespace ICSharpCode.ILSpy.AddIn @@ -79,33 +74,23 @@ namespace ICSharpCode.ILSpy.AddIn
static void AppendArgument(StringBuilder b, string arg)
{
if (arg.Length > 0 && arg.IndexOfAny(charsNeedingQuoting) < 0)
{
if (arg.Length > 0 && arg.IndexOfAny(charsNeedingQuoting) < 0) {
b.Append(arg);
}
else
{
} else {
b.Append('"');
for (int j = 0; ; j++)
{
for (int j = 0; ; j++) {
int backslashCount = 0;
while (j < arg.Length && arg[j] == '\\')
{
while (j < arg.Length && arg[j] == '\\') {
backslashCount++;
j++;
}
if (j == arg.Length)
{
if (j == arg.Length) {
b.Append('\\', backslashCount * 2);
break;
}
else if (arg[j] == '"')
{
} else if (arg[j] == '"') {
b.Append('\\', backslashCount * 2 + 1);
b.Append('"');
}
else
{
} else {
b.Append('\\', backslashCount);
b.Append(arg[j]);
}

Loading…
Cancel
Save