diff --git a/Confuser.CLI/Program.cs b/Confuser.CLI/Program.cs
index 0e258f672..bf732697f 100644
--- a/Confuser.CLI/Program.cs
+++ b/Confuser.CLI/Program.cs
@@ -25,8 +25,7 @@ private static int Main(string[] args) {
xmlDoc.Load(args[0]);
proj.Load(xmlDoc);
proj.BaseDirectory = Path.Combine(Path.GetDirectoryName(args[0]), proj.BaseDirectory);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
WriteLineWithColor(ConsoleColor.Red, "Failed to load project:");
WriteLineWithColor(ConsoleColor.Red, ex.ToString());
return -1;
@@ -46,8 +45,7 @@ private static int Main(string[] args) {
}
return logger.ReturnValue;
- }
- finally {
+ } finally {
Console.ForegroundColor = original;
Console.Title = originalTitle;
}
@@ -143,8 +141,7 @@ public void Finish(bool successful) {
Console.Title = "ConfuserEx - Success";
WriteLineWithColor(ConsoleColor.Green, "Finished " + timeString);
ReturnValue = 0;
- }
- else {
+ } else {
Console.Title = "ConfuserEx - Fail";
WriteLineWithColor(ConsoleColor.Red, "Failed " + timeString);
ReturnValue = 1;
diff --git a/Confuser.CLI/Properties/AssemblyInfo.cs b/Confuser.CLI/Properties/AssemblyInfo.cs
index 95c759147..4c6332635 100644
--- a/Confuser.CLI/Properties/AssemblyInfo.cs
+++ b/Confuser.CLI/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Command-line")]
[assembly: AssemblyDescription("Command-line interface of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.Core/ConfuserComponent.cs b/Confuser.Core/ConfuserComponent.cs
index f1315102b..105211392 100644
--- a/Confuser.Core/ConfuserComponent.cs
+++ b/Confuser.Core/ConfuserComponent.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Core {
+using System;
+
+namespace Confuser.Core {
///
/// Represent a component in Confuser
///
diff --git a/Confuser.Core/ConfuserEngine.cs b/Confuser.Core/ConfuserEngine.cs
index e5c31ebb1..122f4658c 100644
--- a/Confuser.Core/ConfuserEngine.cs
+++ b/Confuser.Core/ConfuserEngine.cs
@@ -21,11 +21,11 @@ namespace Confuser.Core {
/// The processing engine of ConfuserEx.
///
public static class ConfuserEngine {
-
///
- /// The version of ConfuserEx.
+ /// The version of ConfuserEx.
///
public static readonly string Version;
+
private static readonly string Copyright;
static ConfuserEngine() {
diff --git a/Confuser.Core/ConfuserParameters.cs b/Confuser.Core/ConfuserParameters.cs
index 774df5eb5..f1e9b8549 100644
--- a/Confuser.Core/ConfuserParameters.cs
+++ b/Confuser.Core/ConfuserParameters.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Project;
+using System;
+using Confuser.Core.Project;
namespace Confuser.Core {
///
diff --git a/Confuser.Core/CoreComponent.cs b/Confuser.Core/CoreComponent.cs
index 992863d19..bb9408023 100644
--- a/Confuser.Core/CoreComponent.cs
+++ b/Confuser.Core/CoreComponent.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
namespace Confuser.Core {
///
diff --git a/Confuser.Core/DnlibUtils.cs b/Confuser.Core/DnlibUtils.cs
index ea4e54f1f..a7535ff61 100644
--- a/Confuser.Core/DnlibUtils.cs
+++ b/Confuser.Core/DnlibUtils.cs
@@ -224,8 +224,7 @@ private static void FindTypeRefsInternal(TypeSig typeSig, IList r
ret.Add(genInst.GenericType.TypeDefOrRef);
foreach (TypeSig genArg in genInst.GenericArguments)
FindTypeRefsInternal(genArg, ret);
- }
- else if (typeSig is TypeDefOrRefSig)
+ } else if (typeSig is TypeDefOrRefSig)
ret.Add(((TypeDefOrRefSig)typeSig).TypeDefOrRef);
}
diff --git a/Confuser.Core/Helpers/InjectHelper.cs b/Confuser.Core/Helpers/InjectHelper.cs
index f1c3eab09..1ad08efeb 100644
--- a/Confuser.Core/Helpers/InjectHelper.cs
+++ b/Confuser.Core/Helpers/InjectHelper.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
@@ -62,8 +63,7 @@ private static TypeDef PopulateContext(TypeDef typeDef, InjectContext ctx) {
if (!ctx.Map.TryGetValue(typeDef, out existing)) {
ret = Clone(typeDef);
ctx.Map[typeDef] = ret;
- }
- else
+ } else
ret = (TypeDef)existing;
foreach (TypeDef nestedType in typeDef.NestedTypes)
diff --git a/Confuser.Core/LZMA/Common/CRC.cs b/Confuser.Core/LZMA/Common/CRC.cs
index a16d29397..bc2259b82 100644
--- a/Confuser.Core/LZMA/Common/CRC.cs
+++ b/Confuser.Core/LZMA/Common/CRC.cs
@@ -1,5 +1,7 @@
// Common/CRC.cs
+using System;
+
namespace SevenZip {
internal class CRC {
public static readonly uint[] Table;
diff --git a/Confuser.Core/LZMA/Common/InBuffer.cs b/Confuser.Core/LZMA/Common/InBuffer.cs
index 9928f73cc..4845a8623 100644
--- a/Confuser.Core/LZMA/Common/InBuffer.cs
+++ b/Confuser.Core/LZMA/Common/InBuffer.cs
@@ -1,5 +1,6 @@
// InBuffer.cs
+using System;
using System.IO;
namespace SevenZip.Buffer {
diff --git a/Confuser.Core/LZMA/Common/OutBuffer.cs b/Confuser.Core/LZMA/Common/OutBuffer.cs
index 681ec12b0..57cfe3b14 100644
--- a/Confuser.Core/LZMA/Common/OutBuffer.cs
+++ b/Confuser.Core/LZMA/Common/OutBuffer.cs
@@ -1,5 +1,6 @@
// OutBuffer.cs
+using System;
using System.IO;
namespace SevenZip.Buffer {
diff --git a/Confuser.Core/LZMA/Compress/LZ/LzBinTree.cs b/Confuser.Core/LZMA/Compress/LZ/LzBinTree.cs
index a393f1a9f..e4e1b586e 100644
--- a/Confuser.Core/LZMA/Compress/LZ/LzBinTree.cs
+++ b/Confuser.Core/LZMA/Compress/LZ/LzBinTree.cs
@@ -116,8 +116,7 @@ public UInt32 GetMatches(UInt32[] distances) {
temp ^= ((UInt32)(_bufferBase[cur + 2]) << 8);
hash3Value = temp & (kHash3Size - 1);
hashValue = (temp ^ (CRC.Table[_bufferBase[cur + 3]] << 5)) & _hashMask;
- }
- else
+ } else
hashValue = _bufferBase[cur] ^ ((UInt32)(_bufferBase[cur + 1]) << 8);
UInt32 curMatch = _hash[kFixHashSize + hashValue];
@@ -196,8 +195,7 @@ public UInt32 GetMatches(UInt32[] distances) {
ptr1 = cyclicPos + 1;
curMatch = _son[ptr1];
len1 = len;
- }
- else {
+ } else {
_son[ptr0] = curMatch;
ptr0 = cyclicPos;
curMatch = _son[ptr0];
@@ -234,8 +232,7 @@ public void Skip(UInt32 num) {
UInt32 hash3Value = temp & (kHash3Size - 1);
_hash[kHash3Offset + hash3Value] = _pos;
hashValue = (temp ^ (CRC.Table[_bufferBase[cur + 3]] << 5)) & _hashMask;
- }
- else
+ } else
hashValue = _bufferBase[cur] ^ ((UInt32)(_bufferBase[cur + 1]) << 8);
UInt32 curMatch = _hash[kFixHashSize + hashValue];
@@ -276,8 +273,7 @@ public void Skip(UInt32 num) {
ptr1 = cyclicPos + 1;
curMatch = _son[ptr1];
len1 = len;
- }
- else {
+ } else {
_son[ptr0] = curMatch;
ptr0 = cyclicPos;
curMatch = _son[ptr0];
@@ -294,8 +290,7 @@ public void SetType(int numHashBytes) {
kNumHashDirectBytes = 0;
kMinMatchCheck = 4;
kFixHashSize = kHash2Size + kHash3Size;
- }
- else {
+ } else {
kNumHashDirectBytes = 2;
kMinMatchCheck = 2 + 1;
kFixHashSize = 0;
diff --git a/Confuser.Core/LZMA/Compress/LZ/LzOutWindow.cs b/Confuser.Core/LZMA/Compress/LZ/LzOutWindow.cs
index dbe7b6d1c..3a20ffef8 100644
--- a/Confuser.Core/LZMA/Compress/LZ/LzOutWindow.cs
+++ b/Confuser.Core/LZMA/Compress/LZ/LzOutWindow.cs
@@ -1,5 +1,6 @@
// LzOutWindow.cs
+using System;
using System.IO;
namespace SevenZip.Compression.LZ {
diff --git a/Confuser.Core/LZMA/Compress/LZMA/LzmaBase.cs b/Confuser.Core/LZMA/Compress/LZMA/LzmaBase.cs
index 6c7fa5aff..b8ae5807f 100644
--- a/Confuser.Core/LZMA/Compress/LZMA/LzmaBase.cs
+++ b/Confuser.Core/LZMA/Compress/LZMA/LzmaBase.cs
@@ -1,5 +1,7 @@
// LzmaBase.cs
+using System;
+
namespace SevenZip.Compression.LZMA {
internal abstract class Base {
public const uint kNumRepDistances = 4;
diff --git a/Confuser.Core/LZMA/Compress/LZMA/LzmaDecoder.cs b/Confuser.Core/LZMA/Compress/LZMA/LzmaDecoder.cs
index 5f4f7e30e..71d5fd1a4 100644
--- a/Confuser.Core/LZMA/Compress/LZMA/LzmaDecoder.cs
+++ b/Confuser.Core/LZMA/Compress/LZMA/LzmaDecoder.cs
@@ -71,8 +71,7 @@ public void Code(Stream inStream, Stream outStream,
m_OutWindow.PutByte(b);
state.UpdateChar();
nowPos64++;
- }
- else {
+ } else {
uint len;
if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1) {
if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0) {
@@ -82,13 +81,11 @@ public void Code(Stream inStream, Stream outStream,
nowPos64++;
continue;
}
- }
- else {
+ } else {
UInt32 distance;
if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0) {
distance = rep1;
- }
- else {
+ } else {
if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
distance = rep2;
else {
@@ -102,8 +99,7 @@ public void Code(Stream inStream, Stream outStream,
}
len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + Base.kMatchMinLen;
state.UpdateRep();
- }
- else {
+ } else {
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
@@ -121,8 +117,7 @@ public void Code(Stream inStream, Stream outStream,
numDirectBits - Base.kNumAlignBits) << Base.kNumAlignBits);
rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
}
- }
- else
+ } else
rep0 = posSlot;
}
if (rep0 >= m_OutWindow.TrainSize + nowPos64 || rep0 >= m_DictionarySizeCheck) {
diff --git a/Confuser.Core/LZMA/Compress/LZMA/LzmaEncoder.cs b/Confuser.Core/LZMA/Compress/LZMA/LzmaEncoder.cs
index 3dd271d5d..2a9f9692f 100644
--- a/Confuser.Core/LZMA/Compress/LZMA/LzmaEncoder.cs
+++ b/Confuser.Core/LZMA/Compress/LZMA/LzmaEncoder.cs
@@ -117,8 +117,7 @@ public void Code(Stream inStream, Stream outStream,
progress.SetProgress(processedInSize, processedOutSize);
}
}
- }
- finally {
+ } finally {
ReleaseStreams();
}
}
@@ -333,8 +332,7 @@ private UInt32 GetPureRepPrice(UInt32 repIndex, Base.State state, UInt32 posStat
if (repIndex == 0) {
price = _isRepG0[state.Index].GetPrice0();
price += _isRep0Long[(state.Index << Base.kNumPosStatesBitsMax) + posState].GetPrice1();
- }
- else {
+ } else {
price = _isRepG0[state.Index].GetPrice1();
if (repIndex == 1)
price += _isRepG1[state.Index].GetPrice0();
@@ -404,8 +402,7 @@ private UInt32 GetOptimum(UInt32 position, out UInt32 backRes) {
UInt32 lenMain, numDistancePairs;
if (!_longestMatchWasFound) {
ReadMatchDistances(out lenMain, out numDistancePairs);
- }
- else {
+ } else {
lenMain = _longestMatchLength;
numDistancePairs = _numDistancePairs;
_longestMatchWasFound = false;
@@ -552,27 +549,23 @@ private UInt32 GetOptimum(UInt32 position, out UInt32 backRes) {
state.UpdateRep();
else
state.UpdateMatch();
- }
- else
+ } else
state = _optimum[posPrev].State;
state.UpdateChar();
- }
- else
+ } else
state = _optimum[posPrev].State;
if (posPrev == cur - 1) {
if (_optimum[cur].IsShortRep())
state.UpdateShortRep();
else
state.UpdateChar();
- }
- else {
+ } else {
UInt32 pos;
if (_optimum[cur].Prev1IsChar && _optimum[cur].Prev2) {
posPrev = _optimum[cur].PosPrev2;
pos = _optimum[cur].BackPrev2;
state.UpdateRep();
- }
- else {
+ } else {
pos = _optimum[cur].BackPrev;
if (pos < Base.kNumRepDistances)
state.UpdateRep();
@@ -586,27 +579,23 @@ private UInt32 GetOptimum(UInt32 position, out UInt32 backRes) {
reps[1] = opt.Backs1;
reps[2] = opt.Backs2;
reps[3] = opt.Backs3;
- }
- else if (pos == 1) {
+ } else if (pos == 1) {
reps[0] = opt.Backs1;
reps[1] = opt.Backs0;
reps[2] = opt.Backs2;
reps[3] = opt.Backs3;
- }
- else if (pos == 2) {
+ } else if (pos == 2) {
reps[0] = opt.Backs2;
reps[1] = opt.Backs0;
reps[2] = opt.Backs1;
reps[3] = opt.Backs3;
- }
- else {
+ } else {
reps[0] = opt.Backs3;
reps[1] = opt.Backs0;
reps[2] = opt.Backs1;
reps[3] = opt.Backs2;
}
- }
- else {
+ } else {
reps[0] = (pos - Base.kNumRepDistances);
reps[1] = opt.Backs0;
reps[2] = opt.Backs1;
@@ -910,13 +899,11 @@ public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
if (!_state.IsCharState()) {
Byte matchByte = _matchFinder.GetIndexByte((Int32)(0 - _repDistances[0] - 1 - _additionalOffset));
subCoder.EncodeMatched(_rangeEncoder, matchByte, curByte);
- }
- else
+ } else
subCoder.Encode(_rangeEncoder, curByte);
_previousByte = curByte;
_state.UpdateChar();
- }
- else {
+ } else {
_isMatch[complexState].Encode(_rangeEncoder, 1);
if (pos < Base.kNumRepDistances) {
_isRep[_state.Index].Encode(_rangeEncoder, 1);
@@ -926,8 +913,7 @@ public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
_isRep0Long[complexState].Encode(_rangeEncoder, 0);
else
_isRep0Long[complexState].Encode(_rangeEncoder, 1);
- }
- else {
+ } else {
_isRepG0[_state.Index].Encode(_rangeEncoder, 1);
if (pos == 1)
_isRepG1[_state.Index].Encode(_rangeEncoder, 0);
@@ -948,8 +934,7 @@ public void CodeOneBlock(out Int64 inSize, out Int64 outSize, out bool finished)
_repDistances[i] = _repDistances[i - 1];
_repDistances[0] = distance;
}
- }
- else {
+ } else {
_isRep[_state.Index].Encode(_rangeEncoder, 0);
_state.UpdateMatch();
_lenEncoder.Encode(_rangeEncoder, len - Base.kMatchMinLen, posState);
@@ -1127,15 +1112,13 @@ public void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posSta
if (symbol < Base.kNumLowLenSymbols) {
_choice.Encode(rangeEncoder, 0);
_lowCoder[posState].Encode(rangeEncoder, symbol);
- }
- else {
+ } else {
symbol -= Base.kNumLowLenSymbols;
_choice.Encode(rangeEncoder, 1);
if (symbol < Base.kNumMidLenSymbols) {
_choice2.Encode(rangeEncoder, 0);
_midCoder[posState].Encode(rangeEncoder, symbol);
- }
- else {
+ } else {
_choice2.Encode(rangeEncoder, 1);
_highCoder.Encode(rangeEncoder, symbol - Base.kNumMidLenSymbols);
}
diff --git a/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoder.cs b/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoder.cs
index 3f2dbd6f7..2eae386c5 100644
--- a/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoder.cs
+++ b/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoder.cs
@@ -182,8 +182,7 @@ public uint DecodeBit(uint size0, int numTotalBits) {
if (Code < newBound) {
symbol = 0;
Range = newBound;
- }
- else {
+ } else {
symbol = 1;
Code -= newBound;
Range -= newBound;
diff --git a/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoderBit.cs b/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoderBit.cs
index 65bdf230a..21663ce0e 100644
--- a/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoderBit.cs
+++ b/Confuser.Core/LZMA/Compress/RangeCoder/RangeCoderBit.cs
@@ -40,8 +40,7 @@ public void Encode(Encoder encoder, uint symbol) {
if (symbol == 0) {
encoder.Range = newBound;
Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
- }
- else {
+ } else {
encoder.Low += newBound;
encoder.Range -= newBound;
Prob -= (Prob) >> kNumMoveBits;
diff --git a/Confuser.Core/Marker.cs b/Confuser.Core/Marker.cs
index a7083e460..8354acee5 100644
--- a/Confuser.Core/Marker.cs
+++ b/Confuser.Core/Marker.cs
@@ -76,8 +76,7 @@ public static StrongNameKey LoadSNKey(ConfuserContext context, string path, stri
return new StrongNameKey(rsa.ExportCspBlob(true));
}
return new StrongNameKey(path);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.ErrorException("Cannot load the Strong Name Key located at: " + path, ex);
throw new ConfuserException(ex);
}
@@ -161,8 +160,7 @@ protected Rules ParseRules(ConfuserProject proj, ProjectModule module, ConfuserC
foreach (Rule rule in proj.Rules.Concat(module.Rules)) {
try {
ret.Add(rule, parser.Parse(rule.Pattern));
- }
- catch (InvalidPatternException ex) {
+ } catch (InvalidPatternException ex) {
context.Logger.ErrorFormat("Invalid rule pattern: " + rule.Pattern + ".", ex);
throw new ConfuserException(ex);
}
diff --git a/Confuser.Core/MarkerResult.cs b/Confuser.Core/MarkerResult.cs
index 672791c9d..ebe5cecbd 100644
--- a/Confuser.Core/MarkerResult.cs
+++ b/Confuser.Core/MarkerResult.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
namespace Confuser.Core {
diff --git a/Confuser.Core/Packer.cs b/Confuser.Core/Packer.cs
index 57fdb1c08..fa588f8f7 100644
--- a/Confuser.Core/Packer.cs
+++ b/Confuser.Core/Packer.cs
@@ -66,8 +66,7 @@ protected void ProtectStub(ConfuserContext context, string fileName, byte[] modu
Project = proj,
PackerInitiated = true
}, context.token).Wait();
- }
- catch (AggregateException ex) {
+ } catch (AggregateException ex) {
context.Logger.Error("Failed to protect packer stub.");
throw new ConfuserException(ex);
}
diff --git a/Confuser.Core/PluginDiscovery.cs b/Confuser.Core/PluginDiscovery.cs
index 667363201..40d55c429 100644
--- a/Confuser.Core/PluginDiscovery.cs
+++ b/Confuser.Core/PluginDiscovery.cs
@@ -33,7 +33,7 @@ public void GetPlugins(ConfuserContext context, out IList protection
}
///
- /// Determines whether the specified type has an accessible default constructor.
+ /// Determines whether the specified type has an accessible default constructor.
///
/// The type.
/// true if the specified type has an accessible default constructor; otherwise, false.
@@ -61,24 +61,19 @@ protected static void AddPlugins(
if (typeof (Protection).IsAssignableFrom(i)) {
try {
protections.Add((Protection)Activator.CreateInstance(i));
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.ErrorException("Failed to instantiate protection '" + i.Name + "'.", ex);
}
- }
- else if (typeof (Packer).IsAssignableFrom(i)) {
+ } else if (typeof (Packer).IsAssignableFrom(i)) {
try {
packers.Add((Packer)Activator.CreateInstance(i));
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.ErrorException("Failed to instantiate packer '" + i.Name + "'.", ex);
}
- }
- else if (typeof (ConfuserComponent).IsAssignableFrom(i)) {
+ } else if (typeof (ConfuserComponent).IsAssignableFrom(i)) {
try {
components.Add((ConfuserComponent)Activator.CreateInstance(i));
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.ErrorException("Failed to instantiate component '" + i.Name + "'.", ex);
}
}
@@ -99,24 +94,21 @@ protected virtual void GetPluginsInternal(
try {
Assembly protAsm = Assembly.Load("Confuser.Protections");
AddPlugins(context, protections, packers, components, protAsm);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.WarnException("Failed to load built-in protections.", ex);
}
try {
Assembly renameAsm = Assembly.Load("Confuser.Renamer");
AddPlugins(context, protections, packers, components, renameAsm);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.WarnException("Failed to load renamer.", ex);
}
try {
Assembly renameAsm = Assembly.Load("Confuser.DynCipher");
AddPlugins(context, protections, packers, components, renameAsm);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.WarnException("Failed to load dynamic cipher library.", ex);
}
@@ -125,8 +117,7 @@ protected virtual void GetPluginsInternal(
try {
Assembly plugin = Assembly.LoadFile(realPath);
AddPlugins(context, protections, packers, components, plugin);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
context.Logger.WarnException("Failed to load plugin '" + pluginPath + "'.", ex);
}
}
diff --git a/Confuser.Core/Project/ConfuserProject.cs b/Confuser.Core/Project/ConfuserProject.cs
index 2a1e41761..6165a4d8d 100644
--- a/Confuser.Core/Project/ConfuserProject.cs
+++ b/Confuser.Core/Project/ConfuserProject.cs
@@ -458,9 +458,9 @@ public void Load(XmlDocument doc) {
doc.Schemas.Add(Schema);
var exceptions = new List();
doc.Validate((sender, e) => {
- if (e.Severity != XmlSeverityType.Error) return;
- exceptions.Add(e.Exception);
- });
+ if (e.Severity != XmlSeverityType.Error) return;
+ exceptions.Add(e.Exception);
+ });
if (exceptions.Count > 0) {
throw new ProjectValidationException(exceptions);
}
@@ -490,18 +490,14 @@ public void Load(XmlDocument doc) {
var rule = new Rule();
rule.Load(i);
Rules.Add(rule);
- }
- else if (i.Name == "packer") {
+ } else if (i.Name == "packer") {
Packer = new SettingItem();
Packer.Load(i);
- }
- else if (i.Name == "probePath") {
+ } else if (i.Name == "probePath") {
ProbePaths.Add(i.InnerText);
- }
- else if (i.Name == "plugin") {
+ } else if (i.Name == "plugin") {
PluginPaths.Add(i.InnerText);
- }
- else {
+ } else {
var asm = new ProjectModule();
asm.Load(i);
Add(asm);
diff --git a/Confuser.Core/Project/PatternParser.cs b/Confuser.Core/Project/PatternParser.cs
index d413a8b30..24783c75e 100644
--- a/Confuser.Core/Project/PatternParser.cs
+++ b/Confuser.Core/Project/PatternParser.cs
@@ -46,8 +46,7 @@ public PatternExpression Parse(string pattern) {
if (PeekToken() != null)
throw new InvalidPatternException("Extra tokens beyond the end of pattern.");
return ret;
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (ex is InvalidPatternException)
throw;
throw new InvalidPatternException("Invalid pattern.", ex);
@@ -124,8 +123,7 @@ private PatternExpression ParseExpression(bool readBinOp = false) {
throw UnexpectedToken(token);
op.OperandA = ParseExpression();
ret = op;
- }
- else if (IsFunction(token)) {
+ } else if (IsFunction(token)) {
// function
PatternFunction fn = fns[token.Value]();
@@ -154,8 +152,7 @@ private PatternExpression ParseExpression(bool readBinOp = false) {
throw MismatchParens(parens.Position.Value);
ret = fn;
- }
- else {
+ } else {
bool boolValue;
if (bool.TryParse(token.Value, out boolValue))
ret = new LiteralExpression(boolValue);
diff --git a/Confuser.Core/Project/PatternToken.cs b/Confuser.Core/Project/PatternToken.cs
index dc02ac425..595315c51 100644
--- a/Confuser.Core/Project/PatternToken.cs
+++ b/Confuser.Core/Project/PatternToken.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Core.Project {
+using System;
+
+namespace Confuser.Core.Project {
///
/// The type of pattern tokens
///
diff --git a/Confuser.Core/Project/Patterns/AndOperator.cs b/Confuser.Core/Project/Patterns/AndOperator.cs
index 394eb0776..e55f27a90 100644
--- a/Confuser.Core/Project/Patterns/AndOperator.cs
+++ b/Confuser.Core/Project/Patterns/AndOperator.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/DeclTypeFunction.cs b/Confuser.Core/Project/Patterns/DeclTypeFunction.cs
index 0349ad653..40af325f0 100644
--- a/Confuser.Core/Project/Patterns/DeclTypeFunction.cs
+++ b/Confuser.Core/Project/Patterns/DeclTypeFunction.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/FullNameFunction.cs b/Confuser.Core/Project/Patterns/FullNameFunction.cs
index 816d02b58..4fbd7b9d6 100644
--- a/Confuser.Core/Project/Patterns/FullNameFunction.cs
+++ b/Confuser.Core/Project/Patterns/FullNameFunction.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/LiteralExpression.cs b/Confuser.Core/Project/Patterns/LiteralExpression.cs
index d8b4e0d2d..1495b6ad8 100644
--- a/Confuser.Core/Project/Patterns/LiteralExpression.cs
+++ b/Confuser.Core/Project/Patterns/LiteralExpression.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
@@ -30,8 +31,7 @@ public override void Serialize(IList tokens) {
if (Literal is bool) {
var value = (bool)Literal;
tokens.Add(new PatternToken(TokenType.Identifier, value.ToString().ToLowerInvariant()));
- }
- else
+ } else
tokens.Add(new PatternToken(TokenType.Literal, Literal.ToString()));
}
}
diff --git a/Confuser.Core/Project/Patterns/MatchFunction.cs b/Confuser.Core/Project/Patterns/MatchFunction.cs
index 31c451a52..94ff40e38 100644
--- a/Confuser.Core/Project/Patterns/MatchFunction.cs
+++ b/Confuser.Core/Project/Patterns/MatchFunction.cs
@@ -1,4 +1,5 @@
-using System.Text.RegularExpressions;
+using System;
+using System.Text.RegularExpressions;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
diff --git a/Confuser.Core/Project/Patterns/ModuleFunction.cs b/Confuser.Core/Project/Patterns/ModuleFunction.cs
index 4fd649a16..4c123462e 100644
--- a/Confuser.Core/Project/Patterns/ModuleFunction.cs
+++ b/Confuser.Core/Project/Patterns/ModuleFunction.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/NameFunction.cs b/Confuser.Core/Project/Patterns/NameFunction.cs
index 332b86c41..c6d8d49a5 100644
--- a/Confuser.Core/Project/Patterns/NameFunction.cs
+++ b/Confuser.Core/Project/Patterns/NameFunction.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/NamespaceFunction.cs b/Confuser.Core/Project/Patterns/NamespaceFunction.cs
index ecabf928e..d005ace03 100644
--- a/Confuser.Core/Project/Patterns/NamespaceFunction.cs
+++ b/Confuser.Core/Project/Patterns/NamespaceFunction.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
@@ -27,7 +28,7 @@ public override object Evaluate(IDnlibDef definition) {
if (type == null)
type = ((IMemberDef)definition).DeclaringType;
- while (type.IsNested)
+ while (type.IsNested)
type = type.DeclaringType;
return type != null && type.Namespace == ns.ToString();
diff --git a/Confuser.Core/Project/Patterns/NotOperator.cs b/Confuser.Core/Project/Patterns/NotOperator.cs
index 0018f1f4f..65dd31f78 100644
--- a/Confuser.Core/Project/Patterns/NotOperator.cs
+++ b/Confuser.Core/Project/Patterns/NotOperator.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/OrOperator.cs b/Confuser.Core/Project/Patterns/OrOperator.cs
index 6213496b2..112150e91 100644
--- a/Confuser.Core/Project/Patterns/OrOperator.cs
+++ b/Confuser.Core/Project/Patterns/OrOperator.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/PatternExpression.cs b/Confuser.Core/Project/Patterns/PatternExpression.cs
index a229b66d7..e0700ef7d 100644
--- a/Confuser.Core/Project/Patterns/PatternExpression.cs
+++ b/Confuser.Core/Project/Patterns/PatternExpression.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
diff --git a/Confuser.Core/Project/Patterns/PatternFunction.cs b/Confuser.Core/Project/Patterns/PatternFunction.cs
index d5d97fa3b..29aeae9d3 100644
--- a/Confuser.Core/Project/Patterns/PatternFunction.cs
+++ b/Confuser.Core/Project/Patterns/PatternFunction.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Confuser.Core.Project.Patterns {
///
diff --git a/Confuser.Core/Project/Patterns/PatternOperator.cs b/Confuser.Core/Project/Patterns/PatternOperator.cs
index 6dc9cf9b9..46ef981aa 100644
--- a/Confuser.Core/Project/Patterns/PatternOperator.cs
+++ b/Confuser.Core/Project/Patterns/PatternOperator.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Confuser.Core.Project.Patterns {
///
@@ -34,8 +35,7 @@ public override void Serialize(IList tokens) {
if (IsUnary) {
tokens.Add(new PatternToken(TokenType.Identifier, Name));
OperandA.Serialize(tokens);
- }
- else {
+ } else {
OperandA.Serialize(tokens);
tokens.Add(new PatternToken(TokenType.Identifier, Name));
OperandB.Serialize(tokens);
diff --git a/Confuser.Core/Properties/AssemblyInfo.cs b/Confuser.Core/Properties/AssemblyInfo.cs
index 8d2c3dbe6..0fe677900 100644
--- a/Confuser.Core/Properties/AssemblyInfo.cs
+++ b/Confuser.Core/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Core")]
[assembly: AssemblyDescription("Core framework of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.Core/Protection.cs b/Confuser.Core/Protection.cs
index 214a67a54..f7bb08075 100644
--- a/Confuser.Core/Protection.cs
+++ b/Confuser.Core/Protection.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Core {
+using System;
+
+namespace Confuser.Core {
///
/// Base class of Confuser protections.
///
diff --git a/Confuser.Core/ProtectionPhase.cs b/Confuser.Core/ProtectionPhase.cs
index d35848128..69c762410 100644
--- a/Confuser.Core/ProtectionPhase.cs
+++ b/Confuser.Core/ProtectionPhase.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Core {
+using System;
+
+namespace Confuser.Core {
///
/// Base class of protection phases.
///
diff --git a/Confuser.Core/ProtectionPipeline.cs b/Confuser.Core/ProtectionPipeline.cs
index e5cb78e9b..f4933f655 100644
--- a/Confuser.Core/ProtectionPipeline.cs
+++ b/Confuser.Core/ProtectionPipeline.cs
@@ -161,14 +161,14 @@ private static IList Filter(ConfuserContext context, IList
if (phase.ProcessAll)
return filter.ToList();
return filter.Where(def => {
- ProtectionSettings parameters = ProtectionParameters.GetParameters(context, def);
- Debug.Assert(parameters != null);
- if (parameters == null) {
- context.Logger.ErrorFormat("'{0}' not marked for obfuscation, possibly a bug.");
- throw new ConfuserException(null);
- }
- return parameters.ContainsKey(phase.Parent);
- }).ToList();
+ ProtectionSettings parameters = ProtectionParameters.GetParameters(context, def);
+ Debug.Assert(parameters != null);
+ if (parameters == null) {
+ context.Logger.ErrorFormat("'{0}' not marked for obfuscation, possibly a bug.");
+ throw new ConfuserException(null);
+ }
+ return parameters.ContainsKey(phase.Parent);
+ }).ToList();
}
}
}
\ No newline at end of file
diff --git a/Confuser.Core/ProtectionPreset.cs b/Confuser.Core/ProtectionPreset.cs
index e495d40d9..28e0b74d4 100644
--- a/Confuser.Core/ProtectionPreset.cs
+++ b/Confuser.Core/ProtectionPreset.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Core {
+using System;
+
+namespace Confuser.Core {
///
/// Various presets of protections.
///
diff --git a/Confuser.Core/ProtectionSettings.cs b/Confuser.Core/ProtectionSettings.cs
index a586edfed..0c4d74bab 100644
--- a/Confuser.Core/ProtectionSettings.cs
+++ b/Confuser.Core/ProtectionSettings.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Confuser.Core {
///
diff --git a/Confuser.Core/Services/RandomService.cs b/Confuser.Core/Services/RandomService.cs
index 7153ed082..03582758d 100644
--- a/Confuser.Core/Services/RandomService.cs
+++ b/Confuser.Core/Services/RandomService.cs
@@ -84,8 +84,7 @@ public void NextBytes(byte[] buffer, int offset, int length) {
offset += stateFilled;
length -= stateFilled;
stateFilled = 0;
- }
- else {
+ } else {
Buffer.BlockCopy(state, 32 - stateFilled, buffer, offset, length);
stateFilled -= length;
length = 0;
diff --git a/Confuser.Core/Services/TraceService.cs b/Confuser.Core/Services/TraceService.cs
index a20fd6849..94c7a38ee 100644
--- a/Confuser.Core/Services/TraceService.cs
+++ b/Confuser.Core/Services/TraceService.cs
@@ -162,8 +162,7 @@ internal MethodTrace Trace() {
beforeDepths[targetIndex] = currentStack;
fromInstrs.AddListEntry(offset2index[target.Offset], instr);
}
- }
- else {
+ } else {
int targetIndex = offset2index[((Instruction)instr.Operand).Offset];
if (beforeDepths[targetIndex] == int.MinValue)
beforeDepths[targetIndex] = currentStack;
@@ -264,8 +263,7 @@ public int[] TraceArguments(Instruction instr) {
if (stackUsage < 0) {
Debug.Assert(stackUsage == -1); // i.e. push
evalStack.Push(index);
- }
- else {
+ } else {
if (evalStack.Count < stackUsage)
return null;
@@ -282,14 +280,11 @@ public int[] TraceArguments(Instruction instr) {
working2.Enqueue(Tuple.Create(targetIndex, new Stack(evalStack)));
index++;
}
- }
-
- else if (currentInstr.Operand is Instruction[]) {
+ } else if (currentInstr.Operand is Instruction[]) {
foreach (Instruction targetInstr in (Instruction[])currentInstr.Operand)
working2.Enqueue(Tuple.Create(offset2index[targetInstr.Offset], new Stack(evalStack)));
index++;
- }
- else
+ } else
index++;
}
diff --git a/Confuser.Core/Tuples.cs b/Confuser.Core/Tuples.cs
index 6c3290789..1d2670904 100644
--- a/Confuser.Core/Tuples.cs
+++ b/Confuser.Core/Tuples.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Confuser.Core {
///
diff --git a/Confuser.DynCipher/AST/ArrayIndexExpression.cs b/Confuser.DynCipher/AST/ArrayIndexExpression.cs
index 8062206f9..f08453645 100644
--- a/Confuser.DynCipher/AST/ArrayIndexExpression.cs
+++ b/Confuser.DynCipher/AST/ArrayIndexExpression.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public class ArrayIndexExpression : Expression {
public Expression Array { get; set; }
public int Index { get; set; }
diff --git a/Confuser.DynCipher/AST/AssignmentStatement.cs b/Confuser.DynCipher/AST/AssignmentStatement.cs
index 31a2ef9bc..b02d5c3c2 100644
--- a/Confuser.DynCipher/AST/AssignmentStatement.cs
+++ b/Confuser.DynCipher/AST/AssignmentStatement.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public class AssignmentStatement : Statement {
public Expression Target { get; set; }
public Expression Value { get; set; }
diff --git a/Confuser.DynCipher/AST/Expression.cs b/Confuser.DynCipher/AST/Expression.cs
index ecc21062b..144e36799 100644
--- a/Confuser.DynCipher/AST/Expression.cs
+++ b/Confuser.DynCipher/AST/Expression.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public abstract class Expression {
public object Tag { get; set; }
public abstract override string ToString();
diff --git a/Confuser.DynCipher/AST/LiteralExpression.cs b/Confuser.DynCipher/AST/LiteralExpression.cs
index c611c1976..fa6257cde 100644
--- a/Confuser.DynCipher/AST/LiteralExpression.cs
+++ b/Confuser.DynCipher/AST/LiteralExpression.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public class LiteralExpression : Expression {
public uint Value { get; set; }
diff --git a/Confuser.DynCipher/AST/LoopStatement.cs b/Confuser.DynCipher/AST/LoopStatement.cs
index 222be06c2..b3fee191c 100644
--- a/Confuser.DynCipher/AST/LoopStatement.cs
+++ b/Confuser.DynCipher/AST/LoopStatement.cs
@@ -1,4 +1,5 @@
-using System.Text;
+using System;
+using System.Text;
namespace Confuser.DynCipher.AST {
// i.e. for loop
diff --git a/Confuser.DynCipher/AST/Statement.cs b/Confuser.DynCipher/AST/Statement.cs
index d078ad542..24f5c5366 100644
--- a/Confuser.DynCipher/AST/Statement.cs
+++ b/Confuser.DynCipher/AST/Statement.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public abstract class Statement {
public object Tag { get; set; }
public abstract override string ToString();
diff --git a/Confuser.DynCipher/AST/StatementBlock.cs b/Confuser.DynCipher/AST/StatementBlock.cs
index aa5e2098e..b209fc317 100644
--- a/Confuser.DynCipher/AST/StatementBlock.cs
+++ b/Confuser.DynCipher/AST/StatementBlock.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Text;
namespace Confuser.DynCipher.AST {
diff --git a/Confuser.DynCipher/AST/Variable.cs b/Confuser.DynCipher/AST/Variable.cs
index a767f33a0..856f9b081 100644
--- a/Confuser.DynCipher/AST/Variable.cs
+++ b/Confuser.DynCipher/AST/Variable.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public class Variable {
public Variable(string name) {
Name = name;
diff --git a/Confuser.DynCipher/AST/VariableExpression.cs b/Confuser.DynCipher/AST/VariableExpression.cs
index 0d066f7ce..1e6836de9 100644
--- a/Confuser.DynCipher/AST/VariableExpression.cs
+++ b/Confuser.DynCipher/AST/VariableExpression.cs
@@ -1,4 +1,6 @@
-namespace Confuser.DynCipher.AST {
+using System;
+
+namespace Confuser.DynCipher.AST {
public class VariableExpression : Expression {
public Variable Variable { get; set; }
diff --git a/Confuser.DynCipher/DynCipherComponent.cs b/Confuser.DynCipher/DynCipherComponent.cs
index 4ab39a289..a7c438956 100644
--- a/Confuser.DynCipher/DynCipherComponent.cs
+++ b/Confuser.DynCipher/DynCipherComponent.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
namespace Confuser.DynCipher {
internal class DynCipherComponent : ConfuserComponent {
diff --git a/Confuser.DynCipher/DynCipherService.cs b/Confuser.DynCipher/DynCipherService.cs
index 1597209a6..bba7c4cc7 100644
--- a/Confuser.DynCipher/DynCipherService.cs
+++ b/Confuser.DynCipher/DynCipherService.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
diff --git a/Confuser.DynCipher/Elements/AddKey.cs b/Confuser.DynCipher/Elements/AddKey.cs
index 3e840abae..5a5c62d81 100644
--- a/Confuser.DynCipher/Elements/AddKey.cs
+++ b/Confuser.DynCipher/Elements/AddKey.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
diff --git a/Confuser.DynCipher/Elements/BinOp.cs b/Confuser.DynCipher/Elements/BinOp.cs
index 8876d22de..24fe75dd3 100644
--- a/Confuser.DynCipher/Elements/BinOp.cs
+++ b/Confuser.DynCipher/Elements/BinOp.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
diff --git a/Confuser.DynCipher/Elements/CryptoElement.cs b/Confuser.DynCipher/Elements/CryptoElement.cs
index f422b1299..6f68c89da 100644
--- a/Confuser.DynCipher/Elements/CryptoElement.cs
+++ b/Confuser.DynCipher/Elements/CryptoElement.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.Generation;
namespace Confuser.DynCipher.Elements {
diff --git a/Confuser.DynCipher/Elements/NumOp.cs b/Confuser.DynCipher/Elements/NumOp.cs
index f89dc8795..edf3d26d6 100644
--- a/Confuser.DynCipher/Elements/NumOp.cs
+++ b/Confuser.DynCipher/Elements/NumOp.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
diff --git a/Confuser.DynCipher/Elements/RotateBit.cs b/Confuser.DynCipher/Elements/RotateBit.cs
index 26e1c6af5..c71dbb34f 100644
--- a/Confuser.DynCipher/Elements/RotateBit.cs
+++ b/Confuser.DynCipher/Elements/RotateBit.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
diff --git a/Confuser.DynCipher/Elements/Swap.cs b/Confuser.DynCipher/Elements/Swap.cs
index 045461dcc..84e7fba0d 100644
--- a/Confuser.DynCipher/Elements/Swap.cs
+++ b/Confuser.DynCipher/Elements/Swap.cs
@@ -1,4 +1,5 @@
-using Confuser.Core.Services;
+using System;
+using Confuser.Core.Services;
using Confuser.DynCipher.AST;
using Confuser.DynCipher.Generation;
@@ -40,8 +41,7 @@ private void EmitCore(CipherGenContext context) {
Target = b
});
}
- }
- else {
+ } else {
var mask = (LiteralExpression)Mask;
var notMask = (LiteralExpression)~Mask;
/* t = (a & mask) * k;
diff --git a/Confuser.DynCipher/Generation/CILCodeGen.cs b/Confuser.DynCipher/Generation/CILCodeGen.cs
index 56f60b6a8..0a343e33c 100644
--- a/Confuser.DynCipher/Generation/CILCodeGen.cs
+++ b/Confuser.DynCipher/Generation/CILCodeGen.cs
@@ -60,8 +60,7 @@ private void EmitLoad(Expression exp) {
EmitLoad(arrIndex.Array);
Emit(Instruction.CreateLdcI4(arrIndex.Index));
Emit(Instruction.Create(OpCodes.Ldelem_U4));
- }
- else if (exp is BinOpExpression) {
+ } else if (exp is BinOpExpression) {
var binOp = (BinOpExpression)exp;
EmitLoad(binOp.Left);
EmitLoad(binOp.Right);
@@ -98,8 +97,7 @@ private void EmitLoad(Expression exp) {
throw new NotSupportedException();
}
Emit(Instruction.Create(op));
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
var unaryOp = (UnaryOpExpression)exp;
EmitLoad(unaryOp.Value);
OpCode op;
@@ -114,16 +112,13 @@ private void EmitLoad(Expression exp) {
throw new NotSupportedException();
}
Emit(Instruction.Create(op));
- }
- else if (exp is LiteralExpression) {
+ } else if (exp is LiteralExpression) {
var literal = (LiteralExpression)exp;
Emit(Instruction.CreateLdcI4((int)literal.Value));
- }
- else if (exp is VariableExpression) {
+ } else if (exp is VariableExpression) {
var var = (VariableExpression)exp;
LoadVar(var.Variable);
- }
- else
+ } else
throw new NotSupportedException();
}
@@ -134,13 +129,11 @@ private void EmitStore(Expression exp, Expression value) {
Emit(Instruction.CreateLdcI4(arrIndex.Index));
EmitLoad(value);
Emit(Instruction.Create(OpCodes.Stelem_I4));
- }
- else if (exp is VariableExpression) {
+ } else if (exp is VariableExpression) {
var var = (VariableExpression)exp;
EmitLoad(value);
StoreVar(var.Variable);
- }
- else
+ } else
throw new NotSupportedException();
}
@@ -148,8 +141,7 @@ private void EmitStatement(Statement statement) {
if (statement is AssignmentStatement) {
var assignment = (AssignmentStatement)statement;
EmitStore(assignment.Target, assignment.Value);
- }
- else if (statement is LoopStatement) {
+ } else if (statement is LoopStatement) {
var loop = (LoopStatement)statement;
/*
* ldc.i4 begin
@@ -181,12 +173,10 @@ private void EmitStatement(Statement statement) {
Emit(Instruction.CreateLdcI4(loop.Limit));
Emit(Instruction.Create(OpCodes.Blt, lbl));
Emit(Instruction.Create(OpCodes.Pop));
- }
- else if (statement is StatementBlock) {
+ } else if (statement is StatementBlock) {
foreach (Statement child in ((StatementBlock)statement).Statements)
EmitStatement(child);
- }
- else
+ } else
throw new NotSupportedException();
}
}
diff --git a/Confuser.DynCipher/Generation/CipherGenerator.cs b/Confuser.DynCipher/Generation/CipherGenerator.cs
index bb8539ee6..3472aca9a 100644
--- a/Confuser.DynCipher/Generation/CipherGenerator.cs
+++ b/Confuser.DynCipher/Generation/CipherGenerator.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core.Services;
using Confuser.DynCipher.AST;
diff --git a/Confuser.DynCipher/Generation/DMCodeGen.cs b/Confuser.DynCipher/Generation/DMCodeGen.cs
index d500e79ec..4c0fd7d29 100644
--- a/Confuser.DynCipher/Generation/DMCodeGen.cs
+++ b/Confuser.DynCipher/Generation/DMCodeGen.cs
@@ -66,8 +66,7 @@ private void EmitLoad(Expression exp) {
EmitLoad(arrIndex.Array);
ilGen.Emit(OpCodes.Ldc_I4, arrIndex.Index);
ilGen.Emit(OpCodes.Ldelem_U4);
- }
- else if (exp is BinOpExpression) {
+ } else if (exp is BinOpExpression) {
var binOp = (BinOpExpression)exp;
EmitLoad(binOp.Left);
EmitLoad(binOp.Right);
@@ -104,8 +103,7 @@ private void EmitLoad(Expression exp) {
throw new NotSupportedException();
}
ilGen.Emit(op);
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
var unaryOp = (UnaryOpExpression)exp;
EmitLoad(unaryOp.Value);
OpCode op;
@@ -120,16 +118,13 @@ private void EmitLoad(Expression exp) {
throw new NotSupportedException();
}
ilGen.Emit(op);
- }
- else if (exp is LiteralExpression) {
+ } else if (exp is LiteralExpression) {
var literal = (LiteralExpression)exp;
ilGen.Emit(OpCodes.Ldc_I4, (int)literal.Value);
- }
- else if (exp is VariableExpression) {
+ } else if (exp is VariableExpression) {
var var = (VariableExpression)exp;
LoadVar(var.Variable);
- }
- else
+ } else
throw new NotSupportedException();
}
@@ -140,13 +135,11 @@ private void EmitStore(Expression exp, Expression value) {
ilGen.Emit(OpCodes.Ldc_I4, arrIndex.Index);
EmitLoad(value);
ilGen.Emit(OpCodes.Stelem_I4);
- }
- else if (exp is VariableExpression) {
+ } else if (exp is VariableExpression) {
var var = (VariableExpression)exp;
EmitLoad(value);
StoreVar(var.Variable);
- }
- else
+ } else
throw new NotSupportedException();
}
@@ -154,8 +147,7 @@ private void EmitStatement(Statement statement) {
if (statement is AssignmentStatement) {
var assignment = (AssignmentStatement)statement;
EmitStore(assignment.Target, assignment.Value);
- }
- else if (statement is LoopStatement) {
+ } else if (statement is LoopStatement) {
var loop = (LoopStatement)statement;
/*
* ldc.i4 begin
@@ -188,12 +180,10 @@ private void EmitStatement(Statement statement) {
ilGen.Emit(OpCodes.Ldc_I4, loop.Limit);
ilGen.Emit(OpCodes.Blt, lbl);
ilGen.Emit(OpCodes.Pop);
- }
- else if (statement is StatementBlock) {
+ } else if (statement is StatementBlock) {
foreach (Statement child in ((StatementBlock)statement).Statements)
EmitStatement(child);
- }
- else
+ } else
throw new NotSupportedException();
}
}
diff --git a/Confuser.DynCipher/Generation/ExpressionGenerator.cs b/Confuser.DynCipher/Generation/ExpressionGenerator.cs
index 2af4e633c..9389af788 100644
--- a/Confuser.DynCipher/Generation/ExpressionGenerator.cs
+++ b/Confuser.DynCipher/Generation/ExpressionGenerator.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using Confuser.Core;
using Confuser.Core.Services;
@@ -45,8 +46,7 @@ private static void SwapOperands(RandomGenerator random, Expression exp) {
}
SwapOperands(random, binExp.Left);
SwapOperands(random, binExp.Right);
- }
- else if (exp is UnaryOpExpression)
+ } else if (exp is UnaryOpExpression)
SwapOperands(random, ((UnaryOpExpression)exp).Value);
else if (exp is LiteralExpression || exp is VariableExpression)
return;
@@ -64,11 +64,9 @@ private static bool HasVariable(Expression exp, Dictionary has
else if (exp is BinOpExpression) {
var binExp = (BinOpExpression)exp;
ret = HasVariable(binExp.Left, hasVar) || HasVariable(binExp.Right, hasVar);
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
ret = HasVariable(((UnaryOpExpression)exp).Value, hasVar);
- }
- else
+ } else
throw new UnreachableException();
hasVar[exp] = ret;
}
@@ -86,8 +84,7 @@ private static Expression GenerateInverse(Expression exp, Expression var, Dictio
Value = result
};
exp = unaryOp.Value;
- }
- else if (exp is BinOpExpression) {
+ } else if (exp is BinOpExpression) {
var binOp = (BinOpExpression)exp;
bool leftHasVar = hasVar[binOp.Left];
Expression varExp = leftHasVar ? binOp.Left : binOp.Right;
@@ -108,8 +105,7 @@ private static Expression GenerateInverse(Expression exp, Expression var, Dictio
Left = result,
Right = constExp
};
- }
- else {
+ } else {
// k - v = r => v = k - r
result = new BinOpExpression {
Operation = BinOps.Sub,
@@ -117,9 +113,7 @@ private static Expression GenerateInverse(Expression exp, Expression var, Dictio
Right = result
};
}
- }
-
- else if (binOp.Operation == BinOps.Mul) {
+ } else if (binOp.Operation == BinOps.Mul) {
Debug.Assert(constExp is LiteralExpression);
uint val = ((LiteralExpression)constExp).Value;
val = MathsUtils.modInv(val);
@@ -128,9 +122,7 @@ private static Expression GenerateInverse(Expression exp, Expression var, Dictio
Left = result,
Right = (LiteralExpression)val
};
- }
-
- else if (binOp.Operation == BinOps.Xor)
+ } else if (binOp.Operation == BinOps.Xor)
result = new BinOpExpression {
Operation = BinOps.Xor,
Left = result,
diff --git a/Confuser.DynCipher/Generation/x86CodeGen.cs b/Confuser.DynCipher/Generation/x86CodeGen.cs
index f27f2838f..b82328208 100644
--- a/Confuser.DynCipher/Generation/x86CodeGen.cs
+++ b/Confuser.DynCipher/Generation/x86CodeGen.cs
@@ -27,8 +27,7 @@ public IList Instructions {
try {
return ((x86RegisterOperand)Emit(expression, loadArg)).Register;
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (ex.Message == "Register overflowed.")
return null;
throw;
diff --git a/Confuser.DynCipher/Properties/AssemblyInfo.cs b/Confuser.DynCipher/Properties/AssemblyInfo.cs
index 177421e23..de693e3c7 100644
--- a/Confuser.DynCipher/Properties/AssemblyInfo.cs
+++ b/Confuser.DynCipher/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Dynamic Cipher Library")]
[assembly: AssemblyDescription("Cipher generator of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.DynCipher/Transforms/ConvertVariables.cs b/Confuser.DynCipher/Transforms/ConvertVariables.cs
index a7ed83680..dd6c4d468 100644
--- a/Confuser.DynCipher/Transforms/ConvertVariables.cs
+++ b/Confuser.DynCipher/Transforms/ConvertVariables.cs
@@ -1,4 +1,5 @@
-using Confuser.DynCipher.AST;
+using System;
+using Confuser.DynCipher.AST;
namespace Confuser.DynCipher.Transforms {
internal class ConvertVariables {
@@ -12,12 +13,10 @@ private static Expression ReplaceVar(Expression exp, Variable buff) {
}
if (exp is ArrayIndexExpression) {
((ArrayIndexExpression)exp).Array = ReplaceVar(((ArrayIndexExpression)exp).Array, buff);
- }
- else if (exp is BinOpExpression) {
+ } else if (exp is BinOpExpression) {
((BinOpExpression)exp).Left = ReplaceVar(((BinOpExpression)exp).Left, buff);
((BinOpExpression)exp).Right = ReplaceVar(((BinOpExpression)exp).Right, buff);
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
((UnaryOpExpression)exp).Value = ReplaceVar(((UnaryOpExpression)exp).Value, buff);
}
return exp;
diff --git a/Confuser.DynCipher/Transforms/ExpansionTransform.cs b/Confuser.DynCipher/Transforms/ExpansionTransform.cs
index b5e59a438..6ccc8f3f2 100644
--- a/Confuser.DynCipher/Transforms/ExpansionTransform.cs
+++ b/Confuser.DynCipher/Transforms/ExpansionTransform.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using Confuser.DynCipher.AST;
namespace Confuser.DynCipher.Transforms {
diff --git a/Confuser.DynCipher/Transforms/MulToShiftTransform.cs b/Confuser.DynCipher/Transforms/MulToShiftTransform.cs
index 049898e69..55f195f93 100644
--- a/Confuser.DynCipher/Transforms/MulToShiftTransform.cs
+++ b/Confuser.DynCipher/Transforms/MulToShiftTransform.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.DynCipher.AST;
@@ -38,16 +39,13 @@ private static Expression ProcessExpression(Expression exp) {
x += i;
return x;
}
- }
- else {
+ } else {
binOp.Left = ProcessExpression(binOp.Left);
binOp.Right = ProcessExpression(binOp.Right);
}
- }
- else if (exp is ArrayIndexExpression) {
+ } else if (exp is ArrayIndexExpression) {
((ArrayIndexExpression)exp).Array = ProcessExpression(((ArrayIndexExpression)exp).Array);
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
((UnaryOpExpression)exp).Value = ProcessExpression(((UnaryOpExpression)exp).Value);
}
return exp;
diff --git a/Confuser.DynCipher/Transforms/NormalizeBinOpTransform.cs b/Confuser.DynCipher/Transforms/NormalizeBinOpTransform.cs
index 519539e9c..6270dd3c9 100644
--- a/Confuser.DynCipher/Transforms/NormalizeBinOpTransform.cs
+++ b/Confuser.DynCipher/Transforms/NormalizeBinOpTransform.cs
@@ -1,4 +1,5 @@
-using Confuser.DynCipher.AST;
+using System;
+using Confuser.DynCipher.AST;
namespace Confuser.DynCipher.Transforms {
internal class NormalizeBinOpTransform {
@@ -25,11 +26,9 @@ private static Expression ProcessExpression(Expression exp) {
if (binOp.Right is LiteralExpression && ((LiteralExpression)binOp.Right).Value == 0 &&
binOp.Operation == BinOps.Add) // x + 0 => x
return binOp.Left;
- }
- else if (exp is ArrayIndexExpression) {
+ } else if (exp is ArrayIndexExpression) {
((ArrayIndexExpression)exp).Array = ProcessExpression(((ArrayIndexExpression)exp).Array);
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
((UnaryOpExpression)exp).Value = ProcessExpression(((UnaryOpExpression)exp).Value);
}
return exp;
diff --git a/Confuser.DynCipher/Transforms/ShuffleTransform.cs b/Confuser.DynCipher/Transforms/ShuffleTransform.cs
index f12f951f4..0722a689c 100644
--- a/Confuser.DynCipher/Transforms/ShuffleTransform.cs
+++ b/Confuser.DynCipher/Transforms/ShuffleTransform.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core.Services;
using Confuser.DynCipher.AST;
@@ -13,13 +14,11 @@ private static IEnumerable GetVariableUsage(Expression exp) {
else if (exp is ArrayIndexExpression) {
foreach (Variable i in GetVariableUsage(((ArrayIndexExpression)exp).Array))
yield return i;
- }
- else if (exp is BinOpExpression) {
+ } else if (exp is BinOpExpression) {
foreach (Variable i in GetVariableUsage(((BinOpExpression)exp).Left)
.Concat(GetVariableUsage(((BinOpExpression)exp).Right)))
yield return i;
- }
- else if (exp is UnaryOpExpression) {
+ } else if (exp is UnaryOpExpression) {
foreach (Variable i in GetVariableUsage(((UnaryOpExpression)exp).Value))
yield return i;
}
diff --git a/Confuser.DynCipher/Utils.cs b/Confuser.DynCipher/Utils.cs
index 74577b95f..144a0e776 100644
--- a/Confuser.DynCipher/Utils.cs
+++ b/Confuser.DynCipher/Utils.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
using Confuser.DynCipher.Generation;
namespace Confuser.DynCipher {
diff --git a/Confuser.Protections/AntiDebugProtection.cs b/Confuser.Protections/AntiDebugProtection.cs
index 5becf455c..41cc3d724 100644
--- a/Confuser.Protections/AntiDebugProtection.cs
+++ b/Confuser.Protections/AntiDebugProtection.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core;
using Confuser.Core.Helpers;
@@ -109,8 +110,7 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
CustomAttribute ca = method.CustomAttributes.Find(attrName);
if (ca != null)
ca.Constructor = attr.FindMethod(".ctor");
- }
- else if (member is FieldDef) {
+ } else if (member is FieldDef) {
var field = (FieldDef)member;
if (field.Access == FieldAttributes.Public)
field.Access = FieldAttributes.Assembly;
diff --git a/Confuser.Protections/AntiDumpProtection.cs b/Confuser.Protections/AntiDumpProtection.cs
index eaf3710c2..fc3f065d5 100644
--- a/Confuser.Protections/AntiDumpProtection.cs
+++ b/Confuser.Protections/AntiDumpProtection.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core;
using Confuser.Core.Helpers;
diff --git a/Confuser.Protections/AntiILDasmProtection.cs b/Confuser.Protections/AntiILDasmProtection.cs
index dd270c44b..bc6ff6125 100644
--- a/Confuser.Protections/AntiILDasmProtection.cs
+++ b/Confuser.Protections/AntiILDasmProtection.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
diff --git a/Confuser.Protections/AntiTamper/IKeyDeriver.cs b/Confuser.Protections/AntiTamper/IKeyDeriver.cs
index ff5c2f41b..a89fb9592 100644
--- a/Confuser.Protections/AntiTamper/IKeyDeriver.cs
+++ b/Confuser.Protections/AntiTamper/IKeyDeriver.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using dnlib.DotNet;
diff --git a/Confuser.Protections/AntiTamper/IModeHandler.cs b/Confuser.Protections/AntiTamper/IModeHandler.cs
index 4ac034ea2..c7ccc660d 100644
--- a/Confuser.Protections/AntiTamper/IModeHandler.cs
+++ b/Confuser.Protections/AntiTamper/IModeHandler.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
namespace Confuser.Protections.AntiTamper {
internal interface IModeHandler {
diff --git a/Confuser.Protections/AntiTamper/JITBody.cs b/Confuser.Protections/AntiTamper/JITBody.cs
index 88018dbfe..701234fe3 100644
--- a/Confuser.Protections/AntiTamper/JITBody.cs
+++ b/Confuser.Protections/AntiTamper/JITBody.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -138,8 +139,7 @@ public void Write() {
if (body.Variables.Count > 0) {
var local = new LocalSig(body.Variables.Select(var => var.Type).ToList());
jitBody.LocalVars = SignatureWriter.Write(metadata, local);
- }
- else
+ } else
jitBody.LocalVars = new byte[0];
using (var ms = new MemoryStream()) {
@@ -171,8 +171,7 @@ public void Write() {
jitBody.Options |= 0x80;
jitBody.EHs[i].ClassTokenOrFilterOffset = token;
- }
- else if (eh.HandlerType == ExceptionHandlerType.Filter) {
+ } else if (eh.HandlerType == ExceptionHandlerType.Filter) {
jitBody.EHs[i].ClassTokenOrFilterOffset = GetOffset(eh.FilterStart);
}
}
diff --git a/Confuser.Protections/AntiTamper/NormalDeriver.cs b/Confuser.Protections/AntiTamper/NormalDeriver.cs
index e5a473854..52ac6629f 100644
--- a/Confuser.Protections/AntiTamper/NormalDeriver.cs
+++ b/Confuser.Protections/AntiTamper/NormalDeriver.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using dnlib.DotNet;
diff --git a/Confuser.Protections/AntiTamper/NormalMode.cs b/Confuser.Protections/AntiTamper/NormalMode.cs
index db23b704e..36198f85b 100644
--- a/Confuser.Protections/AntiTamper/NormalMode.cs
+++ b/Confuser.Protections/AntiTamper/NormalMode.cs
@@ -57,8 +57,7 @@ public void HandleInject(AntiTamperProtection parent, ConfuserContext context, P
Instruction instr = instrs[i];
if (instr.OpCode == OpCodes.Ldtoken) {
instr.Operand = context.CurrentModule.GlobalType;
- }
- else if (instr.OpCode == OpCodes.Call) {
+ } else if (instr.OpCode == OpCodes.Call) {
var method = (IMethod)instr.Operand;
if (method.DeclaringType.Name == "Mutation" &&
method.Name == "Crypt") {
@@ -100,8 +99,7 @@ private void OnWriterEvent(object sender, ModuleWriterListenerEventArgs e) {
var writer = (ModuleWriter)sender;
if (e.WriterEvent == ModuleWriterEvent.MDEndCreateTables) {
CreateSections(writer);
- }
- else if (e.WriterEvent == ModuleWriterEvent.BeginStrongNameSign) {
+ } else if (e.WriterEvent == ModuleWriterEvent.BeginStrongNameSign) {
EncryptSection(writer);
}
}
@@ -185,8 +183,7 @@ private void EncryptSection(ModuleWriter writer) {
if (nameHash == name1 * name2) {
encSize = reader.ReadUInt32();
encLoc = reader.ReadUInt32();
- }
- else if (nameHash != 0) {
+ } else if (nameHash != 0) {
uint sectSize = reader.ReadUInt32();
uint sectLoc = reader.ReadUInt32();
Hash(stream, reader, sectLoc, sectSize);
diff --git a/Confuser.Protections/Compress/IKeyDeriver.cs b/Confuser.Protections/Compress/IKeyDeriver.cs
index 68fb17938..5284205ce 100644
--- a/Confuser.Protections/Compress/IKeyDeriver.cs
+++ b/Confuser.Protections/Compress/IKeyDeriver.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using dnlib.DotNet;
diff --git a/Confuser.Protections/Compress/NormalDeriver.cs b/Confuser.Protections/Compress/NormalDeriver.cs
index 8a90dc9e3..19384972a 100644
--- a/Confuser.Protections/Compress/NormalDeriver.cs
+++ b/Confuser.Protections/Compress/NormalDeriver.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using dnlib.DotNet;
diff --git a/Confuser.Protections/Compress/StubProtection.cs b/Confuser.Protections/Compress/StubProtection.cs
index cdaaeb1f4..9cadee1f6 100644
--- a/Confuser.Protections/Compress/StubProtection.cs
+++ b/Confuser.Protections/Compress/StubProtection.cs
@@ -1,4 +1,5 @@
-using System.Diagnostics;
+using System;
+using System.Diagnostics;
using System.Security.Cryptography;
using Confuser.Core;
using dnlib.DotNet;
@@ -55,25 +56,25 @@ public override string Name {
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) {
context.CurrentModuleWriterListener.OnWriterEvent += (sender, e) => {
- if (e.WriterEvent == ModuleWriterEvent.MDBeginCreateTables) {
- // Add key signature
- var writer = (ModuleWriter)sender;
- var prot = (StubProtection)Parent;
- uint blob = writer.MetaData.BlobHeap.Add(prot.ctx.KeySig);
- uint rid = writer.MetaData.TablesHeap.StandAloneSigTable.Add(new RawStandAloneSigRow(blob));
- Debug.Assert((0x11000000 | rid) == prot.ctx.KeyToken);
+ if (e.WriterEvent == ModuleWriterEvent.MDBeginCreateTables) {
+ // Add key signature
+ var writer = (ModuleWriter)sender;
+ var prot = (StubProtection)Parent;
+ uint blob = writer.MetaData.BlobHeap.Add(prot.ctx.KeySig);
+ uint rid = writer.MetaData.TablesHeap.StandAloneSigTable.Add(new RawStandAloneSigRow(blob));
+ Debug.Assert((0x11000000 | rid) == prot.ctx.KeyToken);
- // Add File reference
- byte[] hash = SHA1.Create().ComputeHash(prot.ctx.OriginModule);
- uint hashBlob = writer.MetaData.BlobHeap.Add(hash);
+ // Add File reference
+ byte[] hash = SHA1.Create().ComputeHash(prot.ctx.OriginModule);
+ uint hashBlob = writer.MetaData.BlobHeap.Add(hash);
- MDTable fileTbl = writer.MetaData.TablesHeap.FileTable;
- uint fileRid = fileTbl.Add(new RawFileRow(
- (uint)FileAttributes.ContainsMetaData,
- writer.MetaData.StringsHeap.Add("koi"),
- hashBlob));
- }
- };
+ MDTable fileTbl = writer.MetaData.TablesHeap.FileTable;
+ uint fileRid = fileTbl.Add(new RawFileRow(
+ (uint)FileAttributes.ContainsMetaData,
+ writer.MetaData.StringsHeap.Add("koi"),
+ hashBlob));
+ }
+ };
}
}
}
diff --git a/Confuser.Protections/Constants/CEContext.cs b/Confuser.Protections/Constants/CEContext.cs
index 842c91993..edff38859 100644
--- a/Confuser.Protections/Constants/CEContext.cs
+++ b/Confuser.Protections/Constants/CEContext.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using Confuser.DynCipher;
diff --git a/Confuser.Protections/Constants/ConstantProtection.cs b/Confuser.Protections/Constants/ConstantProtection.cs
index 8350ef8ad..7a1fb5c1a 100644
--- a/Confuser.Protections/Constants/ConstantProtection.cs
+++ b/Confuser.Protections/Constants/ConstantProtection.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Protections.Constants;
using dnlib.DotNet;
diff --git a/Confuser.Protections/Constants/DynamicMode.cs b/Confuser.Protections/Constants/DynamicMode.cs
index 888e05716..495469b56 100644
--- a/Confuser.Protections/Constants/DynamicMode.cs
+++ b/Confuser.Protections/Constants/DynamicMode.cs
@@ -43,14 +43,14 @@ public object CreateDecoder(MethodDef decoder, CEContext ctx) {
uint k1 = ctx.Random.NextUInt32() | 1;
uint k2 = ctx.Random.NextUInt32();
MutationHelper.ReplacePlaceholder(decoder, arg => {
- var repl = new List();
- repl.AddRange(arg);
- repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)MathsUtils.modInv(k1)));
- repl.Add(Instruction.Create(OpCodes.Mul));
- repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)k2));
- repl.Add(Instruction.Create(OpCodes.Xor));
- return repl.ToArray();
- });
+ var repl = new List();
+ repl.AddRange(arg);
+ repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)MathsUtils.modInv(k1)));
+ repl.Add(Instruction.Create(OpCodes.Mul));
+ repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)k2));
+ repl.Add(Instruction.Create(OpCodes.Xor));
+ return repl.ToArray();
+ });
return Tuple.Create(k1, k2);
}
diff --git a/Confuser.Protections/Constants/EncodePhase.cs b/Confuser.Protections/Constants/EncodePhase.cs
index ca704fe29..3493e0783 100644
--- a/Confuser.Protections/Constants/EncodePhase.cs
+++ b/Confuser.Protections/Constants/EncodePhase.cs
@@ -45,24 +45,19 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
foreach (var entry in ldc.WithProgress(context.Logger)) {
if (entry.Key is string) {
EncodeString(moduleCtx, (string)entry.Key, entry.Value);
- }
- else if (entry.Key is int) {
+ } else if (entry.Key is int) {
EncodeConstant32(moduleCtx, (uint)(int)entry.Key, context.CurrentModule.CorLibTypes.Int32, entry.Value);
- }
- else if (entry.Key is long) {
+ } else if (entry.Key is long) {
EncodeConstant64(moduleCtx, (uint)((long)entry.Key >> 32), (uint)(long)entry.Key, context.CurrentModule.CorLibTypes.Int64, entry.Value);
- }
- else if (entry.Key is float) {
+ } else if (entry.Key is float) {
var t = new RTransform();
t.R4 = (float)entry.Key;
EncodeConstant32(moduleCtx, t.Hi, context.CurrentModule.CorLibTypes.Single, entry.Value);
- }
- else if (entry.Key is double) {
+ } else if (entry.Key is double) {
var t = new RTransform();
t.R8 = (double)entry.Key;
EncodeConstant64(moduleCtx, t.Hi, t.Lo, context.CurrentModule.CorLibTypes.Double, entry.Value);
- }
- else
+ } else
throw new UnreachableException();
context.CheckCancellation();
}
@@ -115,14 +110,14 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
new[] { 0, 1 },
new[] { encryptedBuffer.Length / 4, (int)keySeed });
MutationHelper.ReplacePlaceholder(moduleCtx.InitMethod, arg => {
- var repl = new List();
- repl.AddRange(arg);
- repl.Add(Instruction.Create(OpCodes.Dup));
- repl.Add(Instruction.Create(OpCodes.Ldtoken, moduleCtx.DataField));
- repl.Add(Instruction.Create(OpCodes.Call, moduleCtx.Module.Import(
- typeof (RuntimeHelpers).GetMethod("InitializeArray"))));
- return repl.ToArray();
- });
+ var repl = new List();
+ repl.AddRange(arg);
+ repl.Add(Instruction.Create(OpCodes.Dup));
+ repl.Add(Instruction.Create(OpCodes.Ldtoken, moduleCtx.DataField));
+ repl.Add(Instruction.Create(OpCodes.Call, moduleCtx.Module.Import(
+ typeof (RuntimeHelpers).GetMethod("InitializeArray"))));
+ return repl.ToArray();
+ });
}
private void EncodeString(CEContext moduleCtx, string value, List> references) {
@@ -257,8 +252,7 @@ private void ExtractConstants(
if (string.IsNullOrEmpty(operand) && (moduleCtx.Elements & EncodeElements.Primitive) == 0)
continue;
eligible = true;
- }
- else if (instr.OpCode == OpCodes.Call && (moduleCtx.Elements & EncodeElements.Initializers) != 0) {
+ } else if (instr.OpCode == OpCodes.Call && (moduleCtx.Elements & EncodeElements.Initializers) != 0) {
var operand = (IMethod)instr.Operand;
if (operand.DeclaringType.DefinitionAssembly.IsCorLib() &&
operand.DeclaringType.Namespace == "System.Runtime.CompilerServices" &&
@@ -295,27 +289,23 @@ private void ExtractConstants(
Buffer.BlockCopy(dataField.InitialValue, 0, value, 4, dataField.InitialValue.Length);
ldInit.AddListEntry(value, Tuple.Create(method, instr));
}
- }
- else if ((moduleCtx.Elements & EncodeElements.Numbers) != 0) {
+ } else if ((moduleCtx.Elements & EncodeElements.Numbers) != 0) {
if (instr.OpCode == OpCodes.Ldc_I4) {
var operand = (int)instr.Operand;
if ((operand >= -1 && operand <= 8) && (moduleCtx.Elements & EncodeElements.Primitive) == 0)
continue;
eligible = true;
- }
- else if (instr.OpCode == OpCodes.Ldc_I8) {
+ } else if (instr.OpCode == OpCodes.Ldc_I8) {
var operand = (long)instr.Operand;
if ((operand >= -1 && operand <= 1) && (moduleCtx.Elements & EncodeElements.Primitive) == 0)
continue;
eligible = true;
- }
- else if (instr.OpCode == OpCodes.Ldc_R4) {
+ } else if (instr.OpCode == OpCodes.Ldc_R4) {
var operand = (float)instr.Operand;
if ((operand == -1 || operand == 0 || operand == 1) && (moduleCtx.Elements & EncodeElements.Primitive) == 0)
continue;
eligible = true;
- }
- else if (instr.OpCode == OpCodes.Ldc_R8) {
+ } else if (instr.OpCode == OpCodes.Ldc_R8) {
var operand = (double)instr.Operand;
if ((operand == -1 || operand == 0 || operand == 1) && (moduleCtx.Elements & EncodeElements.Primitive) == 0)
continue;
diff --git a/Confuser.Protections/Constants/IEncodeMode.cs b/Confuser.Protections/Constants/IEncodeMode.cs
index deacc9547..9df0aa6e7 100644
--- a/Confuser.Protections/Constants/IEncodeMode.cs
+++ b/Confuser.Protections/Constants/IEncodeMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
diff --git a/Confuser.Protections/Constants/InjectPhase.cs b/Confuser.Protections/Constants/InjectPhase.cs
index 11b0fada3..8ad5785ca 100644
--- a/Confuser.Protections/Constants/InjectPhase.cs
+++ b/Confuser.Protections/Constants/InjectPhase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Confuser.Core;
@@ -8,6 +9,7 @@
using Confuser.Renamer;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
+using dnlib.DotNet.MD;
namespace Confuser.Protections.Constants {
internal class InjectPhase : ProtectionPhase {
@@ -50,8 +52,8 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
break;
case Mode.x86:
moduleCtx.ModeHandler = new x86Mode();
- if ((context.CurrentModule.Cor20HeaderFlags & dnlib.DotNet.MD.ComImageFlags.ILOnly) != 0)
- context.CurrentModuleWriterOptions.Cor20HeaderOptions.Flags &= ~dnlib.DotNet.MD.ComImageFlags.ILOnly;
+ if ((context.CurrentModule.Cor20HeaderFlags & ComImageFlags.ILOnly) != 0)
+ context.CurrentModuleWriterOptions.Cor20HeaderOptions.Flags &= ~ComImageFlags.ILOnly;
break;
default:
throw new UnreachableException();
@@ -59,10 +61,10 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
// Inject helpers
MethodDef decomp = compression.GetRuntimeDecompressor(context.CurrentModule, member => {
- name.MarkHelper(member, marker);
- if (member is MethodDef)
- ProtectionParameters.GetParameters(context, member).Remove(Parent);
- });
+ name.MarkHelper(member, marker);
+ if (member is MethodDef)
+ ProtectionParameters.GetParameters(context, member).Remove(Parent);
+ });
InjectHelpers(context, compression, rt, moduleCtx);
// Mutate codes
@@ -117,9 +119,8 @@ private void InjectHelpers(ConfuserContext context, ICompressionService compress
method.DeclaringType.Name == "Mutation" &&
method.Name == "Value") {
decoderInst.Body.Instructions[j] = Instruction.Create(OpCodes.Sizeof, new GenericMVar(0).ToTypeDefOrRef());
- }
- else if (instr.OpCode == OpCodes.Ldsfld &&
- method.DeclaringType.Name == "Constant") {
+ } else if (instr.OpCode == OpCodes.Ldsfld &&
+ method.DeclaringType.Name == "Constant") {
if (field.Name == "b") instr.Operand = moduleCtx.BufferField;
else throw new UnreachableException();
}
@@ -160,9 +161,8 @@ private void MutateInitializer(CEContext moduleCtx, MethodDef decomp) {
instrs.RemoveAt(i - 1);
instrs.RemoveAt(i - 2);
instrs.InsertRange(i - 2, moduleCtx.ModeHandler.EmitDecrypt(moduleCtx.InitMethod, moduleCtx, (Local)ldBlock.Operand, (Local)ldKey.Operand));
- }
- else if (method.DeclaringType.Name == "Lzma" &&
- method.Name == "Decompress") {
+ } else if (method.DeclaringType.Name == "Lzma" &&
+ method.Name == "Decompress") {
instr.Operand = decomp;
}
}
diff --git a/Confuser.Protections/Constants/Mode.cs b/Confuser.Protections/Constants/Mode.cs
index 1fd250fc1..29cacb71f 100644
--- a/Confuser.Protections/Constants/Mode.cs
+++ b/Confuser.Protections/Constants/Mode.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Protections.Constants {
+using System;
+
+namespace Confuser.Protections.Constants {
internal enum Mode {
Normal,
Dynamic,
diff --git a/Confuser.Protections/Constants/NormalMode.cs b/Confuser.Protections/Constants/NormalMode.cs
index b8a90adae..cc4d8e6d4 100644
--- a/Confuser.Protections/Constants/NormalMode.cs
+++ b/Confuser.Protections/Constants/NormalMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using Confuser.Core;
using Confuser.Core.Helpers;
@@ -34,14 +35,14 @@ public object CreateDecoder(MethodDef decoder, CEContext ctx) {
uint k1 = ctx.Random.NextUInt32() | 1;
uint k2 = ctx.Random.NextUInt32();
MutationHelper.ReplacePlaceholder(decoder, arg => {
- var repl = new List();
- repl.AddRange(arg);
- repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)MathsUtils.modInv(k1)));
- repl.Add(Instruction.Create(OpCodes.Mul));
- repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)k2));
- repl.Add(Instruction.Create(OpCodes.Xor));
- return repl.ToArray();
- });
+ var repl = new List();
+ repl.AddRange(arg);
+ repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)MathsUtils.modInv(k1)));
+ repl.Add(Instruction.Create(OpCodes.Mul));
+ repl.Add(Instruction.Create(OpCodes.Ldc_I4, (int)k2));
+ repl.Add(Instruction.Create(OpCodes.Xor));
+ return repl.ToArray();
+ });
return Tuple.Create(k1, k2);
}
diff --git a/Confuser.Protections/Constants/x86Mode.cs b/Confuser.Protections/Constants/x86Mode.cs
index b02348d95..b3d56dd77 100644
--- a/Confuser.Protections/Constants/x86Mode.cs
+++ b/Confuser.Protections/Constants/x86Mode.cs
@@ -44,11 +44,11 @@ public object CreateDecoder(MethodDef decoder, CEContext ctx) {
var encoding = new x86Encoding();
encoding.Compile(ctx);
MutationHelper.ReplacePlaceholder(decoder, arg => {
- var repl = new List();
- repl.AddRange(arg);
- repl.Add(Instruction.Create(OpCodes.Call, encoding.native));
- return repl.ToArray();
- });
+ var repl = new List();
+ repl.AddRange(arg);
+ repl.Add(Instruction.Create(OpCodes.Call, encoding.native));
+ return repl.ToArray();
+ });
return encoding;
}
@@ -125,8 +125,7 @@ private void InjectNativeCode(object sender, ModuleWriterListenerEventArgs e) {
var writer = (ModuleWriter)sender;
if (e.WriterEvent == ModuleWriterEvent.MDEndWriteMethodBodies) {
codeChunk = writer.MethodBodies.Add(new MethodBody(code));
- }
- else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
+ } else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
uint rid = writer.MetaData.GetRid(native);
writer.MetaData.TablesHeap.MethodTable[rid].RVA = (uint)codeChunk.RVA;
}
diff --git a/Confuser.Protections/ControlFlow/BlockParser.cs b/Confuser.Protections/ControlFlow/BlockParser.cs
index 772a620ff..fbbdd98f1 100644
--- a/Confuser.Protections/ControlFlow/BlockParser.cs
+++ b/Confuser.Protections/ControlFlow/BlockParser.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Confuser.Core;
@@ -23,8 +24,7 @@ public static ScopeBlock ParseBody(CilBody body) {
if (eh.FilterStart != null) {
var filterBlock = new ScopeBlock(BlockType.Filter, eh);
ehScopes[eh] = Tuple.Create(tryBlock, handlerBlock, filterBlock);
- }
- else
+ } else
ehScopes[eh] = Tuple.Create(tryBlock, handlerBlock, (ScopeBlock)null);
}
diff --git a/Confuser.Protections/ControlFlow/Blocks.cs b/Confuser.Protections/ControlFlow/Blocks.cs
index 847d13489..4819433f2 100644
--- a/Confuser.Protections/ControlFlow/Blocks.cs
+++ b/Confuser.Protections/ControlFlow/Blocks.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
using dnlib.DotNet.Emit;
@@ -71,11 +72,9 @@ public override void ToBody(CilBody body) {
if (Type == BlockType.Try) {
Handler.TryStart = GetFirstInstr();
Handler.TryEnd = GetLastInstr();
- }
- else if (Type == BlockType.Filter) {
+ } else if (Type == BlockType.Filter) {
Handler.FilterStart = GetFirstInstr();
- }
- else {
+ } else {
Handler.HandlerStart = GetFirstInstr();
Handler.HandlerEnd = GetLastInstr();
}
diff --git a/Confuser.Protections/ControlFlow/CFContext.cs b/Confuser.Protections/ControlFlow/CFContext.cs
index 1f92335e5..31fa5b2a4 100644
--- a/Confuser.Protections/ControlFlow/CFContext.cs
+++ b/Confuser.Protections/ControlFlow/CFContext.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using Confuser.DynCipher;
diff --git a/Confuser.Protections/ControlFlow/ControlFlowPhase.cs b/Confuser.Protections/ControlFlow/ControlFlowPhase.cs
index 141f79a88..3e6458a0c 100644
--- a/Confuser.Protections/ControlFlow/ControlFlowPhase.cs
+++ b/Confuser.Protections/ControlFlow/ControlFlowPhase.cs
@@ -1,4 +1,5 @@
-using System.Diagnostics;
+using System;
+using System.Diagnostics;
using System.Linq;
using Confuser.Core;
using Confuser.Core.Services;
diff --git a/Confuser.Protections/ControlFlow/ControlFlowProtection.cs b/Confuser.Protections/ControlFlow/ControlFlowProtection.cs
index b7408b28c..bba86c2df 100644
--- a/Confuser.Protections/ControlFlow/ControlFlowProtection.cs
+++ b/Confuser.Protections/ControlFlow/ControlFlowProtection.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Protections.ControlFlow;
using dnlib.DotNet;
diff --git a/Confuser.Protections/ControlFlow/IPredicate.cs b/Confuser.Protections/ControlFlow/IPredicate.cs
index 42bc2d8dc..4dc1152fe 100644
--- a/Confuser.Protections/ControlFlow/IPredicate.cs
+++ b/Confuser.Protections/ControlFlow/IPredicate.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet.Emit;
namespace Confuser.Protections.ControlFlow {
diff --git a/Confuser.Protections/ControlFlow/JumpMangler.cs b/Confuser.Protections/ControlFlow/JumpMangler.cs
index 28e9901e8..a01b106b7 100644
--- a/Confuser.Protections/ControlFlow/JumpMangler.cs
+++ b/Confuser.Protections/ControlFlow/JumpMangler.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using dnlib.DotNet.Emit;
diff --git a/Confuser.Protections/ControlFlow/ManglerBase.cs b/Confuser.Protections/ControlFlow/ManglerBase.cs
index e7193545e..8e42e29f3 100644
--- a/Confuser.Protections/ControlFlow/ManglerBase.cs
+++ b/Confuser.Protections/ControlFlow/ManglerBase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet.Emit;
namespace Confuser.Protections.ControlFlow {
diff --git a/Confuser.Protections/ControlFlow/SwitchMangler.cs b/Confuser.Protections/ControlFlow/SwitchMangler.cs
index 04c5f309e..c972a7e0b 100644
--- a/Confuser.Protections/ControlFlow/SwitchMangler.cs
+++ b/Confuser.Protections/ControlFlow/SwitchMangler.cs
@@ -109,8 +109,7 @@ public override void Mangle(CilBody body, ScopeBlock root, CFContext ctx) {
predicate.Init(body);
switchHdr.Add(Instruction.CreateLdcI4(predicate.GetSwitchKey(key[1])));
predicate.EmitSwitchLoad(switchHdr);
- }
- else {
+ } else {
switchHdr.Add(Instruction.CreateLdcI4(key[1]));
}
@@ -143,9 +142,7 @@ public override void Mangle(CilBody body, ScopeBlock root, CFContext ctx) {
operands[key[i]] = newStatement[0];
converted = true;
}
- }
-
- else if (newStatement.Last().IsConditionalBranch()) {
+ } else if (newStatement.Last().IsConditionalBranch()) {
// Conditional
var target = (Instruction)newStatement.Last().Operand;
@@ -189,8 +186,7 @@ public override void Mangle(CilBody body, ScopeBlock root, CFContext ctx) {
ctx.AddJunk(newStatement);
operands[key[i]] = newStatement[0];
}
- }
- else
+ } else
operands[key[i]] = switchHdr[0];
current.Value = newStatement.ToArray();
diff --git a/Confuser.Protections/ControlFlow/x86Predicate.cs b/Confuser.Protections/ControlFlow/x86Predicate.cs
index c7166dbd6..796403353 100644
--- a/Confuser.Protections/ControlFlow/x86Predicate.cs
+++ b/Confuser.Protections/ControlFlow/x86Predicate.cs
@@ -95,8 +95,7 @@ private void InjectNativeCode(object sender, ModuleWriterListenerEventArgs e) {
var writer = (ModuleWriter)sender;
if (e.WriterEvent == ModuleWriterEvent.MDEndWriteMethodBodies) {
codeChunk = writer.MethodBodies.Add(new MethodBody(code));
- }
- else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
+ } else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
uint rid = writer.MetaData.GetRid(native);
writer.MetaData.TablesHeap.MethodTable[rid].RVA = (uint)codeChunk.RVA;
}
diff --git a/Confuser.Protections/InvalidMetadataProtection.cs b/Confuser.Protections/InvalidMetadataProtection.cs
index 5182ab31e..e96d0dbd1 100644
--- a/Confuser.Protections/InvalidMetadataProtection.cs
+++ b/Confuser.Protections/InvalidMetadataProtection.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using Confuser.Core;
@@ -118,8 +119,7 @@ private void OnWriterEvent(object sender, ModuleWriterListenerEventArgs e) {
writer.Options.MetaDataOptions.OtherHeapsEnd.Add(new RawHeap("#Strings", new byte[1]));
writer.Options.MetaDataOptions.OtherHeapsEnd.Add(new RawHeap("#Blob", new byte[1]));
writer.Options.MetaDataOptions.OtherHeapsEnd.Add(new RawHeap("#Schema", new byte[1]));
- }
- else if (e.WriterEvent == ModuleWriterEvent.MDOnAllTablesSorted) {
+ } else if (e.WriterEvent == ModuleWriterEvent.MDOnAllTablesSorted) {
writer.MetaData.TablesHeap.DeclSecurityTable.Add(new RawDeclSecurityRow(
unchecked(0x7fff), 0xffff7fff, 0xffff7fff));
/*
diff --git a/Confuser.Protections/Properties/AssemblyInfo.cs b/Confuser.Protections/Properties/AssemblyInfo.cs
index 84a665c17..142f8fe3a 100644
--- a/Confuser.Protections/Properties/AssemblyInfo.cs
+++ b/Confuser.Protections/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Protections")]
[assembly: AssemblyDescription("Protections and packers of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.Protections/ReferenceProxy/ExpressionEncoding.cs b/Confuser.Protections/ReferenceProxy/ExpressionEncoding.cs
index c77a8db24..96f15fba8 100644
--- a/Confuser.Protections/ReferenceProxy/ExpressionEncoding.cs
+++ b/Confuser.Protections/ReferenceProxy/ExpressionEncoding.cs
@@ -62,8 +62,7 @@ protected override void LoadVar(Variable var) {
if (var.Name == "{RESULT}") {
foreach (Instruction instr in arg)
base.Emit(instr);
- }
- else
+ } else
base.LoadVar(var);
}
}
diff --git a/Confuser.Protections/ReferenceProxy/IRPEncoding.cs b/Confuser.Protections/ReferenceProxy/IRPEncoding.cs
index dda1bf59f..0c16e6270 100644
--- a/Confuser.Protections/ReferenceProxy/IRPEncoding.cs
+++ b/Confuser.Protections/ReferenceProxy/IRPEncoding.cs
@@ -1,4 +1,5 @@
-using dnlib.DotNet;
+using System;
+using dnlib.DotNet;
using dnlib.DotNet.Emit;
namespace Confuser.Protections.ReferenceProxy {
diff --git a/Confuser.Protections/ReferenceProxy/MildMode.cs b/Confuser.Protections/ReferenceProxy/MildMode.cs
index 4b3f57c59..4d28366d1 100644
--- a/Confuser.Protections/ReferenceProxy/MildMode.cs
+++ b/Confuser.Protections/ReferenceProxy/MildMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
@@ -60,8 +61,7 @@ public override void ProcessCall(RPContext ctx, int instrIndex) {
proxy.Name,
proxy.MethodSig,
new GenericInstSig((ClassOrValueTypeSig)ctx.Method.DeclaringType.ToTypeSig(), genArgs).ToTypeDefOrRef());
- }
- else
+ } else
invoke.Operand = proxy;
}
diff --git a/Confuser.Protections/ReferenceProxy/NormalEncoding.cs b/Confuser.Protections/ReferenceProxy/NormalEncoding.cs
index 57a7834ac..ab984ba95 100644
--- a/Confuser.Protections/ReferenceProxy/NormalEncoding.cs
+++ b/Confuser.Protections/ReferenceProxy/NormalEncoding.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using Confuser.DynCipher;
@@ -15,8 +16,7 @@ public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg
if (ctx.Random.NextBoolean()) {
ret.Add(Instruction.Create(OpCodes.Ldc_I4, key.Item1));
ret.AddRange(arg);
- }
- else {
+ } else {
ret.AddRange(arg);
ret.Add(Instruction.Create(OpCodes.Ldc_I4, key.Item1));
}
diff --git a/Confuser.Protections/ReferenceProxy/RPContext.cs b/Confuser.Protections/ReferenceProxy/RPContext.cs
index 77ae8d770..a7f88d45a 100644
--- a/Confuser.Protections/ReferenceProxy/RPContext.cs
+++ b/Confuser.Protections/ReferenceProxy/RPContext.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using Confuser.Core.Services;
using Confuser.DynCipher;
diff --git a/Confuser.Protections/ReferenceProxy/RPMode.cs b/Confuser.Protections/ReferenceProxy/RPMode.cs
index 1879b44ad..8a80cb8dd 100644
--- a/Confuser.Protections/ReferenceProxy/RPMode.cs
+++ b/Confuser.Protections/ReferenceProxy/RPMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Confuser.Core;
@@ -24,10 +25,10 @@ protected static MethodSig CreateProxySignature(RPContext ctx, IMethod method, b
Debug.Assert(method.MethodSig.HasThis);
Debug.Assert(method.Name == ".ctor");
TypeSig[] paramTypes = method.MethodSig.Params.Select(type => {
- if (ctx.TypeErasure && type.IsClassSig && method.MethodSig.HasThis)
- return module.CorLibTypes.Object;
- return type;
- }).ToArray();
+ if (ctx.TypeErasure && type.IsClassSig && method.MethodSig.HasThis)
+ return module.CorLibTypes.Object;
+ return type;
+ }).ToArray();
TypeSig retType;
if (ctx.TypeErasure) // newobj will not be used with value types
@@ -37,13 +38,12 @@ protected static MethodSig CreateProxySignature(RPContext ctx, IMethod method, b
retType = Import(ctx, declType).ToTypeSig();
}
return MethodSig.CreateStatic(retType, paramTypes);
- }
- else {
+ } else {
IEnumerable paramTypes = method.MethodSig.Params.Select(type => {
- if (ctx.TypeErasure && type.IsClassSig && method.MethodSig.HasThis)
- return module.CorLibTypes.Object;
- return type;
- });
+ if (ctx.TypeErasure && type.IsClassSig && method.MethodSig.HasThis)
+ return module.CorLibTypes.Object;
+ return type;
+ });
if (method.MethodSig.HasThis && !method.MethodSig.ExplicitThis) {
TypeDef declType = method.DeclaringType.ResolveTypeDefThrow();
if (ctx.TypeErasure && !declType.IsValueType)
diff --git a/Confuser.Protections/ReferenceProxy/ReferenceProxyPhase.cs b/Confuser.Protections/ReferenceProxy/ReferenceProxyPhase.cs
index 0c13f3980..6e0435b94 100644
--- a/Confuser.Protections/ReferenceProxy/ReferenceProxyPhase.cs
+++ b/Confuser.Protections/ReferenceProxy/ReferenceProxyPhase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core;
using Confuser.Core.Services;
@@ -6,6 +7,7 @@
using Confuser.Renamer;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
+using dnlib.DotNet.MD;
namespace Confuser.Protections.ReferenceProxy {
internal class ReferenceProxyPhase : ProtectionPhase {
@@ -67,10 +69,10 @@ private static RPContext ParseParameters(MethodDef method, ConfuserContext conte
break;
case EncodingType.x86:
ret.EncodingHandler = store.x86 ?? (store.x86 = new x86Encoding());
-
- if ((context.CurrentModule.Cor20HeaderFlags & dnlib.DotNet.MD.ComImageFlags.ILOnly) != 0)
- context.CurrentModuleWriterOptions.Cor20HeaderOptions.Flags &= ~dnlib.DotNet.MD.ComImageFlags.ILOnly;
- break;
+
+ if ((context.CurrentModule.Cor20HeaderFlags & ComImageFlags.ILOnly) != 0)
+ context.CurrentModuleWriterOptions.Cor20HeaderOptions.Flags &= ~ComImageFlags.ILOnly;
+ break;
default:
throw new UnreachableException();
}
diff --git a/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs b/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs
index b40618805..3a411ff66 100644
--- a/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs
+++ b/Confuser.Protections/ReferenceProxy/ReferenceProxyProtection.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Protections.ReferenceProxy;
using dnlib.DotNet;
diff --git a/Confuser.Protections/ReferenceProxy/StrongMode.cs b/Confuser.Protections/ReferenceProxy/StrongMode.cs
index 5b8394ea7..ca211ec1a 100644
--- a/Confuser.Protections/ReferenceProxy/StrongMode.cs
+++ b/Confuser.Protections/ReferenceProxy/StrongMode.cs
@@ -78,8 +78,7 @@ public override void ProcessCall(RPContext ctx, int instrIndex) {
if (fallBack) {
ProcessBridge(ctx, instrIndex);
- }
- else {
+ } else {
ProcessInvoke(ctx, instrIndex, begin.Value);
}
}
@@ -102,8 +101,7 @@ private void ProcessBridge(RPContext ctx, int instrIndex) {
instr.Operand = proxy.Item2;
return;
}
- }
- else
+ } else
proxy = new Tuple(null, null);
MethodSig sig = CreateProxySignature(ctx, target, instr.OpCode.Code == Code.Newobj);
@@ -145,8 +143,7 @@ private void ProcessInvoke(RPContext ctx, int instrIndex, int argBeginIndex) {
new Instruction(OpCodes.Call, delegateType.FindMethod("Invoke")));
instr.OpCode = OpCodes.Ldsfld;
instr.Operand = proxy.Item1;
- }
- else {
+ } else {
Instruction argBegin = ctx.Body.Instructions[argBeginIndex];
ctx.Body.Instructions.Insert(argBeginIndex + 1,
new Instruction(argBegin.OpCode, argBegin.Operand));
@@ -223,10 +220,10 @@ private TypeDef GetKeyAttr(RPContext ctx) {
MethodDef ctor = injectedAttr.FindMethod(".ctor");
MutationHelper.ReplacePlaceholder(ctor, arg => {
- var invCompiled = new List();
- new CodeGen(arg, ctor, invCompiled).GenerateCIL(inverse);
- return invCompiled.ToArray();
- });
+ var invCompiled = new List();
+ new CodeGen(arg, ctor, invCompiled).GenerateCIL(inverse);
+ return invCompiled.ToArray();
+ });
keyAttrs[index] = Tuple.Create(injectedAttr, expCompiled);
ctx.Module.AddAsNonNestedType(injectedAttr);
@@ -235,8 +232,7 @@ private TypeDef GetKeyAttr(RPContext ctx) {
if (def.Name == "GetHashCode") {
ctx.Name.MarkHelper(def, ctx.Marker);
((MethodDef)def).Access = MethodAttributes.Public;
- }
- else
+ } else
ctx.Name.MarkHelper(def, ctx.Marker);
}
}
@@ -385,8 +381,7 @@ protected override void LoadVar(Variable var) {
if (var.Name == "{RESULT}") {
foreach (Instruction instr in arg)
base.Emit(instr);
- }
- else
+ } else
base.LoadVar(var);
}
}
diff --git a/Confuser.Protections/ReferenceProxy/x86Encoding.cs b/Confuser.Protections/ReferenceProxy/x86Encoding.cs
index 6de614bee..aebd700c6 100644
--- a/Confuser.Protections/ReferenceProxy/x86Encoding.cs
+++ b/Confuser.Protections/ReferenceProxy/x86Encoding.cs
@@ -73,8 +73,7 @@ private void InjectNativeCode(object sender, ModuleWriterListenerEventArgs e) {
if (e.WriterEvent == ModuleWriterEvent.MDEndWriteMethodBodies) {
foreach (var native in nativeCodes)
native.Item3 = writer.MethodBodies.Add(new MethodBody(native.Item2));
- }
- else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
+ } else if (e.WriterEvent == ModuleWriterEvent.EndCalculateRvasAndFileOffsets) {
foreach (var native in nativeCodes) {
uint rid = writer.MetaData.GetRid(native.Item1);
writer.MetaData.TablesHeap.MethodTable[rid].RVA = (uint)native.Item3.RVA;
@@ -105,8 +104,7 @@ protected override void LoadVar(Variable var) {
if (var.Name == "{RESULT}") {
foreach (Instruction instr in arg)
base.Emit(instr);
- }
- else
+ } else
base.LoadVar(var);
}
}
diff --git a/Confuser.Protections/Resources/IEncodeMode.cs b/Confuser.Protections/Resources/IEncodeMode.cs
index 883cdaebb..5fd04c23f 100644
--- a/Confuser.Protections/Resources/IEncodeMode.cs
+++ b/Confuser.Protections/Resources/IEncodeMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
diff --git a/Confuser.Protections/Resources/InjectPhase.cs b/Confuser.Protections/Resources/InjectPhase.cs
index f4e1bc788..b30cf8439 100644
--- a/Confuser.Protections/Resources/InjectPhase.cs
+++ b/Confuser.Protections/Resources/InjectPhase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
@@ -54,10 +55,10 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
// Inject helpers
MethodDef decomp = compression.GetRuntimeDecompressor(context.CurrentModule, member => {
- name.MarkHelper(member, marker);
- if (member is MethodDef)
- ProtectionParameters.GetParameters(context, member).Remove(Parent);
- });
+ name.MarkHelper(member, marker);
+ if (member is MethodDef)
+ ProtectionParameters.GetParameters(context, member).Remove(Parent);
+ });
InjectHelpers(context, compression, rt, moduleCtx);
// Mutate codes
@@ -113,9 +114,8 @@ private void MutateInitializer(REContext moduleCtx, MethodDef decomp) {
instrs.RemoveAt(i - 1);
instrs.RemoveAt(i - 2);
instrs.InsertRange(i - 2, moduleCtx.ModeHandler.EmitDecrypt(moduleCtx.InitMethod, moduleCtx, (Local)ldBlock.Operand, (Local)ldKey.Operand));
- }
- else if (method.DeclaringType.Name == "Lzma" &&
- method.Name == "Decompress") {
+ } else if (method.DeclaringType.Name == "Lzma" &&
+ method.Name == "Decompress") {
instr.Operand = decomp;
}
}
@@ -125,14 +125,14 @@ private void MutateInitializer(REContext moduleCtx, MethodDef decomp) {
moduleCtx.InitMethod.Body.Instructions.Add(instr);
MutationHelper.ReplacePlaceholder(moduleCtx.InitMethod, arg => {
- var repl = new List();
- repl.AddRange(arg);
- repl.Add(Instruction.Create(OpCodes.Dup));
- repl.Add(Instruction.Create(OpCodes.Ldtoken, moduleCtx.DataField));
- repl.Add(Instruction.Create(OpCodes.Call, moduleCtx.Module.Import(
- typeof (RuntimeHelpers).GetMethod("InitializeArray"))));
- return repl.ToArray();
- });
+ var repl = new List();
+ repl.AddRange(arg);
+ repl.Add(Instruction.Create(OpCodes.Dup));
+ repl.Add(Instruction.Create(OpCodes.Ldtoken, moduleCtx.DataField));
+ repl.Add(Instruction.Create(OpCodes.Call, moduleCtx.Module.Import(
+ typeof (RuntimeHelpers).GetMethod("InitializeArray"))));
+ return repl.ToArray();
+ });
moduleCtx.Context.Registry.GetService().ExcludeMethod(moduleCtx.Context, moduleCtx.InitMethod);
}
}
diff --git a/Confuser.Protections/Resources/Mode.cs b/Confuser.Protections/Resources/Mode.cs
index 22f60ae74..f32d31386 100644
--- a/Confuser.Protections/Resources/Mode.cs
+++ b/Confuser.Protections/Resources/Mode.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Protections.Resources {
+using System;
+
+namespace Confuser.Protections.Resources {
internal enum Mode {
Normal,
Dynamic
diff --git a/Confuser.Protections/Resources/NormalMode.cs b/Confuser.Protections/Resources/NormalMode.cs
index 99c1788c7..bd37689d3 100644
--- a/Confuser.Protections/Resources/NormalMode.cs
+++ b/Confuser.Protections/Resources/NormalMode.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
diff --git a/Confuser.Protections/Resources/REContext.cs b/Confuser.Protections/Resources/REContext.cs
index b411864a0..0166c8b38 100644
--- a/Confuser.Protections/Resources/REContext.cs
+++ b/Confuser.Protections/Resources/REContext.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Core.Services;
using Confuser.DynCipher;
using Confuser.Renamer;
diff --git a/Confuser.Protections/Resources/ResourceProtection.cs b/Confuser.Protections/Resources/ResourceProtection.cs
index 5015ab7a8..d9f4df57a 100644
--- a/Confuser.Protections/Resources/ResourceProtection.cs
+++ b/Confuser.Protections/Resources/ResourceProtection.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Protections.Resources;
namespace Confuser.Protections {
diff --git a/Confuser.Renamer/AnalyzePhase.cs b/Confuser.Renamer/AnalyzePhase.cs
index f2c396403..d05cee89b 100644
--- a/Confuser.Renamer/AnalyzePhase.cs
+++ b/Confuser.Renamer/AnalyzePhase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Confuser.Core;
using dnlib.DotNet;
@@ -35,8 +36,7 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
var module = (ModuleDef)def;
foreach (Resource res in module.Resources)
service.SetOriginalName(res, res.Name);
- }
- else
+ } else
service.SetOriginalName(def, def.Name);
if (def is TypeDef) {
@@ -68,7 +68,7 @@ internal void Analyze(NameService service, ConfuserContext context, ProtectionPa
else if (def is ModuleDef)
service.SetCanRename(def, false);
- if (!runAnalyzer || parameters.GetParameter(context, def, "forceRen", false))
+ if (!runAnalyzer || parameters.GetParameter(context, def, "forceRen", false))
return;
foreach (IRenamer renamer in service.Renamers)
@@ -76,18 +76,16 @@ internal void Analyze(NameService service, ConfuserContext context, ProtectionPa
}
private void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, TypeDef type) {
- if (type.IsVisibleOutside() && !parameters.GetParameter(context, type, "renPublic", false)) {
+ if (type.IsVisibleOutside() && !parameters.GetParameter(context, type, "renPublic", false)) {
service.SetCanRename(type, false);
- }
- else if (type.IsRuntimeSpecialName || type.IsSpecialName) {
+ } else if (type.IsRuntimeSpecialName || type.IsSpecialName) {
service.SetCanRename(type, false);
- }
- else if (type.FullName == "ConfusedByAttribute") {
+ } else if (type.FullName == "ConfusedByAttribute") {
// Courtesy
service.SetCanRename(type, false);
}
- if (parameters.GetParameter(context, type, "forceRen", false))
+ if (parameters.GetParameter(context, type, "forceRen", false))
return;
if (type.InheritsFromCorlib("System.Attribute")) {
@@ -97,14 +95,14 @@ private void Analyze(NameService service, ConfuserContext context, ProtectionPar
private void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, MethodDef method) {
if (method.DeclaringType.IsVisibleOutside() &&
- (method.IsFamily || method.IsFamilyOrAssembly || method.IsPublic) &&
- !parameters.GetParameter(context, method, "renPublic", false))
+ (method.IsFamily || method.IsFamilyOrAssembly || method.IsPublic) &&
+ !parameters.GetParameter(context, method, "renPublic", false))
service.SetCanRename(method, false);
else if (method.IsRuntimeSpecialName || method.IsSpecialName)
service.SetCanRename(method, false);
- else if (parameters.GetParameter(context, method, "forceRen", false))
+ else if (parameters.GetParameter(context, method, "forceRen", false))
return;
else if (method.DeclaringType.IsComImport() && !method.HasAttribute("System.Runtime.InteropServices.DispIdAttribute"))
@@ -116,8 +114,8 @@ private void Analyze(NameService service, ConfuserContext context, ProtectionPar
private void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, FieldDef field) {
if (field.DeclaringType.IsVisibleOutside() &&
- (field.IsFamily || field.IsFamilyOrAssembly || field.IsPublic) &&
- !parameters.GetParameter(context, field, "renPublic", false))
+ (field.IsFamily || field.IsFamilyOrAssembly || field.IsPublic) &&
+ !parameters.GetParameter(context, field, "renPublic", false))
service.SetCanRename(field, false);
else if (field.IsRuntimeSpecialName || field.IsSpecialName)
@@ -126,13 +124,13 @@ private void Analyze(NameService service, ConfuserContext context, ProtectionPar
private void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, PropertyDef property) {
if (property.DeclaringType.IsVisibleOutside() &&
- !parameters.GetParameter(context, property, "renPublic", false))
+ !parameters.GetParameter(context, property, "renPublic", false))
service.SetCanRename(property, false);
else if (property.IsRuntimeSpecialName || property.IsSpecialName)
service.SetCanRename(property, false);
- else if (parameters.GetParameter(context, property, "forceRen", false))
+ else if (parameters.GetParameter(context, property, "forceRen", false))
return;
else if (property.DeclaringType.Implements("System.ComponentModel.INotifyPropertyChanged"))
@@ -144,7 +142,7 @@ private void Analyze(NameService service, ConfuserContext context, ProtectionPar
private void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, EventDef evt) {
if (evt.DeclaringType.IsVisibleOutside() &&
- !parameters.GetParameter(context, evt, "renPublic", false))
+ !parameters.GetParameter(context, evt, "renPublic", false))
service.SetCanRename(evt, false);
else if (evt.IsRuntimeSpecialName || evt.IsSpecialName)
diff --git a/Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs b/Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs
index ae5330927..e7f06632b 100644
--- a/Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.References;
using dnlib.DotNet;
using dnlib.DotNet.MD;
diff --git a/Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs b/Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs
index 1a2075751..3a7d13085 100644
--- a/Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/LdtokenEnumAnalyzer.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
@@ -20,30 +21,25 @@ public void Analyze(ConfuserContext context, INameService service, IDnlibDef def
IMemberForwarded member = ((MemberRef)instr.Operand).ResolveThrow();
if (context.Modules.Contains((ModuleDefMD)member.Module))
service.SetCanRename(member, false);
- }
- else if (instr.Operand is IField) {
+ } else if (instr.Operand is IField) {
FieldDef field = ((IField)instr.Operand).ResolveThrow();
if (context.Modules.Contains((ModuleDefMD)field.Module))
service.SetCanRename(field, false);
- }
- else if (instr.Operand is IMethod) {
+ } else if (instr.Operand is IMethod) {
MethodDef m = ((IMethod)instr.Operand).ResolveThrow();
if (context.Modules.Contains((ModuleDefMD)m.Module))
service.SetCanRename(method, false);
- }
- else if (instr.Operand is ITypeDefOrRef) {
+ } else if (instr.Operand is ITypeDefOrRef) {
if (!(instr.Operand is TypeSpec)) {
TypeDef type = ((ITypeDefOrRef)instr.Operand).ResolveTypeDefThrow();
if (context.Modules.Contains((ModuleDefMD)type.Module) &&
HandleTypeOf(context, service, method, i))
DisableRename(service, type, false);
}
- }
- else
+ } else
throw new UnreachableException();
- }
- else if ((instr.OpCode.Code == Code.Call || instr.OpCode.Code == Code.Callvirt) &&
- ((IMethod)instr.Operand).Name == "ToString") {
+ } else if ((instr.OpCode.Code == Code.Call || instr.OpCode.Code == Code.Callvirt) &&
+ ((IMethod)instr.Operand).Name == "ToString") {
HandleEnum(context, service, method, i);
}
}
@@ -74,8 +70,7 @@ private void HandleEnum(ConfuserContext context, INameService service, MethodDef
if (prevInstr.Operand is MemberRef) {
var memberRef = (MemberRef)prevInstr.Operand;
targetType = memberRef.IsFieldRef ? memberRef.FieldSig.Type : memberRef.MethodSig.RetType;
- }
- else if (prevInstr.Operand is IField)
+ } else if (prevInstr.Operand is IField)
targetType = ((IField)prevInstr.Operand).FieldSig.Type;
else if (prevInstr.Operand is IMethod)
diff --git a/Confuser.Renamer/Analyzers/ResourceAnalyzer.cs b/Confuser.Renamer/Analyzers/ResourceAnalyzer.cs
index 87e054434..fc78d574f 100644
--- a/Confuser.Renamer/Analyzers/ResourceAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/ResourceAnalyzer.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using System.Text.RegularExpressions;
using Confuser.Core;
using Confuser.Renamer.References;
@@ -37,8 +38,7 @@ public void Analyze(ConfuserContext context, INameService service, IDnlibDef def
}
service.AddReference(type, new ResourceReference(res, type, format));
}
- }
- else {
+ } else {
string format = "{0}.resources";
foreach (Resource res in module.Resources) {
Match match = ResourceNamePattern.Match(res.Name);
diff --git a/Confuser.Renamer/Analyzers/TypeBlobAnalyzer.cs b/Confuser.Renamer/Analyzers/TypeBlobAnalyzer.cs
index 810b469fa..33409b5ca 100644
--- a/Confuser.Renamer/Analyzers/TypeBlobAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/TypeBlobAnalyzer.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Confuser.Core;
@@ -102,8 +103,7 @@ private void AnalyzeCAArgument(ConfuserContext context, INameService service, CA
service.ReduceRenameMode(typeDef, RenameMode.ASCII);
}
}
- }
- else if (arg.Value is CAArgument[]) {
+ } else if (arg.Value is CAArgument[]) {
foreach (CAArgument elem in (CAArgument[])arg.Value)
AnalyzeCAArgument(context, service, elem);
}
diff --git a/Confuser.Renamer/Analyzers/VTableAnalyzer.cs b/Confuser.Renamer/Analyzers/VTableAnalyzer.cs
index 05103edd9..3531b8a4b 100644
--- a/Confuser.Renamer/Analyzers/VTableAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/VTableAnalyzer.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
using Confuser.Core;
using Confuser.Renamer.References;
@@ -18,8 +19,7 @@ public void Analyze(ConfuserContext context, INameService service, IDnlibDef def
if (method.IsAbstract) {
service.SetCanRename(method, false);
- }
- else {
+ } else {
foreach (VTableSlot baseSlot in slot.Overrides) {
// Better on safe side, add references to both methods.
service.AddReference(method, new OverrideDirectiveReference(slot, baseSlot));
diff --git a/Confuser.Renamer/Analyzers/WPFAnalyzer.cs b/Confuser.Renamer/Analyzers/WPFAnalyzer.cs
index fabcdbf58..8fb2faded 100644
--- a/Confuser.Renamer/Analyzers/WPFAnalyzer.cs
+++ b/Confuser.Renamer/Analyzers/WPFAnalyzer.cs
@@ -91,10 +91,8 @@ private void AnalyzeMethod(ConfuserContext context, INameService service, Method
if (regMethod.DeclaringType.FullName == "System.Windows.DependencyProperty" &&
regMethod.Name.String.StartsWith("Register")) {
dpRegInstrs.Add(Tuple.Create(regMethod.Name.String.StartsWith("RegisterAttached"), instr));
- }
-
- else if (regMethod.DeclaringType.FullName == "System.Windows.EventManager" &&
- regMethod.Name.String == "RegisterRoutedEvent") {
+ } else if (regMethod.DeclaringType.FullName == "System.Windows.EventManager" &&
+ regMethod.Name.String == "RegisterRoutedEvent") {
routedEvtRegInstrs.Add(instr);
}
}
diff --git a/Confuser.Renamer/BAML/BAMLAnalyzer.cs b/Confuser.Renamer/BAML/BAMLAnalyzer.cs
index 4076b887b..719761b39 100644
--- a/Confuser.Renamer/BAML/BAMLAnalyzer.cs
+++ b/Confuser.Renamer/BAML/BAMLAnalyzer.cs
@@ -52,8 +52,7 @@ public BamlDocument Analyze(ModuleDefMD module, string bamlName, byte[] data) {
this.bamlName = bamlName;
if (module.IsClr40) {
things = thingsv4 ?? (thingsv4 = new KnownThingsv4(context, module));
- }
- else {
+ } else {
things = thingsv3 ?? (thingsv3 = new KnownThingsv3(context, module));
}
@@ -127,8 +126,7 @@ private void PopulateReferences(BamlDocument document) {
if (typeRefs.TryGetValue(rec.OwnerTypeId, out declType)) {
TypeDef type = declType.ToBasicTypeDefOrRef().ResolveTypeDefThrow();
attrRefs[rec.AttributeId] = AnalyzeAttributeReference(type, rec);
- }
- else {
+ } else {
Debug.Assert((short)rec.OwnerTypeId < 0);
TypeDef declTypeDef = things.Types((KnownTypes)(-(short)rec.OwnerTypeId));
attrRefs[rec.AttributeId] = AnalyzeAttributeReference(declTypeDef, rec);
@@ -177,8 +175,7 @@ private TypeSig ResolveType(string typeName, out string prefix) {
prefix = "";
if (!xmlns.TryGetValue(prefix, out clrNs))
return null;
- }
- else {
+ } else {
prefix = typeName.Substring(0, index);
if (!xmlns.TryGetValue(prefix, out clrNs))
return null;
@@ -243,8 +240,7 @@ private void ProcessElementHeader(BamlElement elem) {
AnalyzePropertyPath(cnt.Value);
}
}
- }
- else if (elem.Type.FullName == "System.Windows.Markup.TypeExtension") {
+ } else if (elem.Type.FullName == "System.Windows.Markup.TypeExtension") {
foreach (BamlElement child in elem.Children) {
if (child.Header.Type == BamlRecordType.ConstructorParametersStart) {
var cnt = (TextRecord)child.Body[0];
@@ -322,15 +318,13 @@ private void ProcessElementBody(BamlElement root, BamlElement elem) {
if (rec is PropertyWithConverterRecord) {
ProcessConverter((PropertyWithConverterRecord)rec, type);
}
- }
- else if (rec is PropertyComplexStartRecord) {
+ } else if (rec is PropertyComplexStartRecord) {
Tuple attrInfo = ResolveAttribute(((PropertyComplexStartRecord)rec).AttributeId);
type = attrInfo.Item2;
attr = attrInfo.Item1;
if (attr != null)
type = GetAttributeType(attr);
- }
- else if (rec is ContentPropertyRecord) {
+ } else if (rec is ContentPropertyRecord) {
Tuple attrInfo = ResolveAttribute(((ContentPropertyRecord)rec).AttributeId);
type = attrInfo.Item2;
attr = attrInfo.Item1;
@@ -340,8 +334,7 @@ private void ProcessElementBody(BamlElement root, BamlElement elem) {
child.Type = type;
child.Attribute = attr;
}
- }
- else if (rec is PropertyCustomRecord) {
+ } else if (rec is PropertyCustomRecord) {
var customRec = (PropertyCustomRecord)rec;
Tuple attrInfo = ResolveAttribute(customRec.AttributeId);
type = attrInfo.Item2;
@@ -353,8 +346,7 @@ private void ProcessElementBody(BamlElement root, BamlElement elem) {
// See BamlRecordReader.GetCustomDependencyPropertyValue.
// Umm... Well, actually nothing to do, since this record only describe DP, which already won't be renamed.
}
- }
- else if (rec is PropertyWithExtensionRecord) {
+ } else if (rec is PropertyWithExtensionRecord) {
var extRec = (PropertyWithExtensionRecord)rec;
Tuple attrInfo = ResolveAttribute(extRec.AttributeId);
type = attrInfo.Item2;
@@ -376,8 +368,7 @@ private void ProcessConverter(PropertyWithConverterRecord rec, TypeDef type) {
if (enumField != null)
service.AddReference(enumField, new BAMLEnumReference(enumField, rec));
}
- }
- else if (converter.FullName == "System.Windows.Input.CommandConverter") {
+ } else if (converter.FullName == "System.Windows.Input.CommandConverter") {
string cmd = rec.Value.Trim();
int index = cmd.IndexOf('.');
if (index != -1) {
@@ -408,17 +399,13 @@ private void ProcessConverter(PropertyWithConverterRecord rec, TypeDef type) {
}
}
}
- }
- else if (converter.FullName == "System.Windows.Markup.DependencyPropertyConverter") {
+ } else if (converter.FullName == "System.Windows.Markup.DependencyPropertyConverter") {
// Umm... Again nothing to do, DP already won't be renamed.
- }
- else if (converter.FullName == "System.Windows.PropertyPathConverter") {
+ } else if (converter.FullName == "System.Windows.PropertyPathConverter") {
AnalyzePropertyPath(rec.Value);
- }
- else if (converter.FullName == "System.Windows.Markup.RoutedEventConverter") {
+ } else if (converter.FullName == "System.Windows.Markup.RoutedEventConverter") {
throw new NotImplementedException();
- }
- else if (converter.FullName == "System.Windows.Markup.TypeTypeConverter") {
+ } else if (converter.FullName == "System.Windows.Markup.TypeTypeConverter") {
string prefix;
TypeSig sig = ResolveType(rec.Value.Trim(), out prefix);
if (sig != null && context.Modules.Contains((ModuleDefMD)sig.ToBasicTypeDefOrRef().ResolveTypeDefThrow().Module)) {
@@ -471,8 +458,7 @@ private void AnalyzePropertyPath(string path) {
AddTypeSigReference(sig, reference);
}
}
- }
- else {
+ } else {
List candidates;
if (properties.TryGetValue(part.Name, out candidates))
foreach (PropertyDef property in candidates) {
diff --git a/Confuser.Renamer/BAML/BamlDocument.cs b/Confuser.Renamer/BAML/BamlDocument.cs
index 79f104a87..2b0c52c98 100644
--- a/Confuser.Renamer/BAML/BamlDocument.cs
+++ b/Confuser.Renamer/BAML/BamlDocument.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Confuser.Renamer.BAML {
internal class BamlDocument : List {
diff --git a/Confuser.Renamer/BAML/BamlElement.cs b/Confuser.Renamer/BAML/BamlElement.cs
index 5545ab36e..3086ac086 100644
--- a/Confuser.Renamer/BAML/BamlElement.cs
+++ b/Confuser.Renamer/BAML/BamlElement.cs
@@ -102,8 +102,7 @@ public static BamlElement Read(BamlDocument document) {
current.Parent = prev;
stack.Push(prev);
}
- }
- else if (IsFooter(document[i])) {
+ } else if (IsFooter(document[i])) {
if (current == null)
throw new Exception("Unexpected footer.");
@@ -115,8 +114,7 @@ public static BamlElement Read(BamlDocument document) {
current.Footer = document[i];
if (stack.Count > 0)
current = stack.Pop();
- }
- else
+ } else
current.Body.Add(document[i]);
}
Debug.Assert(stack.Count == 0);
diff --git a/Confuser.Renamer/BAML/PropertyPath.cs b/Confuser.Renamer/BAML/PropertyPath.cs
index 8f172b7f5..b69048ad7 100644
--- a/Confuser.Renamer/BAML/PropertyPath.cs
+++ b/Confuser.Renamer/BAML/PropertyPath.cs
@@ -33,8 +33,7 @@ public void ExtractAttachedDP(out string type, out string property) {
// type = null means the property is on the same type
type = null;
property = name.Trim();
- }
- else {
+ } else {
int dot = name.LastIndexOf('.');
type = name.Substring(0, dot).Trim();
property = name.Substring(dot + 1).Trim();
@@ -84,16 +83,13 @@ private static PropertyPathPart ReadIndexer(string path, ref int index, bool? is
if (c == '(') {
index++;
state = STATE_TYPE;
- }
- else if (c == '^') {
+ } else if (c == '^') {
valueString.Append(path[++index]);
index++;
state = STATE_VALUE;
- }
- else if (char.IsWhiteSpace(c)) {
+ } else if (char.IsWhiteSpace(c)) {
index++;
- }
- else {
+ } else {
valueString.Append(path[index++]);
state = STATE_VALUE;
}
@@ -102,12 +98,10 @@ private static PropertyPathPart ReadIndexer(string path, ref int index, bool? is
if (c == ')') {
index++;
state = STATE_VALUE;
- }
- else if (c == '^') {
+ } else if (c == '^') {
typeString.Append(path[++index]);
index++;
- }
- else {
+ } else {
typeString.Append(path[index++]);
}
break;
@@ -116,18 +110,15 @@ private static PropertyPathPart ReadIndexer(string path, ref int index, bool? is
valueString.Append(path[index++]);
level++;
trim = false;
- }
- else if (c == '^') {
+ } else if (c == '^') {
valueString.Append(path[++index]);
index++;
trim = false;
- }
- else if (level > 0 && c == ']') {
+ } else if (level > 0 && c == ']') {
level--;
valueString.Append(path[index++]);
trim = false;
- }
- else if (c == ']' || c == ',') {
+ } else if (c == ']' || c == ',') {
string value = valueString.ToString();
// Note: it may be a WPF bug that if the value is "^ " (2 spaces after caret), all spaces will be trimmed.
// According to http://msdn.microsoft.com/en-us/library/ms742451.aspx, the result should have one space.
@@ -147,8 +138,7 @@ private static PropertyPathPart ReadIndexer(string path, ref int index, bool? is
state = STATE_WAIT;
else
state = STATE_DONE;
- }
- else {
+ } else {
valueString.Append(path[index++]);
if (c == ' ' && level == 0)
trim = true;
diff --git a/Confuser.Renamer/INameReference.cs b/Confuser.Renamer/INameReference.cs
index 1c9c63254..47d28d9e5 100644
--- a/Confuser.Renamer/INameReference.cs
+++ b/Confuser.Renamer/INameReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
namespace Confuser.Renamer {
public interface INameReference {
diff --git a/Confuser.Renamer/IRenamer.cs b/Confuser.Renamer/IRenamer.cs
index 0157ab318..10cd7cf1e 100644
--- a/Confuser.Renamer/IRenamer.cs
+++ b/Confuser.Renamer/IRenamer.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer {
diff --git a/Confuser.Renamer/NameProtection.cs b/Confuser.Renamer/NameProtection.cs
index 296f683bd..e42d1415e 100644
--- a/Confuser.Renamer/NameProtection.cs
+++ b/Confuser.Renamer/NameProtection.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
namespace Confuser.Renamer {
internal class NameProtection : Protection {
diff --git a/Confuser.Renamer/NameService.cs b/Confuser.Renamer/NameService.cs
index b7602e18a..45b708e32 100644
--- a/Confuser.Renamer/NameService.cs
+++ b/Confuser.Renamer/NameService.cs
@@ -170,15 +170,13 @@ public void MarkHelper(IDnlibDef def, IMarkerService marker) {
method.Access = MethodAttributes.Assembly;
if (!method.IsSpecialName && !method.IsRuntimeSpecialName && !method.DeclaringType.IsDelegate())
method.Name = RandomName();
- }
- else if (def is FieldDef) {
+ } else if (def is FieldDef) {
var field = (FieldDef)def;
field.Access = FieldAttributes.Assembly;
field.Name = RandomName();
if (!field.IsSpecialName && !field.IsRuntimeSpecialName)
field.Name = RandomName();
- }
- else if (def is TypeDef) {
+ } else if (def is TypeDef) {
var type = (TypeDef)def;
type.Visibility = type.DeclaringType == null ? TypeAttributes.NotPublic : TypeAttributes.NestedAssembly;
type.Namespace = "";
diff --git a/Confuser.Renamer/PostRenamePhase.cs b/Confuser.Renamer/PostRenamePhase.cs
index e72fb9653..6de13b5d4 100644
--- a/Confuser.Renamer/PostRenamePhase.cs
+++ b/Confuser.Renamer/PostRenamePhase.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer {
diff --git a/Confuser.Renamer/Properties/AssemblyInfo.cs b/Confuser.Renamer/Properties/AssemblyInfo.cs
index ae7d1d558..0c3893100 100644
--- a/Confuser.Renamer/Properties/AssemblyInfo.cs
+++ b/Confuser.Renamer/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Renamer")]
[assembly: AssemblyDescription("Renaming analysis of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.Renamer/References/BAMLAttributeReference.cs b/Confuser.Renamer/References/BAMLAttributeReference.cs
index ce4995aa6..4aa7d57b8 100644
--- a/Confuser.Renamer/References/BAMLAttributeReference.cs
+++ b/Confuser.Renamer/References/BAMLAttributeReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
diff --git a/Confuser.Renamer/References/BAMLConverterMemberReference.cs b/Confuser.Renamer/References/BAMLConverterMemberReference.cs
index 8b3a9e429..ddf6782a6 100644
--- a/Confuser.Renamer/References/BAMLConverterMemberReference.cs
+++ b/Confuser.Renamer/References/BAMLConverterMemberReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
diff --git a/Confuser.Renamer/References/BAMLConverterTypeReference.cs b/Confuser.Renamer/References/BAMLConverterTypeReference.cs
index d3f797dd3..1d4f24ffc 100644
--- a/Confuser.Renamer/References/BAMLConverterTypeReference.cs
+++ b/Confuser.Renamer/References/BAMLConverterTypeReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
diff --git a/Confuser.Renamer/References/BAMLEnumReference.cs b/Confuser.Renamer/References/BAMLEnumReference.cs
index c35b3d091..bf64be4ba 100644
--- a/Confuser.Renamer/References/BAMLEnumReference.cs
+++ b/Confuser.Renamer/References/BAMLEnumReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
diff --git a/Confuser.Renamer/References/BAMLPathTypeReference.cs b/Confuser.Renamer/References/BAMLPathTypeReference.cs
index 550f21c17..396ab7836 100644
--- a/Confuser.Renamer/References/BAMLPathTypeReference.cs
+++ b/Confuser.Renamer/References/BAMLPathTypeReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
@@ -30,8 +31,7 @@ public bool UpdateNameReference(ConfuserContext context, INameService service) {
name = prefix + ":" + name;
if (indexer != null) {
indexer.Type = name;
- }
- else {
+ } else {
string oldType, property;
attachedDP.ExtractAttachedDP(out oldType, out property);
attachedDP.Name = string.Format("({0}.{1})", name, property);
diff --git a/Confuser.Renamer/References/BAMLTypeReference.cs b/Confuser.Renamer/References/BAMLTypeReference.cs
index d3bf41bba..e5066e05f 100644
--- a/Confuser.Renamer/References/BAMLTypeReference.cs
+++ b/Confuser.Renamer/References/BAMLTypeReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using Confuser.Renamer.BAML;
using dnlib.DotNet;
diff --git a/Confuser.Renamer/References/CAMemberReference.cs b/Confuser.Renamer/References/CAMemberReference.cs
index 6f22e8154..45b48399d 100644
--- a/Confuser.Renamer/References/CAMemberReference.cs
+++ b/Confuser.Renamer/References/CAMemberReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
diff --git a/Confuser.Renamer/References/MemberRefReference.cs b/Confuser.Renamer/References/MemberRefReference.cs
index 321d26c03..ab3261abc 100644
--- a/Confuser.Renamer/References/MemberRefReference.cs
+++ b/Confuser.Renamer/References/MemberRefReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
diff --git a/Confuser.Renamer/References/OverrideDirectiveReference.cs b/Confuser.Renamer/References/OverrideDirectiveReference.cs
index 693acaeb4..c870e2118 100644
--- a/Confuser.Renamer/References/OverrideDirectiveReference.cs
+++ b/Confuser.Renamer/References/OverrideDirectiveReference.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
@@ -20,8 +21,7 @@ public bool UpdateNameReference(ConfuserContext context, INameService service) {
var declType = (GenericInstSig)baseSlot.DeclaringType;
target = new MemberRefUser(method.Module, baseSlot.MethodDef.Name, baseSlot.MethodDef.MethodSig, declType.ToTypeDefOrRef());
target = (IMethodDefOrRef)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(target);
- }
- else {
+ } else {
target = baseSlot.MethodDef;
if (target.Module != method.Module)
target = (IMethodDefOrRef)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(baseSlot.MethodDef);
diff --git a/Confuser.Renamer/References/ResourceReference.cs b/Confuser.Renamer/References/ResourceReference.cs
index 7f0405dfa..68ea43329 100644
--- a/Confuser.Renamer/References/ResourceReference.cs
+++ b/Confuser.Renamer/References/ResourceReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
diff --git a/Confuser.Renamer/References/TypeRefReference.cs b/Confuser.Renamer/References/TypeRefReference.cs
index d296703fb..923af7528 100644
--- a/Confuser.Renamer/References/TypeRefReference.cs
+++ b/Confuser.Renamer/References/TypeRefReference.cs
@@ -1,4 +1,5 @@
-using Confuser.Core;
+using System;
+using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
diff --git a/Confuser.Renamer/RenameMode.cs b/Confuser.Renamer/RenameMode.cs
index 1c1a97431..04f438c47 100644
--- a/Confuser.Renamer/RenameMode.cs
+++ b/Confuser.Renamer/RenameMode.cs
@@ -1,4 +1,6 @@
-namespace Confuser.Renamer {
+using System;
+
+namespace Confuser.Renamer {
public enum RenameMode {
Empty,
Unicode,
diff --git a/Confuser.Renamer/RenamePhase.cs b/Confuser.Renamer/RenamePhase.cs
index 7066f7a81..73ee2718f 100644
--- a/Confuser.Renamer/RenamePhase.cs
+++ b/Confuser.Renamer/RenamePhase.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
@@ -52,13 +53,11 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
if (parameters.GetParameter(context, def, "flatten", true)) {
typeDef.Name = service.ObfuscateName(typeDef.FullName, mode);
typeDef.Namespace = "";
- }
- else {
+ } else {
typeDef.Namespace = service.ObfuscateName(typeDef.Namespace, mode);
typeDef.Name = service.ObfuscateName(typeDef.Name, mode);
}
- }
- else
+ } else
def.Name = service.ObfuscateName(def.Name, mode);
foreach (INameReference refer in references.ToList()) {
diff --git a/Confuser.Renamer/VTable.cs b/Confuser.Renamer/VTable.cs
index 774ccd913..a1f850a04 100644
--- a/Confuser.Renamer/VTable.cs
+++ b/Confuser.Renamer/VTable.cs
@@ -117,8 +117,7 @@ private void Override(Dictionary> slotDict, VT
if (!slot.MethodDef.IsFinal) {
slotList.Add(slot);
Slots.Add(slot);
- }
- else
+ } else
Finals.Add(slot);
}
@@ -133,8 +132,7 @@ private void Override(Dictionary> slotDict, VT
if (!slot.MethodDef.IsFinal) {
slotDict.AddListEntry(slot.Signature, slot);
Slots.Add(slot);
- }
- else
+ } else
Finals.Add(slot);
}
@@ -151,16 +149,13 @@ private void Inherit(VTable parent, Dictionary
slotList.Add(slot);
Slots.Add(slot);
}
- }
- else
+ } else
throw new UnreachableException();
- }
- else {
+ } else {
slotList.Add(slot);
Slots.Add(slot);
}
- }
- else {
+ } else {
slotDict.AddListEntry(slot.Signature, slot);
Slots.Add(slot);
}
@@ -256,18 +251,15 @@ public VTable GetVTable(ITypeDefOrRef type) {
if (sig is TypeDefOrRefSig) {
TypeDef typeDef = ((TypeDefOrRefSig)sig).TypeDefOrRef.ResolveTypeDefThrow();
return GetOrConstruct(typeDef);
- }
- else if (sig is GenericInstSig) {
+ } else if (sig is GenericInstSig) {
var genInst = (GenericInstSig)sig;
TypeDef openType = genInst.GenericType.TypeDefOrRef.ResolveTypeDefThrow();
VTable vTable = GetOrConstruct(openType);
return ResolveGenericArgument(openType, genInst, vTable);
- }
- else
+ } else
throw new NotSupportedException("Unexpected type: " + type.ToString());
- }
- else
+ } else
throw new UnreachableException();
}
diff --git a/Confuser.Runtime/AntiDebug.Win32.cs b/Confuser.Runtime/AntiDebug.Win32.cs
index 784cd5985..2f5b7178e 100644
--- a/Confuser.Runtime/AntiDebug.Win32.cs
+++ b/Confuser.Runtime/AntiDebug.Win32.cs
@@ -55,8 +55,7 @@ private static void Worker(object thread) {
// CloseHandle
try {
CloseHandle(IntPtr.Zero);
- }
- catch {
+ } catch {
Environment.FailFast("");
}
diff --git a/Confuser.Runtime/AntiDump.cs b/Confuser.Runtime/AntiDump.cs
index 0ad64fa99..de26371dd 100644
--- a/Confuser.Runtime/AntiDump.cs
+++ b/Confuser.Runtime/AntiDump.cs
@@ -104,8 +104,7 @@ private static unsafe void Initialize() {
mdHdr++;
}
}
- }
- else //Flat
+ } else //Flat
{
//VirtualProtect(ptr - 16, 8, 0x40, out old);
//*(uint*)(ptr - 12) = 0;
diff --git a/Confuser.Runtime/AntiTamper.JIT.cs b/Confuser.Runtime/AntiTamper.JIT.cs
index e04d79e88..bab05a6ca 100644
--- a/Confuser.Runtime/AntiTamper.JIT.cs
+++ b/Confuser.Runtime/AntiTamper.JIT.cs
@@ -32,8 +32,7 @@ public static void Initialize() {
if (g == (uint)Mutation.KeyI0) {
e = (uint*)(b + (f ? *(r + 3) : *(r + 1)));
l = (f ? *(r + 2) : *(r + 0)) >> 2;
- }
- else if (g != 0) {
+ } else if (g != 0) {
var q = (uint*)(b + (f ? *(r + 3) : *(r + 1)));
uint j = *(r + 2) >> 2;
for (uint k = 0; k < j; k++) {
@@ -75,8 +74,7 @@ public static void Initialize() {
ulong* str = stackalloc ulong[1];
str[0] = 0x0061746144705f6d; //m_pData.
moduleHnd = (IntPtr)m.GetType().GetField(new string((sbyte*)str), BindingFlags.NonPublic | BindingFlags.Instance).GetValue(m);
- }
- else
+ } else
moduleHnd = *(IntPtr*)(&hnd);
Hook();
@@ -96,8 +94,7 @@ private static void Hook() {
if (ver) {
ptr[0] = 0x642e74696a726c63; //clrjit.d
ptr[1] = 0x0000000000006c6c; //ll......
- }
- else {
+ } else {
ptr[0] = 0x74696a726f63736d; //mscorjit
ptr[1] = 0x000000006c6c642e; //.dll....
}
@@ -117,8 +114,7 @@ private static void Hook() {
VirtualProtect(trampoline, 12, 0x40, out oldPl);
Marshal.WriteIntPtr(trampoline, 2, original);
- }
- else {
+ } else {
trampoline = Marshal.AllocHGlobal(8);
var tptr = (ulong*)trampoline;
tptr[0] = 0x90e0ffffffffffb8;
@@ -145,8 +141,7 @@ private static void ExtractLocalVars(CORINFO_METHOD_INFO* info, uint len, byte*
sigInfo = (CORINFO_SIG_INFO_x64*)((uint*)(info + 1) + 5) + 1;
else
sigInfo = (CORINFO_SIG_INFO_x86*)((uint*)(info + 1) + 4) + 1;
- }
- else {
+ } else {
if (IntPtr.Size == 8)
sigInfo = (CORINFO_SIG_INFO_x64*)((uint*)(info + 1) + 3) + 1;
else
@@ -164,8 +159,7 @@ private static void ExtractLocalVars(CORINFO_METHOD_INFO* info, uint len, byte*
if ((b & 0x80) == 0) {
numArgs = b;
args = (IntPtr)(localVar + 1);
- }
- else {
+ } else {
numArgs = (ushort)(((uint)(b & ~0x80) << 8) | *(localVar + 1));
args = (IntPtr)(localVar + 2);
}
@@ -177,8 +171,7 @@ private static void ExtractLocalVars(CORINFO_METHOD_INFO* info, uint len, byte*
sigInfox64->flags = 1;
sigInfox64->numArgs = numArgs;
sigInfox64->args = args;
- }
- else {
+ } else {
var sigInfox86 = (CORINFO_SIG_INFO_x86*)sigInfo;
sigInfox86->callConv = 0;
sigInfox86->retType = 1;
@@ -234,8 +227,7 @@ private static uint HookHandler(IntPtr self, ICorJitInfo* comp, CORINFO_METHOD_I
*((uint*)(info + 1) + 0) = data->MaxStack;
*((uint*)(info + 1) + 1) = data->EHCount;
*((uint*)(info + 1) + 2) = data->Options;
- }
- else {
+ } else {
*((ushort*)(info + 1) + 0) = (ushort)data->MaxStack;
*((ushort*)(info + 1) + 1) = (ushort)data->EHCount;
*((uint*)(info + 1) + 1) = data->Options;
@@ -258,8 +250,7 @@ private static uint HookHandler(IntPtr self, ICorJitInfo* comp, CORINFO_METHOD_I
hook1.Dispose();
return ret;
- }
- finally {
+ } finally {
Marshal.FreeHGlobal((IntPtr)newPtr);
}
}
@@ -275,8 +266,8 @@ private struct CORINFO_EH_CLAUSE { }
[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct CORINFO_METHOD_INFO {
- public readonly IntPtr ftn;
- public readonly IntPtr scope;
+ public IntPtr ftn;
+ public IntPtr scope;
public byte* ILCode;
public uint ILCodeSize;
}
@@ -284,34 +275,34 @@ private struct CORINFO_METHOD_INFO {
[StructLayout(LayoutKind.Sequential)]
private struct CORINFO_SIG_INFO_x64 {
public uint callConv;
- private readonly uint pad1;
- public readonly IntPtr retTypeClass;
- public readonly IntPtr retTypeSigClass;
+ private uint pad1;
+ public IntPtr retTypeClass;
+ public IntPtr retTypeSigClass;
public byte retType;
public byte flags;
public ushort numArgs;
- private readonly uint pad2;
- public readonly CORINFO_SIG_INST_x64 sigInst;
+ private uint pad2;
+ public CORINFO_SIG_INST_x64 sigInst;
public IntPtr args;
public IntPtr sig;
- public readonly IntPtr scope;
- public readonly uint token;
- private readonly uint pad3;
+ public IntPtr scope;
+ public uint token;
+ private uint pad3;
}
[StructLayout(LayoutKind.Sequential)]
private struct CORINFO_SIG_INFO_x86 {
public uint callConv;
- public readonly IntPtr retTypeClass;
- public readonly IntPtr retTypeSigClass;
+ public IntPtr retTypeClass;
+ public IntPtr retTypeSigClass;
public byte retType;
public byte flags;
public ushort numArgs;
- public readonly CORINFO_SIG_INST_x86 sigInst;
+ public CORINFO_SIG_INST_x86 sigInst;
public IntPtr args;
public IntPtr sig;
- public readonly IntPtr scope;
- public readonly uint token;
+ public IntPtr scope;
+ public uint token;
}
[StructLayout(LayoutKind.Sequential, Size = 32)]
@@ -390,8 +381,7 @@ private class CorMethodInfoHook {
private void hookEHInfo(IntPtr self, IntPtr ftn, uint EHnumber, CORINFO_EH_CLAUSE* clause) {
if (ftn == this.ftn) {
*clause = clauses[EHnumber];
- }
- else {
+ } else {
o_getEHinfo(self, ftn, EHnumber, clause);
}
}
diff --git a/Confuser.Runtime/AntiTamper.Normal.cs b/Confuser.Runtime/AntiTamper.Normal.cs
index 074d504c5..9704a87c5 100644
--- a/Confuser.Runtime/AntiTamper.Normal.cs
+++ b/Confuser.Runtime/AntiTamper.Normal.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
using System.Runtime.InteropServices;
namespace Confuser.Runtime {
@@ -21,8 +22,7 @@ private static unsafe void Initialize() {
if (g == (uint)Mutation.KeyI0) {
e = (uint*)(b + (f ? *(r + 3) : *(r + 1)));
l = (f ? *(r + 2) : *(r + 0)) >> 2;
- }
- else if (g != 0) {
+ } else if (g != 0) {
var q = (uint*)(b + (f ? *(r + 3) : *(r + 1)));
uint j = *(r + 2) >> 2;
for (uint k = 0; k < j; k++) {
diff --git a/Confuser.Runtime/Constant.cs b/Confuser.Runtime/Constant.cs
index f47a1104f..b551bd01b 100644
--- a/Confuser.Runtime/Constant.cs
+++ b/Confuser.Runtime/Constant.cs
@@ -56,8 +56,7 @@ private static T Get(uint id) {
var v = new T[1];
Buffer.BlockCopy(b, (int)id, v, 0, Mutation.Value());
ret = v[0];
- }
- else if (t == Mutation.KeyI2) {
+ } else if (t == Mutation.KeyI2) {
int s = b[id++] | (b[id++] << 8) | (b[id++] << 16) | (b[id++] << 24);
int l = b[id++] | (b[id++] << 8) | (b[id++] << 16) | (b[id++] << 24);
Array v = Array.CreateInstance(typeof (T).GetElementType(), l);
diff --git a/Confuser.Runtime/Lzma.cs b/Confuser.Runtime/Lzma.cs
index aaf16702f..977cf673d 100644
--- a/Confuser.Runtime/Lzma.cs
+++ b/Confuser.Runtime/Lzma.cs
@@ -294,8 +294,7 @@ public void Code(Stream inStream, Stream outStream,
m_OutWindow.PutByte(b);
state.UpdateChar();
nowPos64++;
- }
- else {
+ } else {
uint len;
if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1) {
if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0) {
@@ -305,13 +304,11 @@ public void Code(Stream inStream, Stream outStream,
nowPos64++;
continue;
}
- }
- else {
+ } else {
UInt32 distance;
if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0) {
distance = rep1;
- }
- else {
+ } else {
if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
distance = rep2;
else {
@@ -325,8 +322,7 @@ public void Code(Stream inStream, Stream outStream,
}
len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + kMatchMinLen;
state.UpdateRep();
- }
- else {
+ } else {
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
@@ -344,8 +340,7 @@ public void Code(Stream inStream, Stream outStream,
numDirectBits - kNumAlignBits) << kNumAlignBits);
rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
}
- }
- else
+ } else
rep0 = posSlot;
}
if (rep0 >= nowPos64 || rep0 >= m_DictionarySizeCheck) {
diff --git a/Confuser.Runtime/Mutation.cs b/Confuser.Runtime/Mutation.cs
index 4cb7a8292..c95881747 100644
--- a/Confuser.Runtime/Mutation.cs
+++ b/Confuser.Runtime/Mutation.cs
@@ -1,4 +1,6 @@
-internal class Mutation {
+using System;
+
+internal class Mutation {
public static readonly int KeyI0 = 0;
public static readonly int KeyI1 = 1;
public static readonly int KeyI2 = 2;
diff --git a/Confuser.Runtime/Properties/AssemblyInfo.cs b/Confuser.Runtime/Properties/AssemblyInfo.cs
index 98327787b..aa3a74d1a 100644
--- a/Confuser.Runtime/Properties/AssemblyInfo.cs
+++ b/Confuser.Runtime/Properties/AssemblyInfo.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System;
+using System.Reflection;
[assembly: AssemblyTitle("ConfuserEx Runtime")]
[assembly: AssemblyDescription("Runtime library of ConfuserEx")]
\ No newline at end of file
diff --git a/Confuser.Runtime/antinet/AntiManagedDebugger.cs b/Confuser.Runtime/antinet/AntiManagedDebugger.cs
index c52e82996..013e339da 100644
--- a/Confuser.Runtime/antinet/AntiManagedDebugger.cs
+++ b/Confuser.Runtime/antinet/AntiManagedDebugger.cs
@@ -123,11 +123,9 @@ private static unsafe IntPtr FindDebuggerRCThreadAddress(Info info) {
continue;
return pDebuggerRCThread;
- }
- catch { }
+ } catch { }
}
- }
- catch { }
+ } catch { }
return IntPtr.Zero;
}
diff --git a/Confuser.Runtime/antinet/AntiManagedProfiler.cs b/Confuser.Runtime/antinet/AntiManagedProfiler.cs
index f8b976cce..b83baa611 100644
--- a/Confuser.Runtime/antinet/AntiManagedProfiler.cs
+++ b/Confuser.Runtime/antinet/AntiManagedProfiler.cs
@@ -62,8 +62,7 @@ private static bool IsProfilerAttached {
if (profilerDetector == null)
return false;
return profilerDetector.IsProfilerAttached();
- }
- catch { }
+ } catch { }
return false;
}
}
@@ -78,8 +77,7 @@ private static bool WasProfilerAttached {
if (profilerDetector == null)
return false;
return profilerDetector.WasProfilerAttached();
- }
- catch { }
+ } catch { }
return false;
}
}
@@ -189,8 +187,7 @@ private unsafe bool FindProfilerStatus() {
addr = new IntPtr((void*)*(uint*)(p + 2));
else
addr = new IntPtr(p + 7 + *(int*)(p + 2));
- }
- else
+ } else
continue;
if (!PEInfo.IsAligned(addr, 4))
@@ -200,8 +197,7 @@ private unsafe bool FindProfilerStatus() {
try {
*(uint*)addr = *(uint*)addr;
- }
- catch {
+ } catch {
continue;
}
@@ -212,8 +208,7 @@ private unsafe bool FindProfilerStatus() {
if (count >= MAX_COUNTS)
break;
}
- }
- catch { }
+ } catch { }
IntPtr foundAddr = GetMax(addrCounts, 5);
if (foundAddr == IntPtr.Zero)
return false;
@@ -352,8 +347,7 @@ private unsafe bool TakeOwnershipOfNamedPipe() {
}
return CreateNamedPipeWait();
- }
- catch { }
+ } catch { }
return false;
}
@@ -379,8 +373,7 @@ private static unsafe void FixTimeOutOption(IntPtr timeOutOptionAddr) {
try {
// Set default timeout to 0 to make sure it fails immediately
*(uint*)((byte*)timeOutOptionAddr + ConfigDWORDInfo_defValue) = 0;
- }
- finally {
+ } finally {
VirtualProtect(timeOutOptionAddr, (int)ConfigDWORDInfo_defValue + 4, oldProtect, out oldProtect);
}
@@ -392,8 +385,7 @@ private static unsafe void FixTimeOutOption(IntPtr timeOutOptionAddr) {
var rand = new Random();
for (int i = 0; i < ProfAPIMaxWaitForTriggerMs_name.Length; i++)
name[i] = (char)rand.Next(1, ushort.MaxValue);
- }
- finally {
+ } finally {
VirtualProtect(nameAddr, IntPtr.Size, oldProtect, out oldProtect);
}
}
@@ -499,15 +491,13 @@ private static unsafe IntPtr FindThreadingModeAddress() {
if ((uint)(p[1] - 0xE8) > 7)
continue;
p += 3;
- }
- else if (*p == 0x85) {
+ } else if (*p == 0x85) {
int reg = (p[1] >> 3) & 7;
int rm = p[1] & 7;
if (reg != rm)
continue;
p += 2;
- }
- else
+ } else
continue;
// 74 / 0F 84 XX je there
@@ -527,11 +517,9 @@ private static unsafe IntPtr FindThreadingModeAddress() {
continue;
return addr;
- }
- catch { }
+ } catch { }
}
- }
- catch { }
+ } catch { }
return IntPtr.Zero;
}
@@ -566,11 +554,9 @@ private static unsafe IntPtr FindTimeOutOptionAddress() {
continue;
return new IntPtr(p);
- }
- catch { }
+ } catch { }
}
- }
- catch { }
+ } catch { }
return IntPtr.Zero;
}
@@ -636,16 +622,14 @@ private unsafe bool PatchAttacherThreadProc() {
p[2] = 0xC2;
p[3] = 0x04;
p[4] = 0x00;
- }
- else {
+ } else {
// xor eax,eax
p[0] = 0x33;
p[1] = 0xC0;
// retn
p[2] = 0xC3;
}
- }
- finally {
+ } finally {
VirtualProtect(new IntPtr(p), 5, oldProtect, out oldProtect);
}
return true;
@@ -694,8 +678,7 @@ private unsafe IntPtr FindAttacherThreadProc() {
return threadProc;
}
- }
- else {
+ } else {
for (; p < end; p++) {
// Find this code:
// 45 33 C9 xor r9d,r9d
@@ -722,8 +705,7 @@ private unsafe IntPtr FindAttacherThreadProc() {
return threadProc;
}
}
- }
- catch { }
+ } catch { }
return IntPtr.Zero;
}
@@ -749,8 +731,7 @@ private static unsafe bool CheckThreadProc(byte* codeStart, byte* codeEnd, IntPt
if (*(uint*)(p + i) == 0x4000)
return true;
}
- }
- catch { }
+ } catch { }
return false;
}
@@ -801,8 +782,7 @@ private unsafe bool FindProfilerControlBlock() {
addr = new IntPtr((void*)*(uint*)(p + 2));
else
addr = new IntPtr(p + 7 + *(int*)(p + 2));
- }
- else
+ } else
continue;
if (!PEInfo.IsAligned(addr, 4))
@@ -815,8 +795,7 @@ private unsafe bool FindProfilerControlBlock() {
if (*(uint*)addr > 4)
continue;
*(uint*)addr = *(uint*)addr;
- }
- catch {
+ } catch {
continue;
}
@@ -827,8 +806,7 @@ private unsafe bool FindProfilerControlBlock() {
if (count >= MAX_COUNTS)
break;
}
- }
- catch { }
+ } catch { }
IntPtr foundAddr = GetMax(addrCounts, 5);
if (foundAddr == IntPtr.Zero)
return false;
diff --git a/Confuser.Runtime/antinet/HandleProcessCorruptedStateExceptionsAttribute.cs b/Confuser.Runtime/antinet/HandleProcessCorruptedStateExceptionsAttribute.cs
index e7e3f582f..bed11b68d 100644
--- a/Confuser.Runtime/antinet/HandleProcessCorruptedStateExceptionsAttribute.cs
+++ b/Confuser.Runtime/antinet/HandleProcessCorruptedStateExceptionsAttribute.cs
@@ -1,4 +1,6 @@
-namespace System.Runtime.ExceptionServices {
+using System;
+
+namespace System.Runtime.ExceptionServices {
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
internal class HandleProcessCorruptedStateExceptionsAttribute : Attribute { }
}
\ No newline at end of file
diff --git a/ConfuserEx/Skin.cs b/ConfuserEx/Skin.cs
index ab53eb5c0..f8a77f183 100644
--- a/ConfuserEx/Skin.cs
+++ b/ConfuserEx/Skin.cs
@@ -10,9 +10,9 @@ public class Skin {
public static readonly DependencyProperty TabsDisabledProperty =
DependencyProperty.RegisterAttached("TabsDisabled", typeof (bool), typeof (Skin), new UIPropertyMetadata(false));
-
+
public static readonly DependencyProperty FocusOverlayProperty =
- DependencyProperty.RegisterAttached("FocusOverlay", typeof(bool), typeof(Skin), new UIPropertyMetadata(true));
+ DependencyProperty.RegisterAttached("FocusOverlay", typeof (bool), typeof (Skin), new UIPropertyMetadata(true));
public static readonly DependencyProperty RTBDocumentProperty =
DependencyProperty.RegisterAttached("RTBDocument", typeof (FlowDocument), typeof (Skin), new FrameworkPropertyMetadata(null, OnRTBDocumentChanged));
@@ -24,7 +24,7 @@ public static string GetEmptyPrompt(DependencyObject obj) {
public static void SetEmptyPrompt(DependencyObject obj, string value) {
obj.SetValue(EmptyPromptProperty, value);
}
-
+
public static bool GetFocusOverlay(DependencyObject obj) {
return (bool)obj.GetValue(FocusOverlayProperty);
}
@@ -46,8 +46,7 @@ public static void OnRTBDocumentChanged(DependencyObject d, DependencyPropertyCh
if (dpe.NewValue != null) {
rtb.Document = (FlowDocument)dpe.NewValue;
rtb.TextChanged += (sender, e) => rtb.ScrollToEnd();
- }
- else
+ } else
rtb.Document = new FlowDocument();
}
diff --git a/ConfuserEx/Skin.xaml b/ConfuserEx/Skin.xaml
index fc9cac7ec..ab94a6954 100644
--- a/ConfuserEx/Skin.xaml
+++ b/ConfuserEx/Skin.xaml
@@ -584,7 +584,7 @@
-
+
-
+