示例#1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Localization.Initialize(Settings.Language);
            Data.Initialize(Settings.Language, this);

            ApplyLanguage();

            overlayForm.Show();
            networkWorker = new Network(this);

            label_AboutTitle.Text = $@"DFA {Global.VERSION}";

            FindFFXIVProcess();

            if (!Settings.ShowOverlay)
            {
                overlayForm.Hide();
                checkBox_Overlay.Checked = false;
            }
            networkWorker.notificationPlayer = new System.Media.SoundPlayer();

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Updater.CheckNewVersion(this);
                    Thread.Sleep(30 * 60 * 1000);
                }
            });

            comboBox_Language.DataSource = new[]
            {
                new Language {
                    Name = "한국어", Code = "ko-kr"
                },
                new Language {
                    Name = "English", Code = "en-us"
                },
                new Language {
                    Name = "Français", Code = "fr-fr"
                },
                new Language {
                    Name = "Deutsch", Code = "de-de"
                },
                new Language {
                    Name = "日本語", Code = "ja-jp"
                },
                new Language {
                    Name = "简体中文", Code = "zh-cn"
                },
                new Language {
                    Name = "Русский", Code = "ru-ru"
                },
            };

            comboBox_Language.DisplayMember = "Name";
            comboBox_Language.ValueMember   = "Code";

            comboBox_Language.SelectedValue = Settings.Language;

            comboBox_Language.SelectedValueChanged += comboBox_Language_SelectedValueChanged;

            checkBox_StartupShow.Checked     = Settings.StartupShowMainForm;
            checkBox_autoHideOverlay.Checked = Settings.autoHideOverlay;
            checkBox_FlashWindow.Checked     = Settings.FlashWindow;
            checkBox_FateSound.Checked       = Settings.FateSound;
            checkBox_useVPN.Checked          = Settings.useVPN;
            // Check if Custom Sound File Exists
            if (File.Exists(Settings.CustomSoundPath))
            {
                label_CustomSoundFileName.Text = Path.GetFileName(Settings.CustomSoundPath);
                checkBox_CustomSound.Checked   = Settings.CustomSound;
                networkWorker.notificationPlayer.SoundLocation = Settings.CustomSoundPath;
            }
            else
            {
                label_CustomSoundFileName.Text = "";
                checkBox_CustomSound.Checked   = false;
                Settings.CustomSound           = false;
                Settings.Save();
            }
            SetCheatRoulleteCheckBox(Settings.CheatRoulette);
            checkBox_CopyMacro.Checked             = Settings.copyMacro;
            checkBox_Telegram.Checked              = Settings.TelegramEnabled;
            checkBox_Telegram_Queue_Status.Checked = Settings.TelegramQueueStatusEnabled;
            textBox_Telegram.Enabled = Settings.TelegramEnabled;
            textBox_Telegram.Text    = Settings.TelegramChatId;
            checkBox_Discord.Checked = Settings.DiscordEnabled;
            textBox_Discord.Enabled  = Settings.DiscordEnabled;
            textBox_Discord.Text     = Settings.DiscordAccount;

            checkBox_EnableHttpRequest.Checked    = Settings.customHttpRequest;
            textBox_CustomHttpUrl.Text            = Settings.customHttpUrl;
            checkBox_RequestOnDutyMatched.Checked = Settings.requestOnDutyMatched;
            checkBox_RequestOnFateOccur.Checked   = Settings.requestOnFateOccured;

            refresh_Fates();

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Thread.Sleep(30 * 1000);

                    if (FFXIVProcess == null || FFXIVProcess.HasExited)
                    {
                        FFXIVProcess = null;

                        overlayForm.SetStatus(false);
                        this.Invoke(FindFFXIVProcess);
                    }
                    else
                    {
                        // FFXIVProcess is alive

                        if (networkWorker.IsRunning)
                        {
                            networkWorker.UpdateGameConnections(FFXIVProcess);
                        }
                        else
                        {
                            networkWorker.StartCapture(FFXIVProcess);
                        }
                    }
                }
            });

            if (Settings.Updated)
            {
                Settings.Updated = false;
                Settings.Save();
                ShowNotification("notification-app-updated", Global.VERSION);
            }
        }
示例#2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Localization.Initialize(Settings.Language);
            Data.Initialize(Settings.Language);

            ApplyLanguage();

            overlayForm.Show();
            networkWorker = new Network(this);

            label_AboutTitle.Text = $@"DFA {Global.VERSION}";

            FindFFXIVProcess();

            if (!Settings.ShowOverlay)
            {
                overlayForm.Hide();
                checkBox_Overlay.Checked = false;
            }

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Updater.CheckNewVersion(this);
                    Thread.Sleep(30 * 60 * 1000);
                }
            });

            comboBox_Language.DataSource = new[]
            {
                new Language {
                    Name = "한국어", Code = "ko-kr"
                },
                new Language {
                    Name = "English", Code = "en-us"
                },
                new Language {
                    Name = "Français", Code = "fr-fr"
                },
                new Language {
                    Name = "日本語", Code = "ja-jp"
                },
            };

            comboBox_Language.DisplayMember = "Name";
            comboBox_Language.ValueMember   = "Code";

            comboBox_Language.SelectedValue = Settings.Language;

            comboBox_Language.SelectedValueChanged += comboBox_Language_SelectedValueChanged;

            checkBox_StartupShow.Checked = Settings.StartupShowMainForm;
//            checkBox_AutoOverlayHide.Checked = Settings.AutoOverlayHide;
            checkBox_FlashWindow.Checked = Settings.FlashWindow;
            SetCheatRoulleteCheckBox(Settings.CheatRoulette);

            checkBox_Twitter.Checked = Settings.TwitterEnabled;
            textBox_Twitter.Enabled  = Settings.TwitterEnabled;
            textBox_Twitter.Text     = Settings.TwitterAccount;

            foreach (var area in Data.Areas)
            {
                triStateTreeView_FATEs.Nodes.Add(area.Key.ToString(), area.Value.Name);

                foreach (var fate in area.Value.FATEs)
                {
                    var node = triStateTreeView_FATEs.Nodes[area.Key.ToString()].Nodes.Add(fate.Key.ToString(), fate.Value.Name);
                    node.Checked = Settings.FATEs.Contains(fate.Key);
                    nodes.Add(node);
                }
            }

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Thread.Sleep(30 * 1000);

                    if (FFXIVProcess == null || FFXIVProcess.HasExited)
                    {
                        FFXIVProcess = null;

                        overlayForm.SetStatus(false);
                        this.Invoke(FindFFXIVProcess);
                    }
                    else
                    {
                        // FFXIVProcess is alive

                        if (networkWorker.IsRunning)
                        {
                            networkWorker.UpdateGameConnections(FFXIVProcess);
                        }
                        else
                        {
                            networkWorker.StartCapture(FFXIVProcess);
                        }
                    }
                }
            });

            if (Settings.Updated)
            {
                Settings.Updated = false;
                Settings.Save();
                ShowNotification("notification-app-updated", Global.VERSION);
            }

            Sentry.ReportAsync("App started");
        }