Example #1
0
        public static Process[] GetTibiaProcesses()
        {
            if (TibiaProcessId >= 0)
            {
                Process[] ids = Process.GetProcesses();
                for (int i = 0; i < ids.Length; ++i)
                {
                    if (ids[i].Id == TibiaProcessId)
                    {
                        MemoryReader.SetProcess(ids[i]);
                        return(new Process[1] {
                            ids[i]
                        });
                    }
                }

                TibiaProcessId = -1;
            }
            Process[] p = Process.GetProcessesByName(TibiaClientName);
            if (p.Length > 0)
            {
                if (TibiaClientName.Contains("flash", StringComparison.OrdinalIgnoreCase))
                {
                    return(p);
                }
                if (TibiaClientName.Contains("tibia", StringComparison.OrdinalIgnoreCase))
                {
                    MemoryReader.SetProcess(p[0]);
                }
                return(new Process[1] {
                    p[0]
                });
            }
            return(null);
        }