コード例 #1
0
        private void OnStartup(object sender, StartupEventArgs ev)
        {
            var cd = AppDomain.CurrentDomain;

            cd.UnhandledException += GlobalUnhandledExceptionHandler;
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;
            if (File.Exists(Environment.CurrentDirectory + "/TCCupdater.exe"))
            {
                File.Delete(Environment.CurrentDirectory + "/TCCupdater.exe");
            }
            UpdateManager.CheckAppVersion();
            UpdateManager.CheckDatabaseVersion();



            TeraSniffer.Instance.Enabled = true;
            WindowManager.Init();
            LoadSettings();
            PacketRouter.Init();

            TeraSniffer.Instance.NewConnection += (srv) => SkillManager.Clear();
            TeraSniffer.Instance.EndConnection += () => SkillManager.Clear();

            var LoadThread = new Thread(new ThreadStart(() =>
            {
                SkillsDatabase.Load();
                Console.WriteLine("Skills loaded.");
                BroochesDatabase.SetBroochesIcons();
                Console.WriteLine("Set brooches icons");
                MonsterDatabase.Populate();
                Console.WriteLine("Monsters loaded");
                AbnormalityDatabase.Load();
                Console.WriteLine("Abnormalities loaded");
                WindowManager.CooldownWindow.LoadingDone();
            }));

            SessionManager.CurrentPlayer.Class = Class.None;

            WindowManager.ShowWindow(WindowManager.CooldownWindow);
            LoadThread.Start();
            //Debug();
        }
コード例 #2
0
        private async void OnStartup(object sender, StartupEventArgs e)
        {
            BaseDispatcher             = Dispatcher.CurrentDispatcher;
            BaseDispatcher.Thread.Name = "Main";
            TccMessageBox.Create(); //Create it here in STA thread
            if (IsRunning())
            {
                TccMessageBox.Show("Another instance of TCC is already running. Shutting down.",
                                   MessageBoxType.Information);
                Current.Shutdown();
                return;
            }

            Loading = true;
            var v = Assembly.GetExecutingAssembly().GetName().Version;

            AppVersion = $"TCC v{v.Major}.{v.Minor}.{v.Build}{(Experimental ? "-e" : "")}";
            InitSplashScreen();

            AppDomain.CurrentDomain.UnhandledException += GlobalExceptionHandler.HandleGlobalException;
            TryDeleteUpdater();

            SplashScreen.SetText("Checking for application updates...");
            await UpdateManager.CheckAppVersion();

            SplashScreen.SetText("Checking for database updates...");
            await UpdateManager.CheckIconsVersion();

            SplashScreen.SetText("Loading settings...");
            var sr = new SettingsReader();

            sr.LoadWindowSettings();
            sr.LoadSettings();

            Process.GetCurrentProcess().PriorityClass = SettingsHolder.HighPriority
                ? ProcessPriorityClass.High
                : ProcessPriorityClass.Normal;
            if (SettingsHolder.ForceSoftwareRendering)
            {
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            SplashScreen.SetText("Pre-loading databases...");
            UpdateManager.CheckDatabaseHash();
            SessionManager.InitDatabasesAsync(string.IsNullOrEmpty(SettingsHolder.LastLanguage) ? "EU-EN" :
                                              SettingsHolder.LastLanguage == "EU" ? "EU-EN" :
                                              SettingsHolder.LastLanguage);
            UpdateManager.CheckServersFile();

            SplashScreen.SetText("Initializing windows...");
            WindowManager.Init();

            SplashScreen.SetText("Initializing packet processor...");
            PacketAnalyzer.InitAsync();
            SplashScreen.SetText("Starting");

            TimeManager.Instance.SetServerTimeZone(SettingsHolder.LastLanguage);
            ChatWindowManager.Instance.AddTccMessage(AppVersion);
            SplashScreen.CloseWindowSafe();

            UpdateManager.StartPeriodicCheck();

            if (!Experimental && SettingsHolder.ExperimentalNotification && UpdateManager.IsExperimentalNewer())
            {
                WindowManager.FloatingButton.NotifyExtended("TCC experimental",
                                                            "An experimental version of TCC is available. Open System settings to download it or disable this notification.",
                                                            NotificationType.Success,
                                                            10000);
            }

            Loading = false;
        }
コード例 #3
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            var v = Assembly.GetExecutingAssembly().GetName().Version;

            _version = $"TCC v{v.Major}.{v.Minor}.{v.Build}";
            InitSplashScreen();

            BaseDispatcher = Dispatcher.CurrentDispatcher;
            TccMessageBox.Create(); //Create it here in STA thread

            AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler;
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
            TryDeleteUpdater();

            SplashScreen.SetText("Checking for application updates...");
            UpdateManager.CheckAppVersion();

            SplashScreen.SetText("Checking for database updates...");
            UpdateManager.CheckDatabaseVersion();

            SplashScreen.SetText("Loading settings...");
            SettingsManager.LoadWindowSettings();
            SettingsManager.LoadSettings();

            SplashScreen.SetText("Pre-loading databases...");
            SessionManager.InitDatabases(string.IsNullOrEmpty(SettingsManager.LastRegion) ? "EU-EN" : SettingsManager.LastRegion == "EU" ? "EU-EN" : SettingsManager.LastRegion);

            SplashScreen.SetText("Initializing windows...");
            WindowManager.Init();
            FocusManager.FocusTimer.Start();

            SplashScreen.SetText("Initializing Twitch connector...");
            TwitchConnector.Instance.Init();

            SplashScreen.SetText("Initializing packet processor...");
            PacketProcessor.Init();
            TeraSniffer.Instance.NewConnection += TeraSniffer_OnNewConnection;
            TeraSniffer.Instance.EndConnection += TeraSniffer_OnEndConnection;
            TeraSniffer.Instance.Enabled        = true;

            SplashScreen.SetText("Starting");
            SessionManager.CurrentPlayer.Class    = Class.None;
            SessionManager.CurrentPlayer.Name     = "player";
            SessionManager.CurrentPlayer.PlayerId = 10;
            TimeManager.Instance.SetServerTimeZone(SettingsManager.LastRegion);
            ChatWindowManager.Instance.AddTccMessage(_version);
            SplashScreen.CloseWindowSafe();

            UpdateManager.StartCheck();

            //WindowManager.LfgListWindow.ShowWindow();
            // var l = new Listing();
            // l.LeaderId = 10;
            // l.Message = "SJG exp only";
            // l.LeaderName = "Foglio";
            // l.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher){PlayerId = 10, IsLeader = true, Online = true});
            // l.Applicants.Add(new User(WindowManager.LfgListWindow.Dispatcher){PlayerId = 1, Name = "Applicant", Online = true, UserClass = Class.Priest});
            // WindowManager.LfgListWindow.VM.Listings.Add(l);
            //var l = new List<User>();
            //var r = new Random();
            //for (uint i = 0; i < 30; i++)
            //    GroupWindowViewModel.Instance.AddOrUpdateMember(new User(GroupWindowViewModel.Instance.GetDispatcher())
            //    {
            //        Name = i.ToString(),
            //        PlayerId = i,
            //        ServerId = i,
            //        EntityId = i,
            //        UserClass = (Class)r.Next(0, 12)
            //    });
            //GroupWindowViewModel.Instance.SetRaid(true);
            //GroupWindowViewModel.Instance.SetNewLeader(10, "player");
        }
コード例 #4
0
        //public static DebugWindow DebugWindow;

        private void OnStartup(object sender, StartupEventArgs e)
        {
            Loading = true;
            //#if DEBUG
            //            DebugWindow = new DebugWindow();
            //            DebugWindow.Show();
            //#endif

            var v = Assembly.GetExecutingAssembly().GetName().Version;

            _version = $"TCC v{v.Major}.{v.Minor}.{v.Build}";
            InitSplashScreen();

            BaseDispatcher = Dispatcher.CurrentDispatcher;
            TccMessageBox.Create(); //Create it here in STA thread
#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler;
#endif
            TryDeleteUpdater();

            SplashScreen.SetText("Checking for application updates...");
            UpdateManager.CheckAppVersion();

            SplashScreen.SetText("Checking for database updates...");
            UpdateManager.CheckDatabaseVersion();

            SplashScreen.SetText("Loading settings...");
            var sr = new SettingsReader();
            sr.LoadWindowSettings();
            sr.LoadSettings();

            Process.GetCurrentProcess().PriorityClass = Settings.HighPriority ? ProcessPriorityClass.High : ProcessPriorityClass.Normal;
            if (Settings.ForceSoftwareRendering)
            {
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            SplashScreen.SetText("Pre-loading databases...");
            SessionManager.InitDatabases(string.IsNullOrEmpty(Settings.LastRegion) ? "EU-EN" : Settings.LastRegion == "EU" ? "EU-EN" : Settings.LastRegion);

            SplashScreen.SetText("Initializing windows...");
            WindowManager.Init();

            //SplashScreen.SetText("Initializing Twitch connector...");
            //TwitchConnector.Instance.Init();

            SplashScreen.SetText("Initializing packet processor...");
            PacketProcessor.Init();
            TeraSniffer.Instance.NewConnection += TeraSniffer_OnNewConnection;
            TeraSniffer.Instance.EndConnection += TeraSniffer_OnEndConnection;
            TeraSniffer.Instance.Enabled        = true;
            WindowManager.FloatingButton.NotifyExtended("TCC", "Ready to connect.", NotificationType.Normal);
            SplashScreen.SetText("Starting");

            SessionManager.CurrentPlayer.Class    = Class.None;
            SessionManager.CurrentPlayer.Name     = "player";
            SessionManager.CurrentPlayer.EntityId = 10;
            TimeManager.Instance.SetServerTimeZone(Settings.LastRegion);
            ChatWindowManager.Instance.AddTccMessage(_version);
            SplashScreen.CloseWindowSafe();

            UpdateManager.StartCheck();

            if (Settings.LastRegion == "NA" || Settings.LastRegion == "")
            {
                WindowManager.FloatingButton.NotifyExtended("So long, and thanks for all the fish", ThankYou_mEME, NotificationType.Error, 15000);
            }

            if (Debug)
            {
                DebugStuff();
            }
            Loading = false;
        }
コード例 #5
0
        private static async Task Setup()
        {
            TccUtils.SetAlignment();

            NoticeChecker.Init();

            TccSplashScreen.InitOnNewThread();

            if (!ToolboxMode)
            {
                UpdateManager.TryDeleteUpdater();

                SplashScreen.VM.BottomText = "Checking for application updates...";
                await UpdateManager.CheckAppVersion();
            }

            // ----------------------------
            SplashScreen.VM.Progress   = 10;
            SplashScreen.VM.BottomText = "Loading settings...";
            Settings = SettingsContainer.Load();
            WindowManager.InitSettingsWindow(); // need it in case language is not correct

            SplashScreen.VM.Progress = 20;
            Process.GetCurrentProcess().PriorityClass = Settings.HighPriority
                ? ProcessPriorityClass.High
                : ProcessPriorityClass.Normal;
            if (Settings.ForceSoftwareRendering)
            {
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            // ----------------------------
            SplashScreen.VM.Progress   = 30;
            SplashScreen.VM.BottomText = "Pre-loading databases...";
            UpdateManager.CheckDatabaseHash();
            SplashScreen.VM.Progress = 40;
            await Game.InitAsync();

            // ----------------------------
            SplashScreen.VM.Progress   = 50;
            SplashScreen.VM.BottomText = "Initializing widgets...";
            await WindowManager.Init();

            SplashScreen.VM.Progress = 60;
            StartDispatcherWatcher();

            // ----------------------------
            SplashScreen.VM.Progress   = 70;
            SplashScreen.VM.BottomText = "Checking for icon database updates...";
            _ = Task.Run(() => new IconsUpdater().CheckForUpdates());

            // ----------------------------
            SplashScreen.VM.BottomText     = "Initializing packet processor...";
            SplashScreen.VM.Progress       = 80;
            PacketAnalyzer.ProcessorReady += LoadModules;
            await PacketAnalyzer.InitAsync();

            // ----------------------------
            SplashScreen.VM.Progress   = 90;
            SplashScreen.VM.BottomText = "Starting";
            GameEventManager.Instance.SetServerTimeZone(Settings.LastLanguage);
            UpdateManager.StartPeriodicCheck();

            SplashScreen.VM.Progress = 100;
            SplashScreen.CloseWindowSafe();


            // ----------------------------
            Log.Chat($"{AppVersion} ready.");
            ReadyEvent?.Invoke();

            if (!Beta && Settings.BetaNotification && UpdateManager.IsBetaNewer())
            {
                Log.N("TCC beta available", SR.BetaAvailable, NotificationType.Success, 10000);
            }
        }
コード例 #6
0
        private void OnStartup(object sender, StartupEventArgs ev)
        {
            var cd = AppDomain.CurrentDomain;

            cd.UnhandledException += GlobalUnhandledExceptionHandler;
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
            if (File.Exists(Environment.CurrentDirectory + "/TCCupdater.exe"))
            {
                File.Delete(Environment.CurrentDirectory + "/TCCupdater.exe");
            }
            UpdateManager.CheckAppVersion();
            UpdateManager.CheckDatabaseVersion();

            SkillsDatabase.Load();
            //ItemSkillsDatabase.SetBroochesIcons();
            SettingsManager.LoadWindowSettings();
            SettingsManager.LoadSettings();
            WindowManager.Init();
            WindowManager.Settings = new SettingsWindow()
            {
                Name = "Settings"
            };
            FocusManager.FocusTimer.Start();
            TwitchConnector.Instance.Init();
            PacketProcessor.Init();

            TeraSniffer.Instance.NewConnection += (srv) =>
            {
                SkillManager.Clear();
                WindowManager.TrayIcon.Icon = WindowManager.ConnectedIcon;
                ChatWindowViewModel.Instance.AddTccMessage($"Connected to {srv.Name}.");
            };
            TeraSniffer.Instance.EndConnection += () =>
            {
                ChatWindowViewModel.Instance.AddTccMessage("Disconnected from the server.");
                GroupWindowViewModel.Instance.ClearAllAbnormalities();
                BuffBarWindowViewModel.Instance.Player.ClearAbnormalities();
                EntitiesManager.ClearNPC();

                SkillManager.Clear();
                WindowManager.TrayIcon.Icon = WindowManager.DefaultIcon;
                Proxy.CloseConnection();
            };

            SessionManager.CurrentPlayer.Class = Class.None;
            SessionManager.CurrentPlayer.Name  = "player";

            TeraSniffer.Instance.Enabled = true;
            TimeManager.Instance.SetServerTimeZone(SettingsManager.LastRegion);

            var v   = Assembly.GetExecutingAssembly().GetName().Version;
            var ver = $"TCC v{v.Major}.{v.Minor}.{v.Build}";

            ChatWindowViewModel.Instance.AddTccMessage(ver);

            if (!Debug)
            {
                return;
            }
            SessionManager.CurrentPlayer = new Player(1, "Foglio");
            CooldownWindowViewModel.Instance.LoadSkills(Utils.ClassEnumToString(Class.Warrior).ToLower() + "-skills.xml", Class.Warrior);

            for (uint i = 0; i < 1; i++)
            {
                var u = new User(GroupWindowViewModel.Instance.GetDispatcher());
                u.Name      = "Test_Dps" + i;
                u.PlayerId  = i;
                u.Online    = true;
                u.UserClass = Class.Warrior;


                GroupWindowViewModel.Instance.AddOrUpdateMember(u);
            }
            for (uint i = 0; i < 2; i++)
            {
                var u = new User(GroupWindowViewModel.Instance.GetDispatcher());
                u.Name      = "Test_Healer" + i;
                u.PlayerId  = i + 10;
                u.Online    = true;
                u.UserClass = Class.Elementalist;
                if (i == 1)
                {
                    u.Alive = false;
                }
                if (i == 0)
                {
                    u.Name = "Foglio";
                }

                GroupWindowViewModel.Instance.AddOrUpdateMember(u);
            }
            for (uint i = 0; i < 4; i++)
            {
                var u = new User(GroupWindowViewModel.Instance.GetDispatcher());
                u.Name      = "Test_Tank" + i;
                u.PlayerId  = i + 100;
                u.Online    = true;
                u.UserClass = Class.Lancer;
                GroupWindowViewModel.Instance.AddOrUpdateMember(u);
            }
            //foreach (var user in GroupWindowViewModel.Instance.Members)
            //{
            //    user.AddOrRefreshBuff(new Abnormality(4611, true, true, false, AbnormalityType.Buff),60*100*60,1);
            //    user.AddOrRefreshBuff(new Abnormality(46126, true, true, false, AbnormalityType.Buff),60*100*60,1);
            //    user.AddOrRefreshDebuff(new Abnormality(89308100, true, false, false, AbnormalityType.DOT),60*100*60,5);
            //    user.AddOrRefreshDebuff(new Abnormality(89308101, true, false, false, AbnormalityType.DOT),60*100*60,5);

            //}
            //GroupWindowViewModel.Instance.StartRoll();
            //GroupWindowViewModel.Instance.SetReadyStatus(new ReadyPartyMember());
        }