示例#1
0
        internal static void Ex(Exception ex, string format, params object[] args)
        {
#if DEBUG
            var message = ex.ToString();
#else
            var message = ex.Message;
#endif
            message = Escape(message);
            E(string.Format("{0}: {1}", format, message), args);

            Sentry.ReportAsync(ex, new { LogMessage = string.Format(format, args) });
        }
示例#2
0
        internal static void Ex(Exception ex, string key, params object[] args)
        {
#if DEBUG
            throw ex;
#else
            var format = Localization.GetText(key);

            var message = ex.Message;

            message = Escape(message);
            E($"{format}: {message}", args);

            Sentry.ReportAsync(ex, new { LogMessage = string.Format(format.ToString(), args) });
#endif
        }
示例#3
0
        internal static Roulette GetRoulette(int code)
        {
            if (Roulettes.ContainsKey(code))
            {
                return(Roulettes[code]);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing Roulette code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new Roulette(string.Format("알 수 없는 무작위 임무 ({0})", code)));
        }
示例#4
0
        internal static FATE GetFATE(int code)
        {
            if (FATEs.ContainsKey(code))
            {
                return(FATEs[code]);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing FATE code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new FATE(0, string.Format("알 수 없는 돌발 ({0})", code)));
        }
示例#5
0
        internal static Instance GetInstance(int code)
        {
            if (Areas.ContainsKey(code))
            {
                return(Areas[code].Instance);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing instance code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new Instance(string.Format("알 수 없는 임무 ({0})", code), 0, 0, 0));
        }
示例#6
0
 public static string GetAreaName(int key)
 {
     if (Areas.ContainsKey(key))
     {
         return(Areas[key].Name);
     }
     else
     {
         if (key != 0)
         {
             var @event = new SentryEvent("Missing area code");
             @event.Level        = ErrorLevel.Warning;
             @event.Tags["code"] = key.ToString();
             Sentry.ReportAsync(@event);
         }
         return(string.Format("알 수 없는 지역 ({0})", key));
     }
 }
示例#7
0
        internal static Instance GetInstance(int code)
        {
            if (Instances.TryGetValue(code, out var instance))
            {
                return(instance);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing instance code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new Instance {
                Name = Localization.GetText("unknown-instance", code)
            });
        }
示例#8
0
        internal static FATE GetFATE(int code)
        {
            if (FATEs.ContainsKey(code))
            {
                return(FATEs[code]);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing FATE code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new FATE {
                Name = Localization.GetText("unknown-fate", code)
            });
        }
示例#9
0
        internal static Area GetArea(int code)
        {
            if (Areas.TryGetValue(code, out var area))
            {
                return(area);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing area code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new Area {
                Name = Localization.GetText("unknown-area", code)
            });
        }
示例#10
0
        internal static Roulette GetRoulette(int code)
        {
            if (Roulettes.TryGetValue(code, out var roulette))
            {
                return(roulette);
            }

            if (code != 0)
            {
                var @event = new SentryEvent("Missing Roulette code");
                @event.Level        = ErrorLevel.Warning;
                @event.Tags["code"] = code.ToString();
                Sentry.ReportAsync(@event);
            }

            return(new Roulette {
                Name = Localization.GetText("unknown-roulette", code)
            });
        }
示例#11
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;
            checkBox_PlaySound.Checked       = Settings.PlaySound;
            if (System.IO.File.Exists(Settings.SoundLocation) == false)
            {
                checkBox_PlaySound.Checked = false;
                label_SoundLocation.Text   = "";
            }
            else
            {
                label_SoundLocation.Text = System.IO.Path.GetFileName(Settings.SoundLocation);
            }
            if (checkBox_PlaySound.Checked == false)
            {
                button_SoundLocation.Enabled = false;
            }
            checkBox_ShowAnnouncement.Checked = Settings.ShowAnnouncement;

            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");
        }
示例#12
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;
            }

            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;
            SetCheatRoulleteCheckBox(Settings.CheatRoulette);

            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");
        }