예제 #1
0
        private void ButtonLabelTask(object o, DoWorkEventArgs e)
        {
            // Update the button label with the character name for FFXIV processes
            Dictionary <Process, Button> buttons = new Dictionary <Process, Button>();

            foreach (Button button in ProcessList.Controls)
            {
                if (button != null)
                {
                    Process proc = (button.Tag as Process);
                    if (proc != null)
                    {
                        buttons[proc] = button;
                    }
                }
            }
            LocalOrchestraCheck.Invoke(t => t.Visible = false);
            multiboxProcesses.Clear();
            // Loop through all buttons and set the name
            while (buttons.Count > 0)
            {
                KeyValuePair <Process, Button> proc = buttons.First();
                Process process = proc.Key;
                Button  button  = proc.Value;
                buttons.Remove(process);
                if (process.ProcessName == "ffxiv_dx11")
                {
                    if (processWorker.CancellationPending)
                    {
                        break;
                    }

                    MultiboxProcess multiboxData = this.FetchProcessMultiboxInfo(process);
                    multiboxData.process = process;

                    // Set button label
                    string name = multiboxData.characterName;
                    if (string.IsNullOrEmpty(name))
                    {
                        name = string.Format("{0} (?)", process.Id);
                    }
                    else
                    {
                        name = string.Format("{0} ({1})", name, process.Id);
                    }
                    button.Invoke(t => t.Text = name);

                    multiboxProcesses.Add(multiboxData);
                }
            }

            processCancelled.Set();

            // FIXME enable this after testing
#if DEBUG
            LocalOrchestraCheck.Invoke(t => t.Visible = true);
#else
            LocalOrchestraCheck.Invoke(t => t.Visible = (multiboxProcesses.Count > 1));
#endif
        }
예제 #2
0
        private void ButtonLabelTask(object o, DoWorkEventArgs e)
        {
            // Update the button label with the character name for FFXIV processes
            Dictionary <Process, Button> buttons = new Dictionary <Process, Button>();

            foreach (Button button in ProcessList.Controls)
            {
                if (button != null)
                {
                    Process proc = (button.Tag as Process);
                    if (proc != null)
                    {
                        buttons[proc] = button;
                    }
                }
            }
            LocalOrchestraCheck.Invoke(t => t.Visible = false);
            multiboxProcesses.Clear();
            // Loop through all buttons and set the name
            while (buttons.Count > 0)
            {
                KeyValuePair <Process, Button> proc = buttons.First();
                Process process = proc.Key;
                Button  button  = proc.Value;
                buttons.Remove(process);
                if (process.ProcessName == "ffxiv_dx11")
                {
                    MemoryHandler.Instance.SetProcess(new Sharlayan.Models.ProcessModel {
                        Process = process,
                        IsWin64 = true,
                    });
                    var scanTask = false;
                    while (Scanner.Instance.IsScanning)
                    {
                        if (processWorker.CancellationPending)
                        {
                            scanTask = true;
                            break;
                        }
                    }
                    if (scanTask)
                    {
                        break;
                    }
                    string name     = "(Unknown)";
                    string origName = string.Empty;
                    string id       = string.Empty;
                    if (Reader.CanGetPlayerInfo())
                    {
                        origName = Reader.GetCurrentPlayer().CurrentPlayer.Name;
                        if (string.IsNullOrEmpty(origName))
                        {
                            name = string.Format("{0} (?)", button.Text);
                        }
                        else
                        {
                            name = string.Format("{0} ({1})", origName, process.Id);
                        }
                    }
                    if (Reader.CanGetCharacterId())
                    {
                        id = Reader.GetCharacterId();
                    }
                    button.Invoke(t => t.Text = name);
                    multiboxProcesses.Add(new MultiboxProcess {
                        process       = process,
                        characterName = origName,
                        characterId   = id,
                    });
                    MemoryHandler.Instance.UnsetProcess();
                }
            }

            MemoryHandler.Instance.UnsetProcess();
            processCancelled.Set();

            // FIXME enable this after testing
            LocalOrchestraCheck.Invoke(t => t.Visible = (multiboxProcesses.Count > 1));
        }