Browse Source

Use tabs, not spaces.

pull/672/head
Daniel Grunwald 10 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 @@ @@ -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 @@ -715,7 +715,7 @@ namespace ICSharpCode.Decompiler.Ast
}
return new StackAllocExpression {
Type = AstBuilder.ConvertType(type),
CountExpression = arg1
CountExpression = arg1
};
}
case ILCode.Mkrefany:

4
ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs

@ -54,8 +54,8 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -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 ");

10
ILSpy/OpenListDialog.xaml.cs

@ -181,11 +181,11 @@ namespace ICSharpCode.ILSpy @@ -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;
}
}
}

28
ILSpy/Options/DisplaySettings.cs

@ -96,27 +96,27 @@ namespace ICSharpCode.ILSpy.Options @@ -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;
}
}
}

2
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -117,7 +117,7 @@ namespace ICSharpCode.ILSpy.Options @@ -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)

14
ILSpy/Properties/WPFAssemblyInfo.cs

@ -7,7 +7,7 @@ using System.Windows; @@ -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
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
@ -18,10 +18,10 @@ using System.Windows; @@ -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)
)]

4
ILSpy/TextView/DecompilerTextView.cs

@ -97,9 +97,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -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;

8
ILSpy/TreeNodes/Analyzer/RemoveAnalyzeContextMenuEntry.cs

@ -27,19 +27,19 @@ namespace ICSharpCode.ILSpy.TreeNodes.Analyzer @@ -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);
}
}
}

48
ILSpy/TreeNodes/AssemblyListTreeNode.cs

@ -130,34 +130,34 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -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<ResourceListTreeNode>())
{
var founded = item.Children.OfType<ResourceTreeNode>().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<ResourceListTreeNode>())
{
var founded = item.Children.OfType<ResourceTreeNode>().Where(x => x.Resource == resource).FirstOrDefault();
if (founded != null)
return founded;
var foundedResEntry = item.Children.OfType<ResourceEntryNode>().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault();
if (foundedResEntry != null)
return foundedResEntry;
}
}
}
return null;
}
var foundedResEntry = item.Children.OfType<ResourceEntryNode>().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;

4
appveyor.yml

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

Loading…
Cancel
Save