我制作了一个fifa15培训者脚本,但是在将其发送给其他人时遇到了麻烦,要对其进行调试,我要求另一个用户运行.exe并向我发送日志,但是他说该程序只是打开和关闭。这可能是兼容性问题吗?
我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace cheat_birthyear
{
class Program
{
public static string path;
public static IntPtr BaseAddress = IntPtr.Zero;
static void Main(string[] args)
{
Process[] processes = Process.GetProcessesByName("fifa15");
if(processes.Length > 0)
{
IntPtr BaseAddress = IntPtr.Zero;
Process MyProc = processes[0];
foreach(ProcessModule module in MyProc.Modules)
{
if (module.ModuleName.Contains("fifa15"))
{
BaseAddress = module.BaseAddress;
path = module.FileName;
Console.WriteLine(path);
}
}
if (BaseAddress != IntPtr.Zero)
{
VAMemory memory = new VAMemory("fifa15");
long finalAddress = memory.ReadInt64((IntPtr)BaseAddress + 0x01F441E8);
Console.WriteLine(finalAddress);
int newaddr = memory.ReadInt32( (IntPtr)finalAddress + 0x390);
Console.WriteLine(newaddr);
Console.ReadLine();
string yearPath = path.Replace("fifa15.exe", "cheat_birthyear\\birthyear.txt");
string[] lines = System.IO.File.ReadAllLines(@yearPath);
string yearVal = lines[0];
//float Basefifthvalue = memory.ReadFloat((IntPtr)newaddr);
//Console.WriteLine(Basefifthvalue);
memory.WriteInt32((IntPtr)finalAddress + 0x390, 1998);
}
else
{
Console.WriteLine("baseaddress não encontrado");
Console.ReadLine();
}
}
else
{
Console.WriteLine("jogo não encontrado");
Console.ReadLine();
}
}
}
}
这些是我编译并生成发布版本时的生成器文件
是否有任何调试方法,所以我知道程序是否在另一台计算机上正确运行?
您的应用程序可以采用3条路径
[如果是一号和二号,您添加了Console.ReadLine()
调用,它将在代码完成后使控制台保持打开状态。看来您在#3和#4中忘记了这一点。
[也许尝试重组代码以始终调用Console.ReadLine()
,以便控制台保持打开状态,他们可以看到结果。可能是这样的:
using System;
//... the rest of the imports
namespace cheat_birthyear
{
class Program
{
//... other class code
static void Main(string[] args)
{
try {
//... your code here
} finally {
Console.ReadLine()
}
}
}
}