Пример #1
0
        static void Main(string[] args)
        {
            JObject settings = JObject.Parse(File.ReadAllText("settings.txt"));

            Console.CursorVisible = false;
            Console.Title         = "DS3 Connection Info V3.3";

            SteamNative.Initialize();
            mem = new MemoryManager();

            Console.WriteLine("Dark Souls III: Closed");
            do
            {
                try { mem.OpenProcess("DarkSoulsIII"); }
                catch { }
                Thread.Sleep(2000);
            } while (mem.ProcHandle == IntPtr.Zero);

            if (!SteamApi.Initialize(374320))
            {
                Console.WriteLine("ERROR: Could not initalize SteamAPI.");
                Console.Read();
                return;
            }

            ETWPingMonitor.Start();

            if ((bool)settings["overlay"])
            {
                Overlay.Enable(settings);
            }


            Console.Clear();
            while (!mem.HasExited)
            {
                Player.UpdatePlayerList();
                Player.UpdateInGameInfo(mem.Process);
                PrintConnInfo();

                Thread.Sleep(1000);
            }

            Overlay.Disable();
            ETWPingMonitor.Stop();
        }
Пример #2
0
        private void GameStartTimer_Tick(object sender, EventArgs e)
        {   // Wait for both process attach & main window existing
            if (DS3Interop.TryAttach() && DS3Interop.FindWindow())
            {
                DS3Interop.Process.EnableRaisingEvents = true;
                DS3Interop.Process.Exited += DarkSouls_HasExited;
                labelGameState.Content     = "DS3: RUNNING";
                labelGameState.Foreground  = Brushes.LawnGreen;

                File.WriteAllText("steam_appid.txt", "374320");
                if (!SteamAPI.Init())
                {
                    MessageBox.Show("Could not initialize Steam API", "Steam API Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    Close();
                }

                if (!HotkeyManager.Enable())
                {
                    MessageBox.Show("Could not initialize keyboard hook for hotkeys", "WINAPI Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                if (!overlay.InstallMsgHook())
                {
                    MessageBox.Show("Could not overlay message hook", "WINAPI Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                overlay.UpdateVisibility();
                if (swBorderless.IsOn ^ DS3Interop.Borderless)
                {
                    DS3Interop.MakeBorderless(swBorderless.IsOn);
                }

                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.BorderlessHotkey, () => swBorderless.IsOn ^= true);
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.OverlayHotkey, () => swOverlay.IsOn       ^= true);
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.PingFilterHotkey, () => Settings.Default.UsePingFilter ^= true);
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.REOHotkey, () => OnlineHotkey(11));
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.RSDHotkey, () => OnlineHotkey(10));
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.WSDHotkey, () => OnlineHotkey(4));
                HotkeyManager.AddHotkey(DS3Interop.WinHandle, () => Settings.Default.LeaveSessionHotkey, () => DS3Interop.LeaveSession());

                ETWPingMonitor.Start();
                updateTimer.Start();
                gameStartTimer.Stop();
            }
        }