public static bool CheckVersion(int processId) { var memory = new BlackMagic(processId); System.Diagnostics.Process processById = System.Diagnostics.Process.GetProcessById(processId); uint baseModule = 0; foreach (ProcessModule v in from ProcessModule v in memory.Modules where String.Equals(v.ModuleName, (processById.ProcessName + ".exe"), StringComparison.CurrentCultureIgnoreCase) select v) { baseModule = (uint)v.BaseAddress; } string textBuild = memory.ReadUTF8String(baseModule + (uint)Addresses.GameInfo.buildWoWVersionString); uint wowBuildVersion = Helpers.Usefuls.WowVersion(textBuild); return(wowBuildVersion == Information.TargetWowBuild); }
public static string PlayerName(int processId) { try { if (!CheckVersion(processId)) { return("This version of the bot is for WoW " + Information.TargetWowBuild + " only."); } if (!IsInGame(processId)) { return(Translate.Get(Translate.Id.Please_connect_to_the_game)); } // init memory var memory = new BlackMagic(processId); // System.Diagnostics.Process processById = System.Diagnostics.Process.GetProcessById(processId); uint baseModule = 0; foreach (ProcessModule v in from ProcessModule v in memory.Modules where String.Equals(v.ModuleName, (processById.ProcessName + ".exe"), StringComparison.CurrentCultureIgnoreCase) select v) { baseModule = (uint)v.BaseAddress; } string pName = memory.ReadUTF8String(baseModule + (uint)Addresses.Player.playerName); if (!String.IsNullOrEmpty(pName)) { return(pName); } } catch (Exception e) { Logging.WriteError("PlayerName(int processId): " + e); } return("No Name"); }