clean up codes

before-split
walon 2025-05-30 13:32:29 +08:00
parent b9061c567c
commit cad7fff2d1
99 changed files with 91 additions and 443 deletions

View File

@ -2,11 +2,7 @@
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEditor.VersionControl;
using UnityEngine;
namespace Obfuz.Conf
@ -17,7 +13,7 @@ namespace Obfuz.Conf
}
public interface IMethodRule<R> where R: IRule<R>
public interface IMethodRule<R> where R : IRule<R>
{
string Name { get; set; }
NameMatcher NameMatcher { get; set; }
@ -33,7 +29,7 @@ namespace Obfuz.Conf
public R Rule { get; set; }
}
public interface ITypeRule<T, R> where T: IMethodRule<R> where R : IRule<R>
public interface ITypeRule<T, R> where T : IMethodRule<R> where R : IRule<R>
{
string Name { get; set; }

View File

@ -2,12 +2,7 @@
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEditor.VersionControl;
using UnityEngine;
namespace Obfuz.Conf
{

View File

@ -3,9 +3,6 @@ using Obfuz.ObfusPasses;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEngine;
@ -189,7 +186,7 @@ namespace Obfuz
ObfuscationPassType passType = ObfuscationPassType.None;
foreach (var passName in obfuscationPassTypesStr.Split('|'))
{
if (Enum.TryParse< ObfuscationPassType>(passName, out var pass))
if (Enum.TryParse<ObfuscationPassType>(passName, out var pass))
{
passType |= pass;
}

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Editor
namespace Obfuz.Editor
{
public static class ConstValues
{

View File

@ -6,11 +6,6 @@ using Obfuz.Utils;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Assertions;
namespace Obfuz.Data

View File

@ -4,9 +4,7 @@ using Obfuz.Emit;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.Assertions;
namespace Obfuz.Data

View File

@ -3,9 +3,6 @@ using dnlib.DotNet.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Emit
{

View File

@ -1,9 +1,6 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Emit
{
@ -45,7 +42,7 @@ namespace Obfuz.Emit
}
}
public List<T> GetEntities<T>() where T: IGroupByModuleEntity
public List<T> GetEntities<T>() where T : IGroupByModuleEntity
{
var managers = new List<T>();
foreach (var kv in _moduleEntityManagers)

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -2,7 +2,7 @@
namespace Obfuz.EncryptionVM.Instructions
{
public class XorInstruction : EncryptionInstructionBase
public class XorInstruction : EncryptionInstructionBase
{
private readonly int _xorValue;
private readonly int _opKeyIndex;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions
{

View File

@ -1,11 +1,8 @@
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.EncryptionVM

View File

@ -1,10 +1,7 @@
using NUnit.Framework;
using Obfuz.EncryptionVM.Instructions;
using Obfuz.EncryptionVM.Instructions;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using UnityEngine.Assertions;
using UnityEngine.UIElements;
namespace Obfuz.EncryptionVM
{

View File

@ -1,12 +1,6 @@
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.UIElements;
namespace Obfuz.EncryptionVM
{
@ -47,7 +41,7 @@ namespace Obfuz.EncryptionVM
byte[] strBytes = Encrypt("abcdef", ops, salt);
Assert.AreEqual("abcdef", DecryptString(strBytes, 0, strBytes.Length, ops, salt));
var arr = new byte[100];
for (int i = 0; i < arr.Length ; i++)
for (int i = 0; i < arr.Length; i++)
{
arr[i] = (byte)i;
}

View File

@ -1,9 +1,4 @@
using Obfuz.ObfusPasses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{

View File

@ -1,8 +1,8 @@
using dnlib.DotNet.Emit;
using dnlib.DotNet;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Emit;
using System.Collections.Generic;
using System.Linq;
using Obfuz.Emit;
namespace Obfuz.ObfusPasses
{

View File

@ -1,15 +1,9 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Utils;
using Obfuz.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.Assertions;
using Obfuz.Settings;
using Obfuz.Utils;
using System.Collections.Generic;
namespace Obfuz.ObfusPasses.CallObfus
{

View File

@ -7,8 +7,6 @@ using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MethodImplAttributes = dnlib.DotNet.MethodImplAttributes;
using TypeAttributes = dnlib.DotNet.TypeAttributes;
@ -211,7 +209,7 @@ namespace Obfuz.ObfusPasses.CallObfus
salt = salt,
encryptedIndex = encryptedIndex,
};
methodDispatcher.methods.Add(new CallInfo { method = method, callVir = callVir});
methodDispatcher.methods.Add(new CallInfo { method = method, callVir = callVir });
_methodProxys.Add(key, proxyInfo);
}
return new ProxyCallMethodData(proxyInfo.proxyMethod, proxyInfo.encryptedOps, proxyInfo.salt, proxyInfo.encryptedIndex, proxyInfo.index);

View File

@ -3,11 +3,7 @@ using Obfuz.Conf;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEngine;
namespace Obfuz.ObfusPasses.CallObfus
{

View File

@ -1,11 +1,10 @@
using dnlib.DotNet.Emit;
using dnlib.DotNet;
using System.Collections.Generic;
using Obfuz.Utils;
using Obfuz.Emit;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Data;
using UnityEngine;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System.Collections.Generic;
namespace Obfuz.ObfusPasses.CallObfus
{

View File

@ -1,9 +1,4 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.CallObfus
{

View File

@ -1,10 +1,6 @@
using dnlib.DotNet.Emit;
using dnlib.DotNet;
using System;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.CallObfus
{

View File

@ -1,10 +1,5 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.CleanUp
{

View File

@ -1,11 +1,6 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.CleanUp
{

View File

@ -4,10 +4,7 @@ using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEngine;
namespace Obfuz.ObfusPasses.ConstEncrypt
{

View File

@ -2,15 +2,7 @@
using dnlib.DotNet.Emit;
using Obfuz.Emit;
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Assertions;
namespace Obfuz.ObfusPasses.ConstEncrypt
{

View File

@ -1,14 +1,12 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz.Emit;
using Obfuz.Data;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Text;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.Settings;
using UnityEngine.Assertions.Must;
using Obfuz.Utils;
using System.Collections.Generic;
using System.Text;
namespace Obfuz.ObfusPasses.ConstEncrypt
{

View File

@ -1,6 +1,5 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System;
using System.Collections.Generic;
namespace Obfuz.ObfusPasses.ConstEncrypt

View File

@ -1,9 +1,4 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.ConstEncrypt
{

View File

@ -1,10 +1,6 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.ExprObfus
{

View File

@ -1,7 +1,6 @@
using dnlib.DotNet;
using Obfuz.Conf;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Xml;

View File

@ -5,8 +5,6 @@ using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using UnityEngine.Assertions;
namespace Obfuz.ObfusPasses.FieldEncrypt
@ -29,7 +27,7 @@ namespace Obfuz.ObfusPasses.FieldEncrypt
return _moduleEntityManager.GetDefaultModuleMetadataImporter(method.Module, _encryptionScopeProvider);
}
class FieldEncryptInfo
class FieldEncryptInfo
{
public int encryptOps;
public int salt;
@ -47,7 +45,7 @@ namespace Obfuz.ObfusPasses.FieldEncrypt
case ElementType.I4:
case ElementType.U4:
case ElementType.R4:
return encryptor.Encrypt(0, encryptOps, salt);
return encryptor.Encrypt(0, encryptOps, salt);
case ElementType.I8:
case ElementType.U8:
case ElementType.R8:

View File

@ -1,11 +1,7 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuz;
using Obfuz.Settings;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Obfuz.ObfusPasses.FieldEncrypt
{

View File

@ -1,9 +1,4 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.FieldEncrypt
{

View File

@ -1,9 +1,6 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.FieldEncrypt
{

View File

@ -1,5 +1,5 @@
using dnlib.DotNet.Emit;
using dnlib.DotNet;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,6 +1,4 @@
using Obfuz.Emit;
namespace Obfuz.ObfusPasses
namespace Obfuz.ObfusPasses
{
public abstract class ObfuscationPassBase : IObfuscationPass
{

View File

@ -1,5 +1,4 @@
using dnlib.DotNet;
using System.Text;
using System.Text;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
{

View File

@ -1,9 +1,6 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.Assertions;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
@ -59,7 +56,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
public bool IsNamePreserved(VirtualMethodGroup virtualMethodGroup, string name)
{
return virtualMethodGroup.GetNameConflictTypeScopes().Any(m => GetNameScope(m).IsNamePreserved(name));
return virtualMethodGroup.GetNameConflictTypeScopes().Any(m => GetNameScope(m).IsNamePreserved(name));
}
private string GetDefaultNewName(object scope, string originName)

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
{

View File

@ -1,5 +1,4 @@
using Microsoft.SqlServer.Server;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers

View File

@ -1,8 +1,4 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers
{

View File

@ -1,6 +1,5 @@
using dnlib.DotNet;
using System.Collections.Generic;
using System.Linq;
namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{

View File

@ -1,13 +1,9 @@
using dnlib.DotNet;
using Obfuz.Conf;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using UnityEngine;
namespace Obfuz.ObfusPasses.SymbolObfus.Policies

View File

@ -1,9 +1,4 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{

View File

@ -1,11 +1,7 @@
using dnlib.DotNet;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{

View File

@ -5,10 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using UnityEngine;
namespace Obfuz.ObfusPasses.SymbolObfus

View File

@ -1,9 +1,4 @@
using Obfuz.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.SymbolObfus
{

View File

@ -1,17 +1,12 @@
using dnlib.DotNet;
using Obfuz.ObfusPasses.SymbolObfus;
using Obfuz.ObfusPasses.SymbolObfus.NameMakers;
using Obfuz.ObfusPasses.SymbolObfus.Policies;
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Assertions;
@ -50,7 +45,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus
_obfuscationRuleFiles = settings.ruleFiles.ToList();
_renameRecordMap = new RenameRecordMap(settings.symbolMappingFile, settings.debug);
_virtualMethodGroupCalculator = new VirtualMethodGroupCalculator();
_nameMaker = settings.debug ? NameMakerFactory.CreateDebugNameMaker() : NameMakerFactory.CreateNameMakerBaseASCIICharSet(settings.obfuscatedNamePrefix);
_nameMaker = settings.debug ? NameMakerFactory.CreateDebugNameMaker() : NameMakerFactory.CreateNameMakerBaseASCIICharSet(settings.obfuscatedNamePrefix);
foreach (var customPolicyType in settings.customRenamePolicyTypes)
{
@ -73,7 +68,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus
_obfuscatedAndNotObfuscatedModules = ctx.allObfuscationRelativeModules;
_toObfuscatedModuleSet = new HashSet<ModuleDef>(ctx.modulesToObfuscate);
var obfuscateRuleConfig = new ConfigurableRenamePolicy(ctx.coreSettings.assembliesToObfuscate, ctx.modulesToObfuscate, _obfuscationRuleFiles);
var obfuscateRuleConfig = new ConfigurableRenamePolicy(ctx.coreSettings.assembliesToObfuscate, ctx.modulesToObfuscate, _obfuscationRuleFiles);
var totalRenamePolicies = new List<IObfuscationPolicy>
{
new SupportPassPolicy(ctx.passPolicy),
@ -142,7 +137,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus
}
foreach (EventDef eventDef in type.Events)
{
CollectCArgumentWithTypeOf (eventDef, customAttributes);
CollectCArgumentWithTypeOf(eventDef, customAttributes);
}
}
@ -577,7 +572,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus
{
newVirtualMethodName = existVirtualMethodName;
}
else if(newVirtualMethodName != existVirtualMethodName)
else if (newVirtualMethodName != existVirtualMethodName)
{
Debug.LogWarning($"Virtual method rename conflict. {m} => {existVirtualMethodName} != {newVirtualMethodName}");
conflict = true;

View File

@ -1,10 +1,6 @@
using dnlib.DotNet;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.ObfusPasses.SymbolObfus
{

View File

@ -1,11 +1,7 @@
using dnlib.DotNet;
using Obfuz.Editor;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz

View File

@ -1,14 +1,8 @@
using dnlib.DotNet;
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.ObfusPasses;
using Obfuz.ObfusPasses.SymbolObfus;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{

View File

@ -2,7 +2,6 @@
using Obfuz.Data;
using Obfuz.Emit;
using Obfuz.EncryptionVM;
using Obfuz.ObfusPasses;
using Obfuz.ObfusPasses.CleanUp;
using Obfuz.ObfusPasses.SymbolObfus;
using Obfuz.Unity;
@ -11,10 +10,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using IAssemblyResolver = Obfuz.Utils.IAssemblyResolver;
namespace Obfuz
{
@ -141,7 +137,7 @@ namespace Obfuz
throw new Exception($"class Obfuz.EncryptionVM.GeneratedEncryptionVirtualMachine found in multiple assemblies! Please retain only one!");
}
var gvmInstance = (IEncryptor)Activator.CreateInstance(generatedVmTypes[0], new object[] { secretKey } );
var gvmInstance = (IEncryptor)Activator.CreateInstance(generatedVmTypes[0], new object[] { secretKey });
VerifyVm(vm, vms, gvmInstance);

View File

@ -1,5 +1,4 @@
using Obfuz.ObfusPasses;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
namespace Obfuz

View File

@ -1,8 +1,6 @@
using NUnit.Framework;
using Obfuz.Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Remoting.Messaging;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;

View File

@ -1,8 +1,4 @@
using System;
using System.Reflection;
using UnityEditor;
using UnityEditor.Presets;
using UnityEngine;
using UnityEngine.UIElements;
namespace Obfuz.Settings
@ -74,7 +70,7 @@ namespace Obfuz.Settings
public override void OnGUI(string searchContext)
{
if (_serializedObject == null||!_serializedObject.targetObject)
if (_serializedObject == null || !_serializedObject.targetObject)
{
InitGUI();
}

View File

@ -1,5 +1,4 @@
using System;
using System.IO;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,10 +1,7 @@
using Obfuz.ObfusPasses.SymbolObfus;
using Obfuz.Utils;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Settings

View File

@ -1,18 +1,15 @@
using Obfuz.Settings;
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.UnityLinker;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
using FileUtil = Obfuz.Utils.FileUtil;
namespace Obfuz.Unity

View File

@ -1,18 +1,14 @@
using System;
using dnlib.DotNet;
using Obfuz.Settings;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor.Build;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
using UnityEditor.Compilation;
using Obfuz.Utils;
using FileUtil = Obfuz.Utils.FileUtil;
using Obfuz.Settings;
using dnlib.DotNet;
namespace Obfuz.Unity
{
@ -145,4 +141,4 @@ namespace Obfuz.Unity
}
}
#endif
}
}

View File

@ -1,10 +1,7 @@
using Obfuz.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

View File

@ -1,10 +1,6 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
namespace Obfuz.Utils
{
public abstract class AssemblyResolverBase : IAssemblyResolver
{

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Obfuz.Utils
{
@ -18,7 +14,7 @@ namespace Obfuz.Utils
public static V GetValueOrDefault<K, V>(this Dictionary<K, V> dic, K key)
{
return dic.TryGetValue(key, out V v) ? v : default(V);
return dic.TryGetValue(key, out V v) ? v : default(V);
}
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Configuration.Assemblies;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.Utils

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -2,8 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{
@ -20,24 +18,24 @@ namespace Obfuz.Utils
public TypeSig Resolve(TypeSig typeSig)
{
if (!typeSig.ContainsGenericParameter)
if (!typeSig.ContainsGenericParameter)
{
return typeSig;
return typeSig;
}
typeSig = typeSig.RemovePinnedAndModifiers();
switch (typeSig.ElementType)
{
case ElementType.Ptr: return new PtrSig(Resolve(typeSig.Next));
case ElementType.ByRef: return new ByRefSig(Resolve(typeSig.Next));
switch (typeSig.ElementType)
{
case ElementType.Ptr: return new PtrSig(Resolve(typeSig.Next));
case ElementType.ByRef: return new ByRefSig(Resolve(typeSig.Next));
case ElementType.SZArray: return new SZArraySig(Resolve(typeSig.Next));
case ElementType.Array:
case ElementType.Array:
{
var ara = (ArraySig)typeSig;
return new ArraySig(Resolve(typeSig.Next), ara.Rank, ara.Sizes, ara.LowerBounds);
}
case ElementType.Var:
case ElementType.Var:
{
GenericVar genericVar = (GenericVar)typeSig;
var newSig = Resolve(typeArgsStack, genericVar.Number);
@ -48,7 +46,7 @@ namespace Obfuz.Utils
return newSig;
}
case ElementType.MVar:
case ElementType.MVar:
{
GenericMVar genericVar = (GenericMVar)typeSig;
var newSig = Resolve(methodArgsStack, genericVar.Number);
@ -58,13 +56,13 @@ namespace Obfuz.Utils
}
return newSig;
}
case ElementType.GenericInst:
case ElementType.GenericInst:
{
var gia = (GenericInstSig)typeSig;
return new GenericInstSig(gia.GenericType, gia.GenericArguments.Select(ga => Resolve(ga)).ToList());
}
case ElementType.FnPtr:
case ElementType.FnPtr:
{
var fptr = (FnPtrSig)typeSig;
var cs = fptr.Signature;
@ -91,13 +89,13 @@ namespace Obfuz.Utils
return new FnPtrSig(ccs);
}
case ElementType.ValueArray:
case ElementType.ValueArray:
{
var vas = (ValueArraySig)typeSig;
return new ValueArraySig(Resolve(vas.Next), vas.Size);
}
default: return typeSig;
}
}
}
private TypeSig Resolve(List<TypeSig> args, uint number)

View File

@ -1,11 +1,6 @@
using dnlib.DotNet;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.UIElements;
namespace Obfuz.Utils
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
namespace Obfuz.Utils
{
public interface IAssemblyResolver
{

View File

@ -1,10 +1,6 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -4,11 +4,8 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.Assertions;
using UnityEngine.UIElements;
namespace Obfuz.Utils
{

View File

@ -1,11 +1,6 @@
using dnlib.DotNet;
using Obfuz.Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using System.IO;
namespace Obfuz.Utils
{
@ -19,7 +13,7 @@ namespace Obfuz.Utils
public override string ResolveAssembly(string assemblyName)
{
foreach(var path in _searchPaths)
foreach (var path in _searchPaths)
{
string assPath = Path.Combine(path, assemblyName + ".dll");
if (File.Exists(assPath))

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor;
namespace Obfuz.Utils
{

View File

@ -1,11 +1,4 @@
using Obfuz.Emit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
namespace Obfuz.Utils
{
public class RandomWithKey : IRandom
{

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,9 +1,7 @@
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{

View File

@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Assertions;
namespace Obfuz

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{

View File

@ -21,7 +21,7 @@
}
}
public struct DefaultStaticEncryptionScope: IEncryptionScope
public struct DefaultStaticEncryptionScope : IEncryptionScope
{
public void ForcePreserveAOT()
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
namespace Obfuz
{
public static class EncryptionService<T> where T : IEncryptionScope

View File

@ -1,7 +1,5 @@
using JetBrains.Annotations;
using System;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.Assertions;
@ -249,7 +247,7 @@ namespace Obfuz
public virtual unsafe void DecryptBlock(byte[] data, int ops, int salt)
{
fixed(byte* dataPtr = &data[0])
fixed (byte* dataPtr = &data[0])
{
DecryptBlock(dataPtr, data.Length, ops, salt);
}

View File

@ -1,8 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Obfuz
namespace Obfuz
{
public interface IEncryptor
{

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{