Пример #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string installPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\" + installedPathRegKeyName, "InstallPath", "") ?? "";

            state = InstallerState.Read(installPath);
            state.Update();
            if (e.Args.Length > 0 && e.Args[0] == "/uninstall")
            {
                if (MessageBox.Show("Are you sure you want to uninstall KinectToVR?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    if (Uninstaller.UninstallK2EX(installPath))
                    {
                        MessageBox.Show("Uninstalled successfully!");
                        if (Directory.Exists(installPath))
                        {
                            // https://stackoverflow.com/a/1305478/
                            ProcessStartInfo Info = new ProcessStartInfo();
                            Info.Arguments      = "/C choice /C Y /N /D Y /T 3 & rmdir /S /Q \"" + installPath + "\"";
                            Info.WindowStyle    = ProcessWindowStyle.Hidden;
                            Info.CreateNoWindow = true;
                            Info.FileName       = "cmd.exe";
                            Process.Start(Info);
                        }
                    }
                }
                Current.Shutdown(0);
            }
        }
Пример #2
0
        internal static void SetInstallerState(InstallerState installState)
        {
            Log.Info(string.Format("Setting installer state to {0}", installState), typeof(InstallPackage));

            Database coreDb = Database.GetDatabase("core");

            // Use reflection to get the int value because the properties base class changed in 9.3
            if (coreDb.GetType().Assembly.GetName().Version.Major >= 14)
            {
                //coreDb.PropertyStore.SetIntValue(INSTALLER_STATE_PROPERTY + Environment.MachineName, (int)installState);

                PropertyInfo propertyStorePropertyInfo = coreDb.GetType().GetProperty("PropertyStore");
                MethodInfo   propertyStoreGetMethod    = propertyStorePropertyInfo.GetGetMethod();
                object       propertyStore             = propertyStoreGetMethod.Invoke(coreDb, null);

                MethodInfo setIntValueMethodInfo = propertyStore.GetType().GetMethod("SetIntValue");
                setIntValueMethodInfo.Invoke(propertyStore, new object[] { INSTALLER_STATE_PROPERTY + Environment.MachineName, installState });
            }
            else
            {
                //coreDb.Properties.SetIntValue(INSTALLER_STATE_PROPERTY + Environment.MachineName, (int)installState);

                PropertyInfo propertiesPropertyInfo = coreDb.GetType().GetProperty("Properties");
                MethodInfo   propertiesGetMethod    = propertiesPropertyInfo.GetGetMethod();
                object       properties             = propertiesGetMethod.Invoke(coreDb, null);

                MethodInfo setIntValueMethodInfo = properties.GetType().GetMethod("SetIntValue");
                setIntValueMethodInfo.Invoke(properties, new object[] { INSTALLER_STATE_PROPERTY + Environment.MachineName, installState });
            }
        }
 private void UninstallButton_Click(object sender, RoutedEventArgs e)
 {
     CurrentState = InstallerState.AskingToUninstall;
     ShowMessage("Uninstall KrabbyQuestEmu?",
                 "Are you sure you want to uninstall the game? You can reinstall the game again later by " +
                 "pressing Start Installation.");
 }
Пример #4
0
        public void StartIfNeeded()
        {
            if (State != InstallerState.NotStarted)
            {
                return;
            }

            _server.ReceivedRequest += ServerOnReceivedRequest;
            _server.Start(XIVLauncher.PatchInstaller.PatcherMain.IPC_SERVER_PORT);

            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    "XIVLauncher.PatchInstaller.exe");

            var startInfo = new ProcessStartInfo(path);

            startInfo.UseShellExecute = true;

            //Start as admin if needed
            if (!EnvironmentSettings.IsNoRunas && System.Environment.OSVersion.Version.Major >= 6)
            {
                startInfo.Verb = "runas";
            }

            State = InstallerState.NotReady;

            Process.Start(startInfo);
        }
        private void RemoteCallHandler(PatcherIpcEnvelope envelope)
        {
            switch (envelope.OpCode)
            {
            case PatcherIpcOpCode.Hello:
                //_client.Initialize(_clientPort);
                Log.Information("[PATCHERIPC] GOT HELLO");
                State = InstallerState.Ready;
                break;

            case PatcherIpcOpCode.InstallOk:
                Log.Information("[PATCHERIPC] INSTALL OK");
                State = InstallerState.Ready;
                break;

            case PatcherIpcOpCode.InstallFailed:
                State = InstallerState.Failed;
                OnFail?.Invoke();

                Stop();
                Environment.Exit(0);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #6
0
        private void ServerOnReceivedRequest(object sender, ReceivedRequestEventArgs e)
        {
            Log.Information("[PATCHERIPC] IPC: " + e.Request);

            var msg = JsonConvert.DeserializeObject <PatcherIpcEnvelope>(PatcherMain.Base64Decode(e.Request), XIVLauncher.PatchInstaller.PatcherMain.JsonSettings);

            switch (msg.OpCode)
            {
            case PatcherIpcOpCode.Hello:
                _client.Initialize(XIVLauncher.PatchInstaller.PatcherMain.IPC_CLIENT_PORT);
                Log.Information("[PATCHERIPC] GOT HELLO");
                State = InstallerState.Ready;
                break;

            case PatcherIpcOpCode.InstallOk:
                Log.Information("[PATCHERIPC] INSTALL OK");
                State = InstallerState.Ready;
                break;

            case PatcherIpcOpCode.InstallFailed:
                State = InstallerState.Failed;
                MessageBox.Show(
                    "The patch installer ran into an error.\nPlease report this error.\nPlease use the official launcher.");
                Stop();
                Environment.Exit(0);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        internal static void SetInstallerState(InstallerState installState)
        {
            Log.Info(string.Format("Setting installer state to {0}", installState), typeof(InstallPackage));

            Database coreDb = Database.GetDatabase("core");

            coreDb.Properties.SetIntValue(INSTALLER_STATE_PROPERTY + Environment.MachineName, (int)installState);
        }
 private void WaitForUserCompletion()
 {
     CurrentState = InstallerState.WaitingForCompletion3D;
     ShowMessage("Waiting for Blender...",
                 "The installation is paused. Once the Blender addon has been \n" +
                 "successfully installed, the 'All Set' button will be available. \n \n" +
                 "If you do not want to install the 3D models right now, " +
                 "click 'Do it later'",
                 "All set", "Do it later");
 }
Пример #9
0
        public bool StartIfNeeded()
        {
            if (State != InstallerState.NotStarted)
            {
                return(true);
            }

            _serverPort = DEFAULT_IPC_SERVER_PORT;
            _clientPort = DEFAULT_IPC_CLIENT_PORT;

            try
            {
                _serverPort = GetAvailablePort(DEFAULT_IPC_SERVER_PORT);
                _clientPort = GetAvailablePort(_serverPort + 1);
            }
            catch (Exception ex)
            {
                Log.Warning(ex, "[PATCHERIPC] Could not find free ports, using defaults.");
            }

            Log.Information("[PATCHERIPC] Starting patcher with sp#{0} cp#{1}", _serverPort, _clientPort);

            _server.ReceivedRequest += ServerOnReceivedRequest;
            _server.Start(_serverPort);

            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    "XIVLauncher.PatchInstaller.exe");

            var startInfo = new ProcessStartInfo(path);

            startInfo.UseShellExecute = true;

            //Start as admin if needed
            if (!EnvironmentSettings.IsNoRunas && Environment.OSVersion.Version.Major >= 6)
            {
                startInfo.Verb = "runas";
            }

            startInfo.Arguments = $"{_serverPort} {_clientPort}";

            State = InstallerState.NotReady;

            try
            {
                Process.Start(startInfo);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not launch Patch Installer");
                return(false);
            }

            return(true);
        }
Пример #10
0
        protected override void OnStart(string[] args)
        {
            // Start thread - so we can do everything in the background
            TextWriterTraceListener tlog = new TimeDateTraceListener(Application.CommonAppDataPath + "\\Install.log", "Install");

            Trace.Listeners.Add(tlog);
            Trace.AutoFlush = true;
            Trace.WriteLine("OnStart");
            InstallState  = new InstallerState();
            installthread = new Thread(InstallThreadHandler);
            installthread.Start();
        }
        void ShowSuccessMessage()
        {
            CurrentState = InstallerState.GoToLauncher;
            var title = (!isPartialInstall ? "Installation" : partialTitle) + " Complete!";

            ShowMessage(title,
                        "The installation seems good so far, but to be sure, you should hop into the game " +
                        "and try it out! \n" +
                        "\n" +
                        "Use the 'Go to Launcher' button to be taken to the launch screen.",
                        "Go to Launcher",
                        "All set");
        }
Пример #12
0
        public void SetInstallerState(InstallerState state)
        {
            switch (state)
            {
            case InstallerState.ChoosingInstallationOptions:
                //make the installer options control visible and hide every other control
                installerOptionsControl.Visibility = Visibility.Visible;
                progressControl.Visibility         = Visibility.Collapsed;
                confirmUninstallControl.Visibility = Visibility.Collapsed;

                WindowTitle = "Configure your installation";
                break;

            case InstallerState.Installing:
                //make the progress control visible and hide every other control
                progressControl.Visibility         = Visibility.Visible;
                installerOptionsControl.Visibility = Visibility.Collapsed;
                confirmUninstallControl.Visibility = Visibility.Collapsed;

                WindowTitle = "Installing";

                //start the installation
                new Task(installProgram).Start();
                break;

            case InstallerState.ConfirmingUninstall:
                //make the uninstaller control visible and hide every other control
                confirmUninstallControl.Visibility = Visibility.Visible;
                installerOptionsControl.Visibility = Visibility.Collapsed;
                progressControl.Visibility         = Visibility.Collapsed;

                WindowTitle = "Confirm Removal";

                break;

            case InstallerState.Uninstalling:
                //make the progress control visible and hide every other control
                progressControl.Visibility         = Visibility.Visible;
                installerOptionsControl.Visibility = Visibility.Collapsed;
                confirmUninstallControl.Visibility = Visibility.Collapsed;

                progressControl.UninstallApplication = true;

                WindowTitle = "Uninstalling";

                //start the removal
                new Task(removeProgram).Start();
                break;
            }
        }
Пример #13
0
 public void StartInstall(DirectoryInfo gameDirectory, FileInfo file, PatchListEntry patch, Repository repo)
 {
     State = InstallerState.Busy;
     SendIpcMessage(new PatcherIpcEnvelope
     {
         OpCode = PatcherIpcOpCode.StartInstall,
         Data   = new PatcherIpcStartInstall
         {
             GameDirectory = gameDirectory,
             PatchFile     = file,
             Repo          = repo,
             VersionId     = patch.VersionId
         }
     });
 }
Пример #14
0
 public void StartInstall(DirectoryInfo gameDirectory, FileInfo file, PatchListEntry patch, Repository repo)
 {
     State = InstallerState.Busy;
     SendIpcMessage(new PatcherIpcEnvelope
     {
         OpCode = PatcherIpcOpCode.StartInstall,
         Data   = new PatcherIpcStartInstall
         {
             GameDirectory = gameDirectory,
             PatchFile     = file,
             Repo          = repo,
             VersionId     = patch.VersionId,
             KeepPatch     = App.Settings.KeepPatches.GetValueOrDefault(false)
         }
     });
 }
        public void StartIfNeeded(bool external = true)
        {
            var rpcName = "XLPatcher" + Guid.NewGuid().ToString();

            Log.Information("[PATCHERIPC] Starting patcher with '{0}'", rpcName);

            if (external)
            {
                this.rpc = new SharedMemoryRpc(rpcName);
                this.rpc.MessageReceived += RemoteCallHandler;

                var path = Path.Combine(AppContext.BaseDirectory,
                                        "XIVLauncher.PatchInstaller.exe");

                var startInfo = new ProcessStartInfo(path);
                startInfo.UseShellExecute = true;

                //Start as admin if needed
                if (!EnvironmentSettings.IsNoRunas && Environment.OSVersion.Version.Major >= 6)
                {
                    startInfo.Verb = "runas";
                }

                startInfo.Arguments = $"rpc {rpcName}";

                State = InstallerState.NotReady;

                try
                {
                    Process.Start(startInfo);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Could not launch Patch Installer");
                    throw new PatchInstallerException("Start failed.", ex);
                }
            }
            else
            {
                this.rpc = new InProcessRpc(rpcName);
                this.rpc.MessageReceived += RemoteCallHandler;

                this.internalPatchInstaller = new RemotePatchInstaller(new InProcessRpc(rpcName));
                this.internalPatchInstaller.Start();
            }
        }
        private void MsgCancelButton_Click(object sender, RoutedEventArgs e)
        {
            switch (CurrentState)
            {
            case InstallerState.AskingToInstall3D:
                WaitForUserCompletion();
                break;

            case InstallerState.WaitingForCompletion3D:
                Installation.Skip();
                goto default;

            default:
                HideMessage();
                CurrentState = InstallerState.NoSpecialState;
                break;
            }
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string installPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\" + installedPathRegKeyName, "InstallPath", "") ?? "";

            // get system display language
            string displayLanguage = CultureInfo.InstalledUICulture.TwoLetterISOLanguageName;

            // import strings.json from resources and parse it into a JObject


            state = InstallerState.Read(installPath);
            state.Update();
            if (e.Args.Length > 0 && e.Args[0] == "/uninstall")
            {
                if (MessageBox.Show("Are you sure you want to uninstall KinectToVR?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    try {
                        if (Uninstaller.UninstallK2EX(installPath))
                        {
                            MessageBox.Show("Uninstalled successfully!");
                            if (Directory.Exists(installPath))
                            {
                                // https://stackoverflow.com/a/1305478/
                                ProcessStartInfo Info = new ProcessStartInfo();
                                Info.Arguments      = "/C choice /C Y /N /D Y /T 3 & rmdir /S /Q \"" + installPath + "\"";
                                Info.WindowStyle    = ProcessWindowStyle.Hidden;
                                Info.CreateNoWindow = true;
                                Info.FileName       = "cmd.exe";
                                Process.Start(Info);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An error happened while trying to uninstall. Join our Discord for help on manually uninstalling.");
                        new ExceptionDialog(ex).ShowDialog();
                    }
                }
                Current.Shutdown(0);
            }
        }
        private void MsgOKButton_Click(object sender, RoutedEventArgs e)
        {
            switch (CurrentState)
            {
            case InstallerState.AskingToUninstall:
                StartInstallation(AutoInstall.InstallationType.Uninstallation);
                break;

            case InstallerState.AskingToInstall3D:
                GetBlenderPlugin();
                break;

            case InstallerState.WaitingForCompletion3D:
                Installation.Paused = false;
                break;

            case InstallerState.GoToLauncher:
                (Application.Current.MainWindow as MainWindow).SwitchScreen(MainWindow.ScreenState.Launcher);
                break;
            }
            CurrentState = InstallerState.NoSpecialState;
            HideMessage();
        }
        private void PromptBlenderPlugin()
        {
            Installation.Paused = true;
            ShowMessage("Blender Addon Required",
                        "KrabbyQuestEmu requires all models to be converted. " +
                        "Joric's B3D importer Blender addon is required to do this, as Blender cannot do this conversion " +
                        "normally. \n \n" +
                        "Link to addon: ",
                        "Yes", "No/Installed Already");
            var link = new Hyperlink()
            {
                NavigateUri = new Uri("https://github.com/joric/io_scene_b3d")
            };

            link.Inlines.Add(link.NavigateUri.AbsoluteUri);
            link.RequestNavigate += (object s, RequestNavigateEventArgs e) =>
            {
                Process.Start(e.Uri.AbsoluteUri);
                e.Handled = true;
            };
            MsgBody.Inlines.Add(link);
            MsgBody.Inlines.Add("\nIf you don't want to install this or already have the addon, Click 'No/Installed Already'");
            CurrentState = InstallerState.AskingToInstall3D;
        }
        internal static void SetInstallerState(InstallerState installState)
        {
            Log.Info(string.Format("Setting installer state to {0}", installState), typeof(InstallPackage));

            Database coreDb = Database.GetDatabase("core");
            coreDb.Properties.SetIntValue(INSTALLER_STATE_PROPERTY, (int)installState);
        }
Пример #21
0
 public CitrixXenServerInstallStatus(InstallerState InstallState)
 {
     this.InstallState = InstallState;
 }