Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Minor style cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yck1509 committed Jun 23, 2014
1 parent 19b7fdf commit bb127b5
Show file tree
Hide file tree
Showing 169 changed files with 632 additions and 726 deletions.
9 changes: 3 additions & 6 deletions Confuser.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,8 +45,7 @@ private static int Main(string[] args) {
}

return logger.ReturnValue;
}
finally {
} finally {
Console.ForegroundColor = original;
Console.Title = originalTitle;
}
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Confuser.CLI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System;
using System.Reflection;

[assembly: AssemblyTitle("ConfuserEx Command-line")]
[assembly: AssemblyDescription("Command-line interface of ConfuserEx")]
4 changes: 3 additions & 1 deletion Confuser.Core/ConfuserComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Confuser.Core {
using System;

namespace Confuser.Core {
/// <summary>
/// Represent a component in Confuser
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Confuser.Core/ConfuserEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace Confuser.Core {
/// The processing engine of ConfuserEx.
/// </summary>
public static class ConfuserEngine {

/// <summary>
/// The version of ConfuserEx.
/// The version of ConfuserEx.
/// </summary>
public static readonly string Version;

private static readonly string Copyright;

static ConfuserEngine() {
Expand Down
3 changes: 2 additions & 1 deletion Confuser.Core/ConfuserParameters.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Confuser.Core.Project;
using System;
using Confuser.Core.Project;

namespace Confuser.Core {
/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion Confuser.Core/CoreComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Confuser.Core.Services;
using System;
using Confuser.Core.Services;

namespace Confuser.Core {
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions Confuser.Core/DnlibUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ private static void FindTypeRefsInternal(TypeSig typeSig, IList<ITypeDefOrRef> 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);
}

Expand Down
6 changes: 3 additions & 3 deletions Confuser.Core/Helpers/InjectHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Confuser.Core/LZMA/Common/CRC.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Common/CRC.cs

using System;

namespace SevenZip {
internal class CRC {
public static readonly uint[] Table;
Expand Down
1 change: 1 addition & 0 deletions Confuser.Core/LZMA/Common/InBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// InBuffer.cs

using System;
using System.IO;

namespace SevenZip.Buffer {
Expand Down
1 change: 1 addition & 0 deletions Confuser.Core/LZMA/Common/OutBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// OutBuffer.cs

using System;
using System.IO;

namespace SevenZip.Buffer {
Expand Down
15 changes: 5 additions & 10 deletions Confuser.Core/LZMA/Compress/LZ/LzBinTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Confuser.Core/LZMA/Compress/LZ/LzOutWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// LzOutWindow.cs

using System;
using System.IO;

namespace SevenZip.Compression.LZ {
Expand Down
2 changes: 2 additions & 0 deletions Confuser.Core/LZMA/Compress/LZMA/LzmaBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// LzmaBase.cs

using System;

namespace SevenZip.Compression.LZMA {
internal abstract class Base {
public const uint kNumRepDistances = 4;
Expand Down
15 changes: 5 additions & 10 deletions Confuser.Core/LZMA/Compress/LZMA/LzmaDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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) {
Expand Down
51 changes: 17 additions & 34 deletions Confuser.Core/LZMA/Compress/LZMA/LzmaEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public void Code(Stream inStream, Stream outStream,
progress.SetProgress(processedInSize, processedOutSize);
}
}
}
finally {
} finally {
ReleaseStreams();
}
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions Confuser.Core/LZMA/Compress/RangeCoder/RangeCoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit bb127b5

Please sign in to comment.