Skip to content

Commit 059ab92

Browse files
committed
Standardise code formatting across entire repo
1 parent dfcf15c commit 059ab92

File tree

304 files changed

+6477
-6439
lines changed

Some content is hidden

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

304 files changed

+6477
-6439
lines changed

Cpp2IL.Core.Tests/AccessibilityExtensionsTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public void AccessibilityTests()
1313
var mscorlib = appContext.AssembliesByName["mscorlib"];
1414
var coreModule = appContext.AssembliesByName["UnityEngine.CoreModule"];
1515

16-
var console = GetTypeByFullName(mscorlib, "System.Console");//public
17-
var consoleWindowsConsole = GetTypeByFullName(mscorlib, "System.Console.WindowsConsole");//private nested
18-
var dateTimeFormat = GetTypeByFullName(mscorlib, "System.DateTimeFormat");//internal
19-
var gameObject = GetTypeByFullName(coreModule, "UnityEngine.GameObject");//public
16+
var console = GetTypeByFullName(mscorlib, "System.Console"); //public
17+
var consoleWindowsConsole = GetTypeByFullName(mscorlib, "System.Console.WindowsConsole"); //private nested
18+
var dateTimeFormat = GetTypeByFullName(mscorlib, "System.DateTimeFormat"); //internal
19+
var gameObject = GetTypeByFullName(coreModule, "UnityEngine.GameObject"); //public
2020
Assert.Multiple(() =>
2121
{
2222
AssertAccessibleTo(console, consoleWindowsConsole);

Cpp2IL.Core.Tests/Cpp2IlApiTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using NUnit.Framework;
22

33
namespace Cpp2IL.Core.Tests;
4+
45
public class Cpp2IlApiTests
56
{
67
[Test]

Cpp2IL.Core.Tests/GraphingTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace Cpp2IL.Core.Tests;
66
public class GraphingTests
77
{
88
ISILControlFlowGraph graph;
9+
910
[SetUp]
1011
public void Setup()
1112
{

Cpp2IL.Core.Tests/Paths.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
namespace Cpp2IL.Core.Tests;
2+
23
public static class Paths
34
{
45
public const string TestProjectDirectory = "../../../";

Cpp2IL.Core/Api/Cpp2IlInstructionSet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public abstract class Cpp2IlInstructionSet
3939
/// </summary>
4040
/// <returns>A subclass of <see cref="BaseKeyFunctionAddresses"/> specific to this instruction set</returns>
4141
public abstract BaseKeyFunctionAddresses CreateKeyFunctionAddressesInstance();
42-
42+
4343
/// <summary>
4444
/// Create a string containing the raw native disassembly of the given method. You should print one instruction per line, alongside its address if applicable and available.
4545
/// </summary>
4646
/// <param name="context">The method context to disassemble.</param>
4747
/// <returns>A string containing one instruction per line.</returns>
4848
public abstract string PrintAssembly(MethodAnalysisContext context);
49-
}
49+
}

Cpp2IL.Core/Api/Cpp2IlOutputFormat.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public abstract class Cpp2IlOutputFormat
88
/// The ID of the output format as used when specifying an output format (e.g. in the command line)
99
/// </summary>
1010
public abstract string OutputFormatId { get; }
11-
11+
1212
/// <summary>
1313
/// The name of the output format displayed to the user (e.g. in logs or the GUI)
1414
/// </summary>
@@ -20,8 +20,7 @@ public abstract class Cpp2IlOutputFormat
2020
/// </summary>
2121
public virtual void OnOutputFormatSelected()
2222
{
23-
2423
}
25-
24+
2625
public abstract void DoOutput(ApplicationAnalysisContext context, string outputRoot);
27-
}
26+
}

Cpp2IL.Core/Api/Cpp2IlPlugin.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Cpp2IL.Core.Api;
99
public abstract class Cpp2IlPlugin
1010
{
1111
protected readonly PluginLogger Logger;
12-
12+
1313
private readonly List<string> temporaryFilePaths = [];
1414

1515
protected Cpp2IlPlugin()
@@ -24,16 +24,16 @@ public string GetTemporaryFilePath()
2424
temporaryFilePaths.Add(ret);
2525
return ret;
2626
}
27-
27+
2828
public abstract string Name { get; }
2929
public abstract string Description { get; }
30-
30+
3131
public abstract void OnLoad();
3232

33-
protected void RegisterBinaryFormat<T>(string name, Func<byte[], bool> isValid, Func<MemoryStream, T> factory) where T : Il2CppBinary =>
33+
protected void RegisterBinaryFormat<T>(string name, Func<byte[], bool> isValid, Func<MemoryStream, T> factory) where T : Il2CppBinary =>
3434
LibCpp2IlBinaryRegistry.Register(name, Name, isValid, factory);
35-
36-
protected void RegisterBinaryRegistrationFuncFallbackHandler(Il2CppBinary.RegistrationStructLocationFailureHandler handler) =>
35+
36+
protected void RegisterBinaryRegistrationFuncFallbackHandler(Il2CppBinary.RegistrationStructLocationFailureHandler handler) =>
3737
Il2CppBinary.OnRegistrationStructLocationFailure += handler;
3838

3939
/// <summary>
@@ -51,6 +51,7 @@ internal void CallOnFinish()
5151
{
5252
File.Delete(file);
5353
}
54+
5455
OnFinish();
5556
}
5657

@@ -59,6 +60,5 @@ internal void CallOnFinish()
5960
/// </summary>
6061
protected virtual void OnFinish()
6162
{
62-
6363
}
6464
}

Cpp2IL.Core/Api/Cpp2IlProcessingLayer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public abstract class Cpp2IlProcessingLayer
2323
/// <param name="layers">A list of all layers that will run, which you can modify freely. Only layers left in this list once all layers return from PreProcess will have Process called.</param>
2424
public virtual void PreProcess(ApplicationAnalysisContext context, List<Cpp2IlProcessingLayer> layers)
2525
{
26-
2726
}
2827

2928
/// <summary>
@@ -35,4 +34,4 @@ public virtual void PreProcess(ApplicationAnalysisContext context, List<Cpp2IlPr
3534
/// How you define steps is up to you - this is only used for providing user feedback.
3635
/// </param>
3736
public abstract void Process(ApplicationAnalysisContext appContext, Action<int, int>? progressCallback = null);
38-
}
37+
}

Cpp2IL.Core/Api/InstructionSetRegistry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ public static class InstructionSetRegistry
88
private static Dictionary<InstructionSetId, Cpp2IlInstructionSet> _registeredSets = new();
99

1010
public static void RegisterInstructionSet<T>(InstructionSetId forId) where T : Cpp2IlInstructionSet, new() => _registeredSets.Add(forId, new T());
11-
11+
1212
public static Cpp2IlInstructionSet GetInstructionSet(InstructionSetId forId) => _registeredSets[forId];
13-
}
13+
}

Cpp2IL.Core/Api/OutputFormatRegistry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ namespace Cpp2IL.Core.Api;
77
public static class OutputFormatRegistry
88
{
99
private static readonly Dictionary<string, Cpp2IlOutputFormat> _formatsById = new();
10-
10+
1111
public static IReadOnlyList<Cpp2IlOutputFormat> AllOutputFormats => _formatsById.Values.ToList();
1212

1313
public static void Register<T>() where T : Cpp2IlOutputFormat, new()
1414
{
1515
var format = new T();
1616
_formatsById.Add(format.OutputFormatId, format);
1717
}
18-
19-
public static Cpp2IlOutputFormat GetFormat(string formatId)
18+
19+
public static Cpp2IlOutputFormat GetFormat(string formatId)
2020
=> _formatsById.TryGetValue(formatId, out var format) ? format : throw new ArgumentException($"No output format registered with id '{formatId}'");
21-
}
21+
}

Cpp2IL.Core/Api/PluginLogger.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ internal PluginLogger(Cpp2IlPlugin plugin)
1212
_plugin = plugin;
1313
_name = $"Plugin: {plugin.Name}";
1414
}
15-
15+
1616
public void VerboseNewline(string message, string source = "Program") => Logger.VerboseNewline($"{message}", _name);
1717

1818
public void Verbose(string message, string source = "Program") => Logger.Verbose($"{message}", _name);
19-
19+
2020
public void InfoNewline(string message, string source = "Program") => Logger.InfoNewline($"{message}", _name);
2121

2222
public void Info(string message, string source = "Program") => Logger.Info($"{message}", _name);
23-
23+
2424
public void WarnNewline(string message, string source = "Program") => Logger.WarnNewline($"{message}", _name);
2525

2626
public void Warn(string message, string source = "Program") => Logger.Warn($"{message}", _name);
27-
27+
2828
public void ErrorNewline(string message, string source = "Program") => Logger.ErrorNewline($"{message}", _name);
2929

3030
public void Error(string message, string source = "Program") => Logger.Error($"{message}", _name);
31-
}
31+
}

Cpp2IL.Core/Api/ProcessingLayerRegistry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ namespace Cpp2IL.Core.Api;
77
public static class ProcessingLayerRegistry
88
{
99
private static readonly Dictionary<string, Cpp2IlProcessingLayer> _processingLayersById = new();
10-
10+
1111
public static IReadOnlyList<Cpp2IlProcessingLayer> AllProcessingLayers => _processingLayersById.Values.ToList();
1212

1313
public static void Register<T>() where T : Cpp2IlProcessingLayer, new()
1414
{
1515
var layer = new T();
1616
_processingLayersById.Add(layer.Id, layer);
1717
}
18-
19-
public static Cpp2IlProcessingLayer GetById(string id)
18+
19+
public static Cpp2IlProcessingLayer GetById(string id)
2020
=> _processingLayersById.TryGetValue(id, out var ret) ? ret : throw new ArgumentException($"No processing layer with id {id} registered");
21-
}
21+
}

Cpp2IL.Core/Cpp2IlCorePlugin.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@ namespace Cpp2IL.Core;
1515
public class Cpp2IlCorePlugin : Cpp2IlPlugin
1616
{
1717
public override string Name => "Cpp2IL Built-In";
18-
18+
1919
public override string Description => "Core Cpp2IL plugin containing built-in instruction sets, binaries, and other core functionality.";
20-
20+
2121
public override void OnLoad()
2222
{
2323
Logger.VerboseNewline("Initializing...", "Core Plugin");
2424
var start = DateTime.Now;
25-
25+
2626
Logger.VerboseNewline("\tRegistering built-in instruction set handlers...", "Core Plugin");
27-
27+
2828
InstructionSetRegistry.RegisterInstructionSet<X86InstructionSet>(DefaultInstructionSets.X86_32);
2929
InstructionSetRegistry.RegisterInstructionSet<X86InstructionSet>(DefaultInstructionSets.X86_64);
3030
InstructionSetRegistry.RegisterInstructionSet<WasmInstructionSet>(DefaultInstructionSets.WASM);
3131
InstructionSetRegistry.RegisterInstructionSet<ArmV7InstructionSet>(DefaultInstructionSets.ARM_V7);
32-
33-
if(Environment.GetEnvironmentVariable("CPP2IL_LEGACY_ARM64") != null)
32+
33+
if (Environment.GetEnvironmentVariable("CPP2IL_LEGACY_ARM64") != null)
3434
InstructionSetRegistry.RegisterInstructionSet<Arm64InstructionSet>(DefaultInstructionSets.ARM_V8);
3535
else
3636
InstructionSetRegistry.RegisterInstructionSet<NewArmV8InstructionSet>(DefaultInstructionSets.ARM_V8);
37-
37+
3838
Logger.VerboseNewline("\tRegistering built-in binary parsers...", "Core Plugin");
39-
39+
4040
LibCpp2IlBinaryRegistry.RegisterBuiltInBinarySupport();
41-
41+
4242
Logger.VerboseNewline("\tRegistering built-in output formats...", "Core Plugin");
43-
43+
4444
OutputFormatRegistry.Register<AsmResolverDllOutputFormatLegacy>();
4545
OutputFormatRegistry.Register<AsmResolverDllOutputFormatDefault>();
4646
OutputFormatRegistry.Register<AsmResolverDllOutputFormatEmpty>();
@@ -49,9 +49,9 @@ public override void OnLoad()
4949
OutputFormatRegistry.Register<DiffableCsOutputFormat>();
5050
OutputFormatRegistry.Register<IsilDumpOutputFormat>();
5151
OutputFormatRegistry.Register<WasmMappingOutputFormat>();
52-
52+
5353
Logger.VerboseNewline("\tRegistering built-in processing layers", "Core Plugin");
54-
54+
5555
ProcessingLayerRegistry.Register<AttributeAnalysisProcessingLayer>();
5656
ProcessingLayerRegistry.Register<AttributeInjectorProcessingLayer>();
5757
ProcessingLayerRegistry.Register<CallAnalysisProcessingLayer>();

Cpp2IL.Core/Cpp2IlPluginManager.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public static class Cpp2IlPluginManager
1818
internal static void LoadFromDirectory(string pluginsDir)
1919
{
2020
Logger.InfoNewline($"Loading plugins from {pluginsDir}...", "Plugins");
21-
22-
if(!Directory.Exists(pluginsDir))
21+
22+
if (!Directory.Exists(pluginsDir))
2323
return;
24-
24+
2525
foreach (var file in Directory.EnumerateFiles(pluginsDir))
2626
{
2727
if (Path.GetExtension(file) == ".dll")
@@ -31,37 +31,37 @@ internal static void LoadFromDirectory(string pluginsDir)
3131
}
3232
}
3333
}
34-
34+
3535
internal static void InitAll()
3636
{
3737
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
3838
Logger.VerboseNewline("Collecting and instantiating plugins...", "Plugins");
39-
39+
4040
foreach (var assembly in assemblies)
4141
{
4242
var attrs = assembly.GetCustomAttributes<RegisterCpp2IlPluginAttribute>().ToList();
43-
44-
if(attrs.Count == 0)
43+
44+
if (attrs.Count == 0)
4545
continue;
46-
46+
4747
foreach (var registerCpp2IlPluginAttribute in attrs)
4848
{
4949
Cpp2IlPlugin plugin;
5050
try
5151
{
5252
Logger.VerboseNewline($"\tLoading plugin {registerCpp2IlPluginAttribute.PluginType.FullName} from assembly: {assembly.GetName().Name}.dll", "Plugins");
53-
plugin = (Cpp2IlPlugin) Activator.CreateInstance(registerCpp2IlPluginAttribute.PluginType)!;
53+
plugin = (Cpp2IlPlugin)Activator.CreateInstance(registerCpp2IlPluginAttribute.PluginType)!;
5454
}
5555
catch (Exception e)
5656
{
5757
Logger.ErrorNewline($"Plugin {registerCpp2IlPluginAttribute.PluginType.FullName} from assembly {assembly.GetName().Name} threw an exception during construction: {e}. It will not be loaded.", "Plugins");
5858
continue;
5959
}
60-
60+
6161
_loadedPlugins.Add(plugin);
6262
}
6363
}
64-
64+
6565
Logger.VerboseNewline("Invoking OnLoad on " + _loadedPlugins.Count + " plugins.", "Plugins");
6666
foreach (var plugin in _loadedPlugins)
6767
{
@@ -76,6 +76,7 @@ internal static void InitAll()
7676
_loadedPlugins.Remove(plugin);
7777
}
7878
}
79+
7980
Logger.VerboseNewline("OnLoad complete", "Plugins");
8081
}
8182

Cpp2IL.Core/Cpp2IlRuntimeArgs.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class Cpp2IlRuntimeArgs
88
{
99
//To determine easily if this struct is the default one or not.
1010
public bool Valid;
11-
11+
1212
//Core variables
1313
public UnityVersion UnityVersion;
1414
public string PathToAssembly = null!;
@@ -18,9 +18,9 @@ public class Cpp2IlRuntimeArgs
1818

1919
public List<Cpp2IlProcessingLayer> ProcessingLayersToRun = [];
2020
public readonly Dictionary<string, string> ProcessingLayerConfigurationOptions = new();
21-
21+
2222
public Cpp2IlOutputFormat? OutputFormat;
2323
public string OutputRootDirectory = null!;
24-
24+
2525
public bool LowMemoryMode;
26-
}
26+
}

Cpp2IL.Core/Exceptions/DllSaveException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ public class DllSaveException(string fullPath, Exception cause)
77
{
88
public string FullPath { get; } = fullPath;
99
public Exception Cause { get; } = cause;
10-
}
10+
}

Cpp2IL.Core/Exceptions/InstructionSetHandlerNotRegisteredException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
namespace Cpp2IL.Core.Exceptions;
55

66
public class InstructionSetHandlerNotRegisteredException(InstructionSetId instructionSetId) : Exception(
7-
$"Instruction set handler not registered for instruction set {instructionSetId.Name}. Please register an instruction set handler using InstructionSetRegistry.RegisterInstructionSet<T>(id)");
7+
$"Instruction set handler not registered for instruction set {instructionSetId.Name}. Please register an instruction set handler using InstructionSetRegistry.RegisterInstructionSet<T>(id)");

Cpp2IL.Core/Exceptions/LibCpp2ILInitializationException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
namespace Cpp2IL.Core.Exceptions;
44

55
public class LibCpp2ILInitializationException(string message, Exception innerException)
6-
: Exception(message, innerException);
6+
: Exception(message, innerException);

Cpp2IL.Core/Exceptions/LibraryNotInitializedException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ namespace Cpp2IL.Core.Exceptions;
55
public class LibraryNotInitializedException : Exception
66
{
77
public override string Message => "This function requires LibCpp2IL to be initialized - there is a function to do this in Cpp2IlApi.";
8-
}
8+
}

Cpp2IL.Core/Exceptions/NodeConditionCalculationException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
namespace Cpp2IL.Core.Exceptions;
44

5-
public class NodeConditionCalculationException(string message) : Exception(message);
5+
public class NodeConditionCalculationException(string message) : Exception(message);

0 commit comments

Comments
 (0)