Пример #1
0
        public Interface.InterfaceError Initialize(string user, string password)
        {
            Interface.b.Trace("Initializing game interface...");
            List <Interface.WindowInfo> windowList = Interface.GetWindowList(this.e);

            if (windowList.Count <= 0)
            {
                return(Interface.InterfaceError.CLIENT_NOT_FOUND);
            }
            this.f = windowList[0];
            Interface.InterfaceError interfaceError1 = this.e();
            if (interfaceError1 != Interface.InterfaceError.SUCCESS)
            {
                return(interfaceError1);
            }
            Interface.InterfaceError interfaceError2 = this.RetrievePointers(user, password);
            if (interfaceError2 != Interface.InterfaceError.SUCCESS)
            {
                this.Shutdown();
                return(interfaceError2);
            }
            this.LoadPointers();
            if (this.i && !this.f())
            {
                return(Interface.InterfaceError.FAILED_TO_SETUP_NAMED_PIPE);
            }
            if (this.j != string.Empty && !this.g())
            {
                return(Interface.InterfaceError.UNKNOWN);
            }
            this.Interact.SetClientId(this.l);
            this.d();
            this.RegisterEvents();
            return(Interface.InterfaceError.SUCCESS);
        }
Пример #2
0
        public static List <Interface.WindowInfo> GetWindowList(string processName_)
        {
            Process[] processesByName = Process.GetProcessesByName(processName_);
            List <Interface.WindowInfo> windowInfoList = new List <Interface.WindowInfo>();

            Interface.WindowInfo windowInfo = new Interface.WindowInfo();
            foreach (Process process in processesByName)
            {
                FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(process.MainModule.FileName);
                windowInfo.Title         = process.MainWindowTitle;
                windowInfo.Handle        = process.MainWindowHandle;
                windowInfo.ProcessHandle = process.Id;
                windowInfo.Version       = versionInfo;
                windowInfoList.Add(windowInfo);
            }
            return(windowInfoList);
        }