Beispiel #1
0
 private bool AnyProblems()
 {
     if (Program.mem == null || !Program.mem.ValidateProcess() || Program.mem.GetSelfCombatant() == null || Program.mem.Process.Id != (int?)ProcessComboBox.SelectedValue)
     {
         HuntConnectionTextBlock.Text = string.Format(Properties.Resources.FormNoProcess, FFXIVProcessHelper.DX9ExeName + (Environment.Is64BitProcess ? "/" + FFXIVProcessHelper.DX11ExeName : string.Empty));
         if (ProcessComboBox.SelectedValue != null && FFXIVProcessHelper.GetFFXIVProcess((int)ProcessComboBox.SelectedValue) != null)
         {
             if (Program.mem != null)
             {
                 Program.mem.OnNewCommand -= ProcessChatCommand;
                 Program.mem.Dispose();
                 hunts?.LeaveGroup();
             }
             Program.mem = null;
             Program.mem = new FFXIVMemory(FFXIVProcessHelper.GetFFXIVProcess((int)ProcessComboBox.SelectedValue));
             Program.mem.OnNewCommand += ProcessChatCommand;
             PersistentNamedPipeServer.Restart();
         }
         hunts?.LeaveGroup();
         HuntNotifyGroupBox.IsEnabled = false;
         return(true);
     }
     else
     {
         if (hunts == null && Program.mem != null && Program.mem.ValidateProcess())
         {
             hunts = new FFXIVHunts(this);
         }
         HuntNotifyGroupBox.IsEnabled = true;
     }
     return(false);
 }
        public static Process GetFFXIVProcess(int pid = 0)
        {
            Process result;

            try
            {
                IList <Process> list = FFXIVProcessHelper.GetFFXIVProcessList();
                if (pid == 0)
                {
                    if (list.Any <Process>())
                    {
                        result = (from x in list
                                  orderby x.Id
                                  select x).FirstOrDefault <Process>();
                    }
                    else
                    {
                        result = null;
                    }
                }
                else
                {
                    result = list.FirstOrDefault((Process x) => x.Id == pid);
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
 public static IList <Process> GetFFXIVProcessList()
 {
     return((from x in Process.GetProcessesByName("ffxiv")
             where FFXIVProcessHelper.ValidateProcess("ffxiv.exe", x)
             select x).Union(from x in Process.GetProcessesByName("ffxiv_dx11")
                             where FFXIVProcessHelper.ValidateProcess("ffxiv_dx11.exe", x)
                             select x).ToList <Process>());
 }
Beispiel #4
0
        private bool AnyProblems()
        {
            if (Program.mem != null && Program.mem.ValidateProcess() && Program.mem.GetSelfCombatant() != null)
            {
                int id  = Program.mem.Process.Id;
                int?num = (int?)this.ProcessComboBox.SelectedValue;
                if (id == num.GetValueOrDefault() & num != null)
                {
                    if (this.hunts == null && Program.mem != null && Program.mem.ValidateProcess())
                    {
                        this.hunts = new FFXIVHunts(this);
                    }
                    this.MainTabControl.IsEnabled = (this.HuntNotifyGroupBox.IsEnabled = true);
                    return(false);
                }
            }
            this.HuntConnectionTextBlock.Text = string.Format(CultureInfo.CurrentCulture, FFXIV_GameSense.Properties.Resources.FormNoProcess, "ffxiv_dx11.exe");
            if (this.ProcessComboBox.SelectedValue != null && FFXIVProcessHelper.GetFFXIVProcess((int)this.ProcessComboBox.SelectedValue) != null)
            {
                if (Program.mem != null)
                {
                    Program.mem.OnNewCommand -= this.ProcessChatCommand;
                    Program.mem.Dispose();
                    FFXIVHunts ffxivhunts = this.hunts;
                    if (ffxivhunts != null)
                    {
                        ffxivhunts.LeaveGroup();
                    }
                }
                Program.mem = null;
                Program.mem = new FFXIVMemory(FFXIVProcessHelper.GetFFXIVProcess((int)this.ProcessComboBox.SelectedValue));
                Program.mem.OnNewCommand += this.ProcessChatCommand;
                PersistentNamedPipeServer.Restart();
            }
            FFXIVHunts ffxivhunts2 = this.hunts;

            if (ffxivhunts2 != null)
            {
                ffxivhunts2.LeaveGroup();
            }
            this.MainTabControl.IsEnabled = (this.HuntNotifyGroupBox.IsEnabled = false);
            return(true);
        }