Skip to content

Commit

Permalink
Rename and cleanup the project
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyw15 committed May 4, 2024
1 parent 516676c commit b97b275
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Activator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using CeVIO;

namespace CeVIO_crack
namespace CeVIOActivator
{
public class Activator
{
Expand Down
23 changes: 22 additions & 1 deletion AssemblyPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,32 @@
using Mono.Cecil;
using Mono.Cecil.Cil;

namespace CeVIO_crack
namespace CeVIOActivator
{
public static class AssemblyPatcher
{
private const string TARGET_FILE = "CeVIO.ToolBarControl.dll";

[Obsolete("Directly patch executable will make it not work. Use PatchFile instead.")]
public static void PatchExecutable(string cevioExecutablePath)
{
var resolver = new DefaultAssemblyResolver();
resolver.AddSearchDirectory(Path.GetDirectoryName(cevioExecutablePath));

var asm = AssemblyDefinition.ReadAssembly(cevioExecutablePath, new ReaderParameters
{
AssemblyResolver = resolver
});
var type = asm.MainModule.GetType("CeVIO.Editor.MissionAssistant.Authorizer");
var setter = type.Properties.First(x => x.Name == "HasAuthorized").SetMethod;
var method = type.Methods.First(x => x.Name == "Authorize");
var processor = method.Body.GetILProcessor();
processor.Replace(method.Body.Instructions[2], processor.Create(OpCodes.Nop));
processor.Replace(method.Body.Instructions[3], processor.Create(OpCodes.Ldc_I4_1));
processor.Replace(method.Body.Instructions[4], processor.Create(OpCodes.Call, setter));
asm.Write("CeVIO AI.exe");
}

public static void PatchFile(string cevioInstallPath)
{
// System.Void CeVIO.ToolBarControl.ToolBarControl::.cctor()
Expand Down
5 changes: 2 additions & 3 deletions CeVIO_crack.csproj → CeVIOActivator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C4C89199-DB69-48E4-AD2F-18407B53683F}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CeVIO_crack</RootNamespace>
<AssemblyName>CeVIO_crack</AssemblyName>
<RootNamespace>CeVIOActivator</RootNamespace>
<AssemblyName>CeVIOActivator</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
Expand Down Expand Up @@ -87,7 +87,6 @@
<ItemGroup>
<Compile Include="Activator.cs" />
<Compile Include="CeVIO.cs" />
<Compile Include="ExecutableModifier.cs" />
<Compile Include="AssemblyPatcher.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion CeVIO_crack.sln → CeVIOActivator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CeVIO_crack", "CeVIO_crack.csproj", "{C4C89199-DB69-48E4-AD2F-18407B53683F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CeVIOActivator", "CeVIOActivator.csproj", "{C4C89199-DB69-48E4-AD2F-18407B53683F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
29 changes: 0 additions & 29 deletions ExecutableModifier.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.IO;
using Microsoft.Win32;

namespace CeVIO_crack
namespace CeVIOActivator
{
class Program
{
Expand Down

0 comments on commit b97b275

Please sign in to comment.