diff --git a/BuildTools/tidy.py b/BuildTools/tidy.py
new file mode 100644
index 000000000..97b349425
--- /dev/null
+++ b/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())
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
index e98e8dbc7..b5b7d57ff 100644
--- a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
+++ b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
@@ -715,7 +715,7 @@ namespace ICSharpCode.Decompiler.Ast
}
return new StackAllocExpression {
Type = AstBuilder.ConvertType(type),
- CountExpression = arg1
+ CountExpression = arg1
};
}
case ILCode.Mkrefany:
diff --git a/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs b/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
index ef6d32e69..9ec39f23a 100644
--- a/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
+++ b/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("// Code size {0} (0x{0:x})", body.CodeSize);
output.WriteLine(".maxstack {0}", body.MaxStackSize);
- if (method.DeclaringType.Module.Assembly != null && method.DeclaringType.Module.Assembly.EntryPoint == method)
- output.WriteLine (".entrypoint");
+ if (method.DeclaringType.Module.Assembly != null && method.DeclaringType.Module.Assembly.EntryPoint == method)
+ output.WriteLine (".entrypoint");
if (method.Body.HasVariables) {
output.Write(".locals ");
diff --git a/ILSpy/OpenListDialog.xaml.cs b/ILSpy/OpenListDialog.xaml.cs
index 3da2a9ed3..61f1bd855 100644
--- a/ILSpy/OpenListDialog.xaml.cs
+++ b/ILSpy/OpenListDialog.xaml.cs
@@ -181,11 +181,11 @@ namespace ICSharpCode.ILSpy
manager.DeleteList(listView.SelectedItem.ToString());
}
- private void listView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left && listView.SelectedItem != null)
- this.DialogResult = true;
- }
+ private void listView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left && listView.SelectedItem != null)
+ this.DialogResult = true;
+ }
}
}
diff --git a/ILSpy/Options/DisplaySettings.cs b/ILSpy/Options/DisplaySettings.cs
index 8f73b095c..d1d703434 100644
--- a/ILSpy/Options/DisplaySettings.cs
+++ b/ILSpy/Options/DisplaySettings.cs
@@ -96,27 +96,27 @@ namespace ICSharpCode.ILSpy.Options
}
}
- bool enableWordWrap;
+ bool enableWordWrap;
- public bool EnableWordWrap
- {
- get { return enableWordWrap; }
- set
- {
- if (enableWordWrap != value) {
- enableWordWrap = value;
- OnPropertyChanged("EnableWordWrap");
- }
- }
- }
+ public bool EnableWordWrap
+ {
+ get { return enableWordWrap; }
+ set
+ {
+ if (enableWordWrap != value) {
+ enableWordWrap = value;
+ OnPropertyChanged("EnableWordWrap");
+ }
+ }
+ }
- public void CopyValues(DisplaySettings s)
+ public void CopyValues(DisplaySettings s)
{
this.SelectedFont = s.selectedFont;
this.SelectedFontSize = s.selectedFontSize;
this.ShowLineNumbers = s.showLineNumbers;
this.ShowMetadataTokens = s.showMetadataTokens;
- this.EnableWordWrap = s.enableWordWrap;
+ this.EnableWordWrap = s.enableWordWrap;
}
}
}
diff --git a/ILSpy/Options/DisplaySettingsPanel.xaml.cs b/ILSpy/Options/DisplaySettingsPanel.xaml.cs
index 6ad4d8a58..5ca096e7b 100644
--- a/ILSpy/Options/DisplaySettingsPanel.xaml.cs
+++ b/ILSpy/Options/DisplaySettingsPanel.xaml.cs
@@ -117,7 +117,7 @@ namespace ICSharpCode.ILSpy.Options
section.SetAttributeValue("FontSize", s.SelectedFontSize);
section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
- section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);
+ section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);
XElement existingElement = root.Element("DisplaySettings");
if (existingElement != null)
diff --git a/ILSpy/Properties/WPFAssemblyInfo.cs b/ILSpy/Properties/WPFAssemblyInfo.cs
index 8b337b962..a83408fca 100644
--- a/ILSpy/Properties/WPFAssemblyInfo.cs
+++ b/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
//CultureYouAreCodingWith in your .csproj file
//inside a . For example, if you are using US english
//in your source files, set the to en-US. Then uncomment
@@ -18,10 +18,10 @@ using System.Windows;
[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
)]
diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs
index b99b752bf..e7a502094 100644
--- a/ILSpy/TextView/DecompilerTextView.cs
+++ b/ILSpy/TextView/DecompilerTextView.cs
@@ -97,9 +97,9 @@ namespace ICSharpCode.ILSpy.TextView
textEditor.TextArea.TextView.MouseDown += TextViewMouseDown;
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(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.LineTransformers.Add(textMarkerService);
textEditor.ShowLineNumbers = true;
diff --git a/ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs b/ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs
index 55d4ff412..3bcbe782f 100644
--- a/ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs
+++ b/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))
return true;
- return false;
+ return false;
}
public bool IsEnabled(TextViewContext context)
{
- return true;
+ return true;
}
public void Execute(TextViewContext context)
{
- if (context.SelectedTreeNodes != null) {
+ if (context.SelectedTreeNodes != null) {
foreach (var node in context.SelectedTreeNodes) {
- node.Parent.Children.Remove(node);
+ node.Parent.Children.Remove(node);
}
}
}
diff --git a/ILSpy/TreeNodes/AssemblyListTreeNode.cs b/ILSpy/TreeNodes/AssemblyListTreeNode.cs
index d2bb70447..6225516cc 100644
--- a/ILSpy/TreeNodes/AssemblyListTreeNode.cs
+++ b/ILSpy/TreeNodes/AssemblyListTreeNode.cs
@@ -130,34 +130,34 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
- #region Find*Node
+ #region Find*Node
- public ILSpyTreeNode FindResourceNode(Resource resource)
- {
- if (resource == null)
- return null;
- foreach (AssemblyTreeNode node in this.Children)
- {
- if (node.LoadedAssembly.IsLoaded)
- {
- node.EnsureLazyChildren();
- foreach (var item in node.Children.OfType())
- {
- var founded = item.Children.OfType().Where(x => x.Resource == resource).FirstOrDefault();
- if (founded != null)
- return founded;
+ public ILSpyTreeNode FindResourceNode(Resource resource)
+ {
+ if (resource == null)
+ return null;
+ foreach (AssemblyTreeNode node in this.Children)
+ {
+ if (node.LoadedAssembly.IsLoaded)
+ {
+ node.EnsureLazyChildren();
+ foreach (var item in node.Children.OfType())
+ {
+ var founded = item.Children.OfType().Where(x => x.Resource == resource).FirstOrDefault();
+ if (founded != null)
+ return founded;
- var foundedResEntry = item.Children.OfType().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault();
- if (foundedResEntry != null)
- return foundedResEntry;
- }
- }
- }
- return null;
- }
+ var foundedResEntry = item.Children.OfType().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault();
+ if (foundedResEntry != null)
+ return foundedResEntry;
+ }
+ }
+ }
+ return null;
+ }
- public AssemblyTreeNode FindAssemblyNode(ModuleDefinition module)
+ public AssemblyTreeNode FindAssemblyNode(ModuleDefinition module)
{
if (module == null)
return null;
diff --git a/appveyor.yml b/appveyor.yml
index 2870d918a..4a1154b81 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,4 +8,6 @@ before_build:
build:
project: ILSpy.sln
parallel: true
- verbosity: minimal
\ No newline at end of file
+ verbosity: minimal
+after_test:
+- python ICSharpCode.AvalonEdit.Tests\tidy.py