예제 #1
0
        private void CheckReset()
        {
            var todayReset = DateTime.Today.AddHours(ResetHour + ServerHourOffsetFromLocal);

            if (SettingsHolder.LastRun > todayReset || DateTime.Now < todayReset)
            {
                return;
            }

            WindowManager.Dashboard.VM.ResetDailyData();

            var weeklyDungeonsReset = DateTime.Now.DayOfWeek == _serverTimezones[CurrentRegion].DungeonsWeeklyResetDay;
            var weeklyVanguardReset = DateTime.Now.DayOfWeek == _serverTimezones[CurrentRegion].VanguardResetDay;

            if (weeklyDungeonsReset)
            {
                WindowManager.Dashboard.VM.ResetWeeklyDungeons();
            }
            if (weeklyVanguardReset)
            {
                WindowManager.Dashboard.VM.ResetVanguardWeekly();
            }

            WindowManager.Dashboard.VM.SaveCharacters();
            SettingsHolder.LastRun = DateTime.Now;
            SettingsWriter.Save();
        }
예제 #2
0
        public static void SendUsageStat()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            using (var c = new WebClient())
            {
                c.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                c.Headers.Add(HttpRequestHeader.AcceptCharset, "utf-8");
                c.Headers.Add(HttpRequestHeader.UserAgent,
                              "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");

                var js = new JObject
                {
                    { "server", PacketProcessor.Server.ServerId },
                    {
                        "id",
                        InfoWindowViewModel.Instance.Characters == null ? 0 :
                        InfoWindowViewModel.Instance.Characters.Count == 0 ? 0 :
                        // ReSharper disable once PossibleNullReferenceException
                        InfoWindowViewModel.Instance.Characters.FirstOrDefault(x => x.Position == 1).Id
                    },
                    { "region", PacketProcessor.Server.Region }
                };
                c.Encoding = Encoding.UTF8;
                c.UploadStringAsync(new Uri("https://us-central1-tcc-report.cloudfunctions.net/stat"),
                                    Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(js.ToString())));

                Settings.StatSent = true;
                SettingsWriter.Save();
            }
        }
예제 #3
0
 public static void Close()
 {
     BaseDispatcher.Invoke(ReleaseMutex);
     TeraSniffer.Instance.Enabled = false;
     SettingsWriter.Save();
     WindowManager.Dispose();
     ProxyInterface.Instance.Disconnect(); //ProxyOld.CloseConnection();
     UpdateManager.StopTimer();
     Environment.Exit(0);
 }
예제 #4
0
        public static void CloseApp()
        {
            TeraSniffer.Instance.Enabled = false;
            SettingsWriter.Save();
            WindowManager.Dispose();
            Proxy.CloseConnection();
            UpdateManager.StopTimer();

            Environment.Exit(0);
        }
예제 #5
0
        public static void MakeGlobal()
        {
            SettingsHolder.CooldownWindowSettings.MakePositionsGlobal();
            SettingsHolder.ClassWindowSettings.MakePositionsGlobal();
            SettingsHolder.CharacterWindowSettings.MakePositionsGlobal();
            SettingsHolder.GroupWindowSettings.MakePositionsGlobal();
            SettingsHolder.BuffWindowSettings.MakePositionsGlobal();
            SettingsHolder.BossWindowSettings.MakePositionsGlobal();

            SettingsWriter.Save();
        }
예제 #6
0
        public static void UpdateScreenCorrection()
        {
            if (ScreenSize.IsEqual(SettingsHolder.LastScreenSize))
            {
                return;
            }
            var wFac = SettingsHolder.LastScreenSize.Width / ScreenSize.Width;
            var hFac = SettingsHolder.LastScreenSize.Height / ScreenSize.Height;

            ScreenCorrection = new Size(wFac, hFac);
            SettingsHolder.LastScreenSize = ScreenSize;
            if (!App.Loading)
            {
                SettingsWriter.Save();
            }
        }
예제 #7
0
        private void CheckReset()
        {
            if (CurrentRegion == null)
            {
                return;
            }
            var todayReset = DateTime.Today.AddHours(ResetHour + ServerHourOffsetFromLocal);

            if (Settings.LastRun > todayReset || DateTime.Now < todayReset)
            {
                return;
            }
            foreach (var ch in InfoWindowViewModel.Instance.Characters)
            {
                foreach (var dg in ch.Dungeons)
                {
                    if (dg.Id == 9950)
                    {
                        if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
                        {
                            dg.Reset();
                        }
                        else
                        {
                            continue;
                        }
                    }
                    dg.Reset();
                }
                ch.DailiesDone           = 0;
                ch.ClaimedGuardianQuests = 0;
                if (DateTime.Now.DayOfWeek == _resetDay)
                {
                    ch.WeekliesDone = 0;
                }
            }
            Settings.LastRun = DateTime.Now;
            InfoWindowViewModel.Instance.SaveToFile();
            SettingsWriter.Save();
            if (DateTime.Now.DayOfWeek == _resetDay)
            {
                ChatWindowManager.Instance.AddTccMessage("Weekly data has been reset.");
            }

            ChatWindowManager.Instance.AddTccMessage("Daily data has been reset.");
        }
예제 #8
0
 public static void Restart()
 {
     SettingsWriter.Save();
     Process.Start("TCC.exe");
     Close();
 }