Example #1
0
        private void AddNewButton_Click(object sender, EventArgs e)
        {
            if (_instanceDialog.ShowDialog() != DialogResult.OK ||
                !File.Exists(_instanceDialog.FileName))
            {
                return;
            }

            var path = Path.GetDirectoryName(_instanceDialog.FileName);

            try
            {
                var instanceName = Path.GetFileName(path);
                instanceName = _manager.GetNextValidInstanceName(instanceName);
                KSP instance = new KSP(path, instanceName, GUI.user);
                _manager.AddInstance(instance);
                UpdateInstancesList();
            }
            catch (NotKSPDirKraken k)
            {
                GUI.user.displayError("Directory {0} is not valid KSP directory.",
                                      new object[] { k.path });
                return;
            }
        }
Example #2
0
        private void AddToCKANMenuItem_Click(object sender, EventArgs e)
        {
            if (_instanceDialog.ShowDialog() != DialogResult.OK ||
                !File.Exists(_instanceDialog.FileName))
            {
                return;
            }

            var path = Path.GetDirectoryName(_instanceDialog.FileName);

            try
            {
                var instanceName = Path.GetFileName(path);
                if (string.IsNullOrWhiteSpace(instanceName))
                {
                    instanceName = path;
                }
                instanceName = _manager.GetNextValidInstanceName(instanceName);
                KSP instance = new KSP(path, instanceName, GUI.user);
                _manager.AddInstance(instance);
                UpdateInstancesList();
            }
            catch (NotKSPDirKraken k)
            {
                GUI.user.RaiseError(Properties.Resources.ManageKspInstancesNotValid,
                                    new object[] { k.path });
                return;
            }
        }
Example #3
0
        private void AddNewButton_Click(object sender, EventArgs e)
        {
            if (m_BrowseKSPFolder.ShowDialog() == DialogResult.OK)
            {
                KSP    instance;
                string path = m_BrowseKSPFolder.SelectedPath;
                try
                {
                    instance = new KSP(path, GUI.user);
                }
                catch (NotFactorioDirectoryKraken) {
                    GUI.user.displayError("Directory {0} is not valid Factorio directory.", new object[] { path });
                    return;
                }
                catch (NotFactorioDataDirectoryKraken)
                {
                    GUI.user.displayError("Directory {0} is a Factorio directory, but can't detect game data dir, did you start the game at least once?", new object[] { path });
                    return;
                }

                string instanceName = Path.GetFileName(path);
                instanceName = manager.GetNextValidInstanceName(instanceName);
                manager.AddInstance(instanceName, instance);
                UpdateInstancesList();
            }
        }
Example #4
0
        private void AddNewButton_Click(object sender, EventArgs e)
        {
            if (m_BrowseKSPFolder.ShowDialog() == DialogResult.OK)
            {
                KSP instance;
                try
                {
                    instance = new KSP(m_BrowseKSPFolder.SelectedPath, GUI.user);
                }
                catch (NotKSPDirKraken) {
                    GUI.user.displayError("Directory {0} is not valid KSP directory.", new object[] { m_BrowseKSPFolder.SelectedPath });
                    return;
                }

                string instanceName = manager.GetNextValidInstanceName("New instance");
                manager.AddInstance(instanceName, instance);
                UpdateInstancesList();
            }
        }