Skip to content

Commit 24a7fd8

Browse files
committed
Change code styles
1 parent e0d6051 commit 24a7fd8

File tree

230 files changed

+858
-1720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+858
-1720
lines changed

Confuser.CLI/ObfAttrParser.cs

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Text;
56
using Confuser.Core;
67

78
namespace Confuser.CLI {
89
internal struct ObfAttrParser {
9-
private System.Collections.IDictionary items;
10+
IDictionary items;
1011

11-
private string str;
12-
private int index;
12+
string str;
13+
int index;
1314

14-
public ObfAttrParser(System.Collections.IDictionary items) {
15+
public ObfAttrParser(IDictionary items) {
1516
this.items = items;
16-
this.str = null;
17-
this.index = -1;
17+
str = null;
18+
index = -1;
1819
}
1920

20-
private enum ParseState {
21+
enum ParseState {
2122
Init,
2223
ReadPreset,
2324
ReadItemName,
@@ -27,7 +28,7 @@ private enum ParseState {
2728
End
2829
}
2930

30-
private bool ReadId(StringBuilder sb) {
31+
bool ReadId(StringBuilder sb) {
3132
while (index < str.Length) {
3233
switch (str[index]) {
3334
case '(':
@@ -46,21 +47,21 @@ private bool ReadId(StringBuilder sb) {
4647
return false;
4748
}
4849

49-
private void Expect(char chr) {
50+
void Expect(char chr) {
5051
if (str[index] != chr)
5152
throw new ArgumentException("Expect '" + chr + "' at position " + (index + 1) + ".");
5253
index++;
5354
}
5455

55-
private char Peek() {
56+
char Peek() {
5657
return str[index];
5758
}
5859

59-
private void Next() {
60+
void Next() {
6061
index++;
6162
}
6263

63-
private bool IsEnd() {
64+
bool IsEnd() {
6465
return index == str.Length;
6566
}
6667

@@ -69,7 +70,7 @@ public void ParseProtectionString(ProtectionSettings settings, string str) {
6970
return;
7071

7172
this.str = str;
72-
this.index = 0;
73+
index = 0;
7374

7475
var state = ParseState.Init;
7576
var buffer = new StringBuilder();
@@ -80,7 +81,6 @@ public void ParseProtectionString(ProtectionSettings settings, string str) {
8081

8182
while (state != ParseState.End) {
8283
switch (state) {
83-
8484
case ParseState.Init:
8585
ReadId(buffer);
8686
if (buffer.ToString().Equals("preset", StringComparison.OrdinalIgnoreCase)) {
@@ -211,7 +211,7 @@ public void ParsePackerString(string str, out Packer packer, out Dictionary<stri
211211
return;
212212

213213
this.str = str;
214-
this.index = 0;
214+
index = 0;
215215

216216
var state = ParseState.ReadItemName;
217217
var buffer = new StringBuilder();
@@ -278,4 +278,4 @@ public void ParsePackerString(string str, out Packer packer, out Dictionary<stri
278278
}
279279
}
280280
}
281-
}
281+
}

Confuser.CLI/Program.cs

+18-19
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99

1010
namespace Confuser.CLI {
1111
internal class Program {
12-
13-
private static int Main(string[] args) {
12+
static int Main(string[] args) {
1413
ConsoleColor original = Console.ForegroundColor;
1514
Console.ForegroundColor = ConsoleColor.White;
1615
string originalTitle = Console.Title;
1716
Console.Title = "ConfuserEx";
1817

1918
bool noPause = false;
2019
string outDir = null;
21-
var p = new OptionSet() {
22-
{ "n|nopause", "no pause after finishing protection.",
23-
value => { noPause = (value != null); } },
24-
{ "o|out=", "specifies output directory.",
25-
value => { outDir = value; } },
20+
var p = new OptionSet {
21+
{
22+
"n|nopause", "no pause after finishing protection.",
23+
value => { noPause = (value != null); }
24+
}, {
25+
"o|out=", "specifies output directory.",
26+
value => { outDir = value; }
27+
}
2628
};
2729

2830
List<string> files;
@@ -62,7 +64,7 @@ private static int Main(string[] args) {
6264
// Assuming first file = main module
6365
var proj = new ConfuserProject();
6466
foreach (var input in files)
65-
proj.Add(new ProjectModule() { Path = input });
67+
proj.Add(new ProjectModule { Path = input });
6668
proj.BaseDirectory = Path.GetDirectoryName(files[0]);
6769
proj.OutputDirectory = outDir;
6870
parameters.Project = proj;
@@ -84,7 +86,7 @@ private static int Main(string[] args) {
8486
}
8587
}
8688

87-
private static int RunProject(ConfuserParameters parameters) {
89+
static int RunProject(ConfuserParameters parameters) {
8890
var logger = new ConsoleLogger();
8991
parameters.Logger = new ConsoleLogger();
9092

@@ -94,36 +96,35 @@ private static int RunProject(ConfuserParameters parameters) {
9496
return logger.ReturnValue;
9597
}
9698

97-
private static bool NeedPause() {
99+
static bool NeedPause() {
98100
return Debugger.IsAttached || string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROMPT"));
99101
}
100102

101-
private static void PrintUsage() {
103+
static void PrintUsage() {
102104
WriteLine("Usage:");
103105
WriteLine("Confuser.CLI -n|noPause <project configuration>");
104106
WriteLine("Confuser.CLI -n|noPause -o|out=<output directory> <modules>");
105107
WriteLine(" -n|noPause : no pause after finishing protection.");
106108
WriteLine(" -o|out : specifies output directory.");
107109
}
108110

109-
private static void WriteLineWithColor(ConsoleColor color, string txt) {
111+
static void WriteLineWithColor(ConsoleColor color, string txt) {
110112
ConsoleColor original = Console.ForegroundColor;
111113
Console.ForegroundColor = color;
112114
Console.WriteLine(txt);
113115
Console.ForegroundColor = original;
114116
}
115117

116-
private static void WriteLine(string txt) {
118+
static void WriteLine(string txt) {
117119
Console.WriteLine(txt);
118120
}
119121

120-
private static void WriteLine() {
122+
static void WriteLine() {
121123
Console.WriteLine();
122124
}
123125

124-
private class ConsoleLogger : ILogger {
125-
126-
private readonly DateTime begin;
126+
class ConsoleLogger : ILogger {
127+
readonly DateTime begin;
127128

128129
public ConsoleLogger() {
129130
begin = DateTime.Now;
@@ -195,8 +196,6 @@ public void Finish(bool successful) {
195196
ReturnValue = 1;
196197
}
197198
}
198-
199199
}
200-
201200
}
202201
}

Confuser.Core/Annotations.cs

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ namespace Confuser.Core {
1111
/// The annotations are stored using <see cref="WeakReference" />
1212
/// </remarks>
1313
public class Annotations {
14-
15-
private readonly Dictionary<object, ListDictionary> annotations = new Dictionary<object, ListDictionary>(WeakReferenceComparer.Instance);
14+
readonly Dictionary<object, ListDictionary> annotations = new Dictionary<object, ListDictionary>(WeakReferenceComparer.Instance);
1615

1716
/// <summary>
1817
/// Retrieves the annotation on the specified object associated with the specified key.
@@ -136,8 +135,7 @@ public void Trim() {
136135
/// <summary>
137136
/// Equality comparer of weak references.
138137
/// </summary>
139-
private class WeakReferenceComparer : IEqualityComparer<object> {
140-
138+
class WeakReferenceComparer : IEqualityComparer<object> {
141139
/// <summary>
142140
/// The singleton instance of this comparer.
143141
/// </summary>
@@ -146,7 +144,7 @@ private class WeakReferenceComparer : IEqualityComparer<object> {
146144
/// <summary>
147145
/// Prevents a default instance of the <see cref="WeakReferenceComparer" /> class from being created.
148146
/// </summary>
149-
private WeakReferenceComparer() { }
147+
WeakReferenceComparer() { }
150148

151149
/// <inheritdoc />
152150
public new bool Equals(object x, object y) {
@@ -172,14 +170,12 @@ public int GetHashCode(object obj) {
172170
return ((WeakReferenceKey)obj).HashCode;
173171
return obj.GetHashCode();
174172
}
175-
176173
}
177174

178175
/// <summary>
179176
/// Represent a key using <see cref="WeakReference" />.
180177
/// </summary>
181-
private class WeakReferenceKey : WeakReference {
182-
178+
class WeakReferenceKey : WeakReference {
183179
/// <inheritdoc />
184180
public WeakReferenceKey(object target)
185181
: base(target) {
@@ -191,8 +187,6 @@ public WeakReferenceKey(object target)
191187
/// </summary>
192188
/// <value>The hash code.</value>
193189
public int HashCode { get; private set; }
194-
195190
}
196-
197191
}
198192
}

Confuser.Core/ConfuserComponent.cs

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace Confuser.Core {
55
/// Represent a component in Confuser
66
/// </summary>
77
public abstract class ConfuserComponent {
8-
98
/// <summary>
109
/// Gets the name of component.
1110
/// </summary>
@@ -41,6 +40,5 @@ public abstract class ConfuserComponent {
4140
/// </summary>
4241
/// <param name="pipeline">The processing pipeline.</param>
4342
protected internal abstract void PopulatePipeline(ProtectionPipeline pipeline);
44-
4543
}
4644
}

Confuser.Core/ConfuserContext.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ namespace Confuser.Core {
1010
/// Context providing information on the current protection process.
1111
/// </summary>
1212
public class ConfuserContext {
13-
14-
private readonly Annotations annotations = new Annotations();
15-
private readonly ServiceRegistry registry = new ServiceRegistry();
13+
readonly Annotations annotations = new Annotations();
14+
readonly ServiceRegistry registry = new ServiceRegistry();
1615
internal CancellationToken token;
1716

1817
/// <summary>
@@ -181,6 +180,5 @@ public NativeModuleWriterOptions RequestNative() {
181180
CurrentModuleWriterOptions = newOptions;
182181
return newOptions;
183182
}
184-
185183
}
186184
}

0 commit comments

Comments
 (0)