25 lines
855 B
C#
25 lines
855 B
C#
|
using System.Text.RegularExpressions;
|
|||
|
using Mono.Cecil;
|
|||
|
|
|||
|
Console.WriteLine("Starting assembly editing...");
|
|||
|
var fileRegex =
|
|||
|
new Regex(".*(Techblox|Gamecraft|RobocraftX|FullGame|RobocraftECS|DataLoader|RCX|GameState|Svelto\\.ECS)[^/]*(\\.dll)");
|
|||
|
foreach (var file in Directory.EnumerateFiles(@"../../../../../ref/Techblox_Data/Managed"))
|
|||
|
{
|
|||
|
if (!fileRegex.IsMatch(file)) continue;
|
|||
|
Console.WriteLine(file);
|
|||
|
ProcessAssembly(file);
|
|||
|
}
|
|||
|
|
|||
|
void ProcessAssembly(string path)
|
|||
|
{
|
|||
|
var mod = ModuleDefinition.ReadModule(path, new(ReadingMode.Immediate) { ReadWrite = true });
|
|||
|
foreach (var typeDefinition in mod.Types)
|
|||
|
{
|
|||
|
typeDefinition.IsPublic = true;
|
|||
|
foreach (var method in typeDefinition.Methods) method.IsPublic = true;
|
|||
|
foreach (var field in typeDefinition.Fields) field.IsPublic = true;
|
|||
|
}
|
|||
|
|
|||
|
mod.Write();
|
|||
|
}
|