Example #1
0
        private void StopCapturing()
        {
            overlayTracker.StopCapturing();
            userInterfaceState.IsCapturingSingle = false;
            userInterfaceState.IsCapturingGlobal = false;
            startOverlayGlobalButton.Content     = "Start overlay";
            startSingleApplicationButton.Content = "Start application";

            RegistryUpdater.DisableImplicitLayer();
        }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();

            versionTextBlock.Text +=
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.DataContext = userInterfaceState;
            userInterfaceState.RecordingState = recordingStateDefault;

            RegistryUpdater.UpdateInstallDir();
        }
Example #3
0
        private int PerformRecovery(object parameter)
        {
            try
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress();

                RegistryUpdater.DisableImplicitLayer();

                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(true);
            }
            catch
            {
                ApplicationRestartRecoveryManager.ApplicationRecoveryFinished(false);
            }

            return(0);
        }
Example #4
0
        public MainWindow()
        {
            System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

            InitializeComponent();

            RegisterApplicationRecoveryAndRestart();

            Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            versionTextBlock.Text += ver.Major.ToString() + "." + ver.Minor.ToString() + "." + ver.Build.ToString();

            this.DataContext = userInterfaceState;
            userInterfaceState.RecordingState = recordingStateDefault;

            RegistryUpdater.UpdateInstallDir();
        }
Example #5
0
        private void StartCapture(InjectionMode mode)
        {
            if (GetInjectionMode() == InjectionMode.Disabled)
            {
                return;
            }

            if (GetInjectionMode() != mode)
            {
                StopCapturing();
            }

            if (!userInterfaceState.IsCapturing())
            {
                StoreConfiguration();
                SetInjectionMode(mode);
                if (mode == InjectionMode.Single)
                {
                    startSingleApplicationButton.Content = "Stop overlay";
                    overlayTracker.StartCaptureExe(targetExePath.Text, commandArgsExePath.Text);
                    userInterfaceState.IsCapturingSingle = true;
                }
                else if (mode == InjectionMode.All)
                {
                    overlayTracker.StartCaptureAll();
                    userInterfaceState.IsCapturingGlobal = true;
                    startOverlayGlobalButton.Content     = "Stop overlay";

                    RegistryUpdater.EnableImplicitlayer();
                }
            }
            else
            {
                if (mode == InjectionMode.All)
                {
                    // Check if all processes with GameOverlay.dll are terminated, otherwise
                    // warn the user to finish all processes.
                    if (overlayTracker.GetHookedProcesses().Count() > 0)
                    {
                        var    processIds = overlayTracker.GetHookedProcesses();
                        string processes  = "";

                        foreach (int id in processIds)
                        {
                            try
                            {
                                Process process = Process.GetProcessById(id);
                                if (process.ProcessName != "ApplicationFrameHost")
                                {
                                    processes += "\n" + process.ProcessName;
                                }
                            }
                            catch
                            {
                                // skip - process does not exist anymore
                            }
                        }

                        if (processes.Length > 0)
                        {
                            var result = MessageBox.Show(
                                "Continue stop capturing? Following processes are still running: " + processes, "Running processes", MessageBoxButton.YesNo);

                            if (result == MessageBoxResult.No)
                            {
                                return;
                            }
                        }
                    }
                }

                StopCapturing();
            }
        }