Browse Source

Use tabs, not spaces.

pull/672/head
Daniel Grunwald 11 years ago
parent
commit
fe3bee36ad
  1. 30
      BuildTools/tidy.py
  2. 2
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  3. 4
      ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
  4. 10
      ILSpy/OpenListDialog.xaml.cs
  5. 28
      ILSpy/Options/DisplaySettings.cs
  6. 2
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  7. 14
      ILSpy/Properties/WPFAssemblyInfo.cs
  8. 4
      ILSpy/TextView/DecompilerTextView.cs
  9. 8
      ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs
  10. 48
      ILSpy/TreeNodes/AssemblyListTreeNode.cs
  11. 4
      appveyor.yml

30
BuildTools/tidy.py

@ -0,0 +1,30 @@
import os, sys
def check(filename):
ok = True
with open(filename, 'r') as f:
for i, line in enumerate(f):
if line.startswith(' '):
print('{}:{}: Line starting with spaces. Use tabs for indentation instead!'.format(filename, i+1))
ok = False
return ok
def main():
root_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
dirs_to_check = (
os.path.join(root_dir, subdir)
for subdir in ('ICSharpCode.Decompiler', 'ILSpy', 'ILSpy.BamlDecompiler'))
ok = True
for dir in dirs_to_check:
for root, dirs, files in os.walk(dir):
if '\\obj\\' in root:
continue
for filename in files:
if filename.lower().endswith('.cs'):
if not check(os.path.join(root, filename)):
ok = False
print('Tidy check: {}'.format('successful' if ok else 'failed'))
return 0 if ok else 1
if __name__ == '__main__':
sys.exit(main())

2
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -715,7 +715,7 @@ namespace ICSharpCode.Decompiler.Ast
} }
return new StackAllocExpression { return new StackAllocExpression {
Type = AstBuilder.ConvertType(type), Type = AstBuilder.ConvertType(type),
CountExpression = arg1 CountExpression = arg1
}; };
} }
case ILCode.Mkrefany: case ILCode.Mkrefany:

4
ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs

@ -54,8 +54,8 @@ namespace ICSharpCode.Decompiler.Disassembler
output.WriteLine("// Method begins at RVA 0x{0:x4}", method.RVA); output.WriteLine("// Method begins at RVA 0x{0:x4}", method.RVA);
output.WriteLine("// Code size {0} (0x{0:x})", body.CodeSize); output.WriteLine("// Code size {0} (0x{0:x})", body.CodeSize);
output.WriteLine(".maxstack {0}", body.MaxStackSize); output.WriteLine(".maxstack {0}", body.MaxStackSize);
if (method.DeclaringType.Module.Assembly != null && method.DeclaringType.Module.Assembly.EntryPoint == method) if (method.DeclaringType.Module.Assembly != null && method.DeclaringType.Module.Assembly.EntryPoint == method)
output.WriteLine (".entrypoint"); output.WriteLine (".entrypoint");
if (method.Body.HasVariables) { if (method.Body.HasVariables) {
output.Write(".locals "); output.Write(".locals ");

10
ILSpy/OpenListDialog.xaml.cs

@ -181,11 +181,11 @@ namespace ICSharpCode.ILSpy
manager.DeleteList(listView.SelectedItem.ToString()); manager.DeleteList(listView.SelectedItem.ToString());
} }
private void listView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) private void listView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (e.ChangedButton == MouseButton.Left && listView.SelectedItem != null) if (e.ChangedButton == MouseButton.Left && listView.SelectedItem != null)
this.DialogResult = true; this.DialogResult = true;
} }
} }
} }

28
ILSpy/Options/DisplaySettings.cs

@ -96,27 +96,27 @@ namespace ICSharpCode.ILSpy.Options
} }
} }
bool enableWordWrap; bool enableWordWrap;
public bool EnableWordWrap public bool EnableWordWrap
{ {
get { return enableWordWrap; } get { return enableWordWrap; }
set set
{ {
if (enableWordWrap != value) { if (enableWordWrap != value) {
enableWordWrap = value; enableWordWrap = value;
OnPropertyChanged("EnableWordWrap"); OnPropertyChanged("EnableWordWrap");
} }
} }
} }
public void CopyValues(DisplaySettings s) public void CopyValues(DisplaySettings s)
{ {
this.SelectedFont = s.selectedFont; this.SelectedFont = s.selectedFont;
this.SelectedFontSize = s.selectedFontSize; this.SelectedFontSize = s.selectedFontSize;
this.ShowLineNumbers = s.showLineNumbers; this.ShowLineNumbers = s.showLineNumbers;
this.ShowMetadataTokens = s.showMetadataTokens; this.ShowMetadataTokens = s.showMetadataTokens;
this.EnableWordWrap = s.enableWordWrap; this.EnableWordWrap = s.enableWordWrap;
} }
} }
} }

2
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -117,7 +117,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("FontSize", s.SelectedFontSize); section.SetAttributeValue("FontSize", s.SelectedFontSize);
section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers); section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens); section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap); section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);
XElement existingElement = root.Element("DisplaySettings"); XElement existingElement = root.Element("DisplaySettings");
if (existingElement != null) if (existingElement != null)

14
ILSpy/Properties/WPFAssemblyInfo.cs

@ -7,7 +7,7 @@ using System.Windows;
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english //inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment //in your source files, set the <UICulture> to en-US. Then uncomment
@ -18,10 +18,10 @@ using System.Windows;
[assembly: ThemeInfo( [assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page, //(used if a resource is not found in the page,
// or application resource dictionaries) // or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page, //(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries) // app, or any theme specific resource dictionaries)
)] )]

4
ILSpy/TextView/DecompilerTextView.cs

@ -97,9 +97,9 @@ namespace ICSharpCode.ILSpy.TextView
textEditor.TextArea.TextView.MouseDown += TextViewMouseDown; textEditor.TextArea.TextView.MouseDown += TextViewMouseDown;
textEditor.SetBinding(Control.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") }); textEditor.SetBinding(Control.FontFamilyProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont") });
textEditor.SetBinding(Control.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") }); textEditor.SetBinding(Control.FontSizeProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize") });
textEditor.SetBinding(TextEditor.WordWrapProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("EnableWordWrap") }); textEditor.SetBinding(TextEditor.WordWrapProperty, new Binding { Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("EnableWordWrap") });
textMarkerService = new TextMarkerService(textEditor.TextArea.TextView); textMarkerService = new TextMarkerService(textEditor.TextArea.TextView);
textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService); textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService); textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
textEditor.ShowLineNumbers = true; textEditor.ShowLineNumbers = true;

8
ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs

@ -27,19 +27,19 @@ namespace ICSharpCode.ILSpy.TreeNodes.Analyzer
{ {
if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n.Parent.IsRoot)) if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
return true; return true;
return false; return false;
} }
public bool IsEnabled(TextViewContext context) public bool IsEnabled(TextViewContext context)
{ {
return true; return true;
} }
public void Execute(TextViewContext context) public void Execute(TextViewContext context)
{ {
if (context.SelectedTreeNodes != null) { if (context.SelectedTreeNodes != null) {
foreach (var node in context.SelectedTreeNodes) { foreach (var node in context.SelectedTreeNodes) {
node.Parent.Children.Remove(node); node.Parent.Children.Remove(node);
} }
} }
} }

48
ILSpy/TreeNodes/AssemblyListTreeNode.cs

@ -130,34 +130,34 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
} }
#region Find*Node #region Find*Node
public ILSpyTreeNode FindResourceNode(Resource resource) public ILSpyTreeNode FindResourceNode(Resource resource)
{ {
if (resource == null) if (resource == null)
return null; return null;
foreach (AssemblyTreeNode node in this.Children) foreach (AssemblyTreeNode node in this.Children)
{ {
if (node.LoadedAssembly.IsLoaded) if (node.LoadedAssembly.IsLoaded)
{ {
node.EnsureLazyChildren(); node.EnsureLazyChildren();
foreach (var item in node.Children.OfType<ResourceListTreeNode>()) foreach (var item in node.Children.OfType<ResourceListTreeNode>())
{ {
var founded = item.Children.OfType<ResourceTreeNode>().Where(x => x.Resource == resource).FirstOrDefault(); var founded = item.Children.OfType<ResourceTreeNode>().Where(x => x.Resource == resource).FirstOrDefault();
if (founded != null) if (founded != null)
return founded; return founded;
var foundedResEntry = item.Children.OfType<ResourceEntryNode>().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault(); var foundedResEntry = item.Children.OfType<ResourceEntryNode>().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault();
if (foundedResEntry != null) if (foundedResEntry != null)
return foundedResEntry; return foundedResEntry;
} }
} }
} }
return null; return null;
} }
public AssemblyTreeNode FindAssemblyNode(ModuleDefinition module) public AssemblyTreeNode FindAssemblyNode(ModuleDefinition module)
{ {
if (module == null) if (module == null)
return null; return null;

4
appveyor.yml

@ -8,4 +8,6 @@ before_build:
build: build:
project: ILSpy.sln project: ILSpy.sln
parallel: true parallel: true
verbosity: minimal verbosity: minimal
after_test:
- python ICSharpCode.AvalonEdit.Tests\tidy.py

Loading…
Cancel
Save