示例#1
0
 public static bool IsProcessRunning(string processName)
 {
     try
     {
         int pid = APIHelper.GetProcessID(processName);
         if (pid != 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#2
0
        private void Event_ProcessRan()
        {
            string fileName = APIHelper.GetProcessModule(modifierConfig.ProcessName, modifierConfig.ModuleName).FileName;
            string md5      = Program.GetMD5HashFromFile(fileName);


            //初始化进程信息
            try
            {
                ModifierConfigEx.ProcessInfo.Pid           = APIHelper.GetProcessID(modifierConfig.ProcessName);
                ModifierConfigEx.ProcessInfo.ModuleAddress = APIHelper.GetModuleAddr(modifierConfig.ProcessName, modifierConfig.ModuleName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }

            //匹配版本
            if (AdaptVersion(md5))
            {
                //初始化页面
                LoadPages(version.Pages);
                currentStatusStrip.Text = "当前状态:加载完毕";

                this.Text += "[" + version.VersionName + "]";
            }
            else
            {
                //版本匹配失败
                MessageBox.Show("版本匹配失败,没有合适的版本");
                Close();
            }

            moduleStausLabel.ForeColor = Color.DarkGreen;
            moduleStausLabel.Text      = modifierConfig.ProcessName + "正在运行";
        }