Ejemplo n.º 1
0
 public MemoryHelper.Module GetModule(string ModuleName)
 {
     if (this.moduleDict.ContainsKey(ModuleName))
     {
         return(this.moduleDict[ModuleName]);
     }
     MemoryHelper.Module module = MemoryHelper.GetModule(this.process, ModuleName);
     this.moduleDict.Add(ModuleName, module);
     return(module);
 }
Ejemplo n.º 2
0
        private void PluginInit(string profile, IntPtr intPtr)
        {
            string input = this.readProfile(profile);
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            this.profilePath = profile;
            this.profile     = serializer.Deserialize <Profile>(input);
            Process[] processes = this.GetProcesses(this.profile.process);
            if (processes.Count <Process>() <= 0)
            {
                throw new Exception("没有找到指定进程");
            }
            this.process = processes[0];
            bool flag = false;

            foreach (GameverItem item in this.profile.gamever)
            {
                this.gameMemory = new ProcessMemory(this.process);
                int num = getProcessBits(this.process);
                if (getProcessBits() != num)
                {
                    throw new Exception("请使用" + num + " bit 外挂程序");
                }
                try {
                    MemoryHelper.Module module = this.gameMemory.GetModule(item.module);
                    string str2 = this.getMD5HashFromFile(module.szExePath);
                    if (item.fileMd5 != "")
                    {
                        if (!(item.fileMd5.ToLower() == str2.ToLower()))
                        {
                            continue;
                        }
                        this.gamever_ = item;
                        flag          = true;
                        break;
                    }
                    if (this.getFileVersion(module.szExePath) == item.version)
                    {
                        this.gamever_ = item;
                        flag          = true;
                        break;
                    }
                } catch {
                }
            }
            if (!flag)
            {
                throw new Exception("不支持当前游戏版本");
            }
            foreach (BaseAddresses addresses in this.profile.baseAddress)
            {
                if (addresses.flag == this.gamever_.baseAddress)
                {
                    this.baseAddress.Clear();
                    foreach (BaseAddress address in addresses.value)
                    {
                        this.baseAddress.Add(address.dictKey, address);
                    }
                    break;
                }
            }
            foreach (Memories memories in this.profile.memories)
            {
                if (memories.flag == this.gamever_.memory)
                {
                    this.memories.Clear();
                    foreach (Memory memory in memories.value)
                    {
                        this.memories.Add(memory.dictKey, memory);
                    }
                    break;
                }
            }
            this.formIntPtr = intPtr;
            this.plugins.Clear();
            this.pluginMemory.Clear();
            foreach (PluginItem item2 in this.profile.plugins)
            {
                if (item2.hotkey != "")
                {
                    if (this.registerHotKey(item2.hotkey, this.shortcut.Count <string>() + 0x3e8) == 0)
                    {
                        item2.hotkey = "!!Failed!!";
                    }
                    else
                    {
                        this.shortcut.Add(item2.dictKey);
                    }
                }
                this.pluginMemory.Add(item2.dictKey, item2.memories);
                this.plugins.Add(item2.dictKey, item2);
                if ((item2.verifyKey == "") || (item2.verifyKey == null))
                {
                    item2.verifyKey = item2.dictKey;
                }
                item2.verifyDict = new Dictionary <uint, string>();
                if (item2.verifys != null)
                {
                    foreach (Verify verify in item2.verifys)
                    {
                        if (!item2.verifyDict.ContainsKey(sting2uint(verify.value)))
                        {
                            item2.verifyDict.Add(sting2uint(verify.value), verify.name);
                        }
                    }
                }
            }
            this.lockedMemory.Clear();
            new Thread(new ThreadStart(this.lockedMem)).Start();
            this.isInit = true;
        }