示例#1
0
 private void tmrUpdate_Tick(object sender, EventArgs e)
 {
     if (dsProcess == null)
     {
         DSProcess result = DSProcess.GetProcess();
         if (result != null)
         {
             lblProcessValue.Text      = result.ID.ToString();
             lblVersionValue.Text      = result.Version;
             lblVersionValue.ForeColor = result.Valid ? Color.DarkGreen : Color.DarkRed;
             dsProcess = result;
         }
     }
     else
     {
         if (dsProcess.Alive())
         {
             if (dsProcess.Loaded())
             {
                 if (!loaded)
                 {
                     dsProcess.LoadPointers();
                     resetFilter();
                     loaded = true;
                 }
                 else
                 {
                     lblWorldValue.Text    = dsProcess.GetWorld().ToString();
                     lblFilterIDValue.Text = dsProcess.GetFilter().ToString();
                     if (activeProfile != null)
                     {
                         updateFilters();
                     }
                 }
             }
             else if (loaded && !dsProcess.Loaded())
             {
                 lblWorldValue.Text    = "None";
                 lblFilterIDValue.Text = "None";
                 loaded = false;
             }
         }
         else
         {
             dsProcess.Close();
             dsProcess                 = null;
             lblProcessValue.Text      = "None";
             lblVersionValue.Text      = "None";
             lblVersionValue.ForeColor = Color.Black;
             lblWorldValue.Text        = "None";
             lblFilterIDValue.Text     = "None";
             loaded = false;
         }
     }
 }
示例#2
0
        public static DSProcess GetProcess()
        {
            DSProcess result = null;

            Process[] candidates = Process.GetProcessesByName("DARKSOULS");
            if (candidates.Length > 0)
            {
                result = new DSProcess(candidates[0]);
            }
            return(result);
        }