Example #1
0
        public override Task ActivateAsync()
        {
            try
            {
                Installations.Clear();

                foreach (var install in _settingsService.GetInstallations())
                {
                    Installations.Add(new InstallLocationModel(install));
                }

                if (Installations.Any())
                {
                    Installations[0].IsDefault.Value = true;
                }
            }
            catch (Exception e)
            {
                Tracer.Error(e);
            }
            finally
            {
                IsLoading.Value = false;
            }

            return(base.ActivateAsync());
        }
Example #2
0
        private void OnDetectInstallations()
        {
            try
            {
                var installations      = InstallationLocator.Locate();
                var addedInstallations = new List <string>();

                foreach (var installation in installations)
                {
                    if (Installations.All(i => i.ToString() != installation.ToString()))
                    {
                        Installations.Add(new InstallLocationModel(installation));
                        addedInstallations.Add(installation.Directory);
                    }
                }

                foreach (var directory in addedInstallations)
                {
                    _settingsService.AddInstalls(directory);
                }
            }
            catch (Exception e)
            {
                GeneralExceptionHandler.Instance.OnError(e);
            }
        }
Example #3
0
        private void OnAddInstallation()
        {
            try
            {
                var folderBrowser = new FolderBrowserDialog
                {
                    Description         = "Please select the DCS folder you wish to add...",
                    RootFolder          = Environment.SpecialFolder.MyComputer,
                    ShowNewFolderButton = false
                };

                if (folderBrowser.ShowDialog() == DialogResult.OK)
                {
                    var selectedFolder = folderBrowser.SelectedPath;
                    var installation   = new InstallLocation(selectedFolder);

                    Installations.Add(new InstallLocationModel(installation));

                    _settingsService.AddInstalls(installation.Directory);
                }
            }
            catch (Exception e)
            {
                GeneralExceptionHandler.Instance.OnError(e);
            }
        }
Example #4
0
        // TODO: This service should create the Installation itself
        /// <summary>
        /// Adds the installation if an installation with the same path doesn't already exist.
        /// </summary>
        /// <param name="install">The install.</param>
        /// <returns>If the install was added sucessfully</returns>
        public bool TryAddInstallation(IInstallation install)
        {
            if (install == null)
            {
                return(false);
            }

            if (Installations.Any(testInstall => install.Path.NormalizePath() == testInstall.Path.NormalizePath()))
            {
                return(false);
            }

            Installations.Add(install);
            return(true);
        }
        public override Task ActivateAsync()
        {
            Installations.Clear();

            foreach (var install in _settingsService.GetInstallations())
            {
                Installations.Add(install);
            }

            SelectedInstall.Value = _settingsService.SelectedInstall;

            CheckDcsStatus();

            return(base.ActivateAsync());
        }
Example #6
0
        public override Task ActivateAsync()
        {
            try
            {
                Installations.Clear();

                foreach (var install in SettingsController.GetInstallations())
                {
                    Installations.Add(new InstallLocationModel(install));
                }
            }
            catch (Exception e)
            {
                Tracer.Error(e);
            }

            return(base.ActivateAsync());
        }
Example #7
0
        private void UpdateInstallations()
        {
            Installations.Clear();

            var selectedInstall = SelectedInstall.Value;

            if (selectedInstall == null)
            {
                selectedInstall = SettingsController.GetCurrentInstall();
            }

            foreach (var install in SettingsController.GetInstallations())
            {
                Installations.Add(install);
            }

            SelectedInstall.Value = selectedInstall;
        }
Example #8
0
        // TODO: the app shouldn't rely on if an MCFireWorld is found in WorldExporerService, it should:
        // TODO: 1) discover worlds found in an installation folder for use by the rest of the app
        // TODO: 2) save MCFireWorlds on shutdown
        // TODO: 3) MCFireWorlds should operate without being added to the service (operate after being removed too)
        // TODO: 4) MCFireWorlds should have clear guarantees when 2 operate on the same world (or when Minecraft open)
        // TODO: 5) Move IWorldExplorerService to MCFire.Common

        public WorldWorldExplorerService()
        {
            // TODO: FIRSTRUN after new assemblies
#if DEBUG && !FIRSTRUN
            // if debug, add game installation automatically
            if (Installations.Count != 0)
            {
                return;
            }
            var path =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft")
                .ToLower();
            var gameInstall = Installation.New(path);
            if (gameInstall != null)
            {
                Installations.Add(gameInstall);
            }
#endif
        }
Example #9
0
        private void DiscoverAndAddInstallationsFromRegistry(bool user_scope)
        {
            RemoveRegistryAutoDiscoveredInstallations(user_scope);

            var _installs = user_scope ? AdoptiumInstallationsDiscoverer.DiscoverInstallationsByRegistryHKCU() :
                            AdoptiumInstallationsDiscoverer.DiscoverInstallationsByRegistryHKLM();

            HoldAutoReCheckForUpdateSuggested = true;
            for (int k = 0; k < _installs.Count; k++)
            {
                DiscoveredInstallation i = _installs[k];

                // we want to reset HoldAutoReCheckForUpdateSuggested at the last element
                if (k == _installs.Count - 1)
                {
                    HoldAutoReCheckForUpdateSuggested = false;
                }

                Installation inst = new Installation(i, true, user_scope);
                Installations.Add(inst);
            }
        }