コード例 #1
0
        private void BrowseProcessBtn_Click(object sender, EventArgs e)
        {
            string processName = ProcessTextbox.Text;
            string dialogResult;

            if (ProcessHandler.ProcessIsRunning(processName))
            {
                if (processName.Contains(".exe"))
                {
                    processName = processName.Substring(0, processName.Length - 4); //Strip it out
                }
                Settings.Process = processName;
                dialogResult     = "Process found.";
            }
            else
            {
                dialogResult = "I did not find that process.";
            }
            MessageBox.Show(dialogResult);
        }
コード例 #2
0
        private void StatusTimer_Tick(object sender, EventArgs e)
        {
            if (!AutoShutdown.Enabled)
            {
                StatusLabel.BackColor = SystemColors.Control;
                string status;
                bool   disabled = true;

                if (Settings.Dll == "Not set" || Settings.Process == "Not set")
                {
                    status = "Waiting for a DLL/Process.";
                }
                else if (!ProcessHandler.ProcessIsRunning(Settings.Process))
                {
                    status = "I can't find the process.";
                }
                else if (!File.Exists(Settings.Dll))
                {
                    status = "I can't find the DLL.";
                }
                else
                {
                    status   = "Ready to inject the process: " + Settings.Process.ToUpper();
                    disabled = false;
                }

                if (disabled)
                {
                    StatusLabel.ForeColor = Color.Red;
                    InjectBtn.Enabled     = false;
                }
                else
                {
                    StatusLabel.ForeColor = Color.Green;
                    InjectBtn.Enabled     = true;
                }
                StatusLabel.Text = status;
            }
        }