Example #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"
                },
            };

            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;
            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);
            }
        }
Example #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Data.Initializer();

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

            label_AboutTitle.Text = string.Format("DFA {0}", Global.VERSION);

            FindFFXIVProcess();

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

            if (Settings.AutoUpdate)
            {
                checkBox_AutoUpdate.Checked = true;
            }

            if (Settings.CheckUpdate)
            {
                checkBox_CheckUpdate.Checked = true;

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

            checkBox_StartupShow.Checked = Settings.StartupShowMainForm;
            checkBox_AutoOverlayHide.Checked = Settings.AutoOverlayHide;
            checkBox_FlashWindow.Checked = Settings.FlashWindow;

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

            foreach (var zone in Data.Areas)
            {
                if (!zone.Value.isDuty && zone.Value.FATEList.Count > 0)
                    triStateTreeView_FATEs.Nodes.Add(zone.Key.ToString(), zone.Value.Name);
            }

            foreach (var fate in Data.GetFATEs())
            {
                var node = triStateTreeView_FATEs.Nodes[fate.Value.Zone.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("버전 {0} 업데이트됨", Global.VERSION);
            }

            Sentry.ReportAsync("App started");
        }
Example #3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.m_network = new Network();

            this.FindFFXIVProcess();

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

                    if ((this.m_ffxiv == null) || this.m_ffxiv.HasExited)
                    {
                        this.m_ffxiv = null;

                        this.Invoke(new Action(this.FindFFXIVProcess));
                    }
                    else
                    {
                        // FFXIVProcess is alive

                        if (this.m_network.IsRunning)
                        {
                            this.m_network.UpdateGameConnections(this.m_ffxiv);
                        }
                        else
                        {
                            this.m_network.StartCapture(this.m_ffxiv);
                        }
                    }
                }
            });

            this.ctlS.Checked = this.ctlA.Checked = this.ctlB.Checked = true;
        }