Beispiel #1
0
        private void installFromckanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog open_file_dialog = new OpenFileDialog {
                Filter = Resources.CKANFileFilter
            };

            if (open_file_dialog.ShowDialog() == DialogResult.OK)
            {
                var        path = open_file_dialog.FileName;
                CfanModule module;

                try
                {
                    module = CfanFileManager.fromCfanFile(path);
                }
                catch (Kraken kraken)
                {
                    m_User.RaiseError(kraken.Message + ": " + kraken.InnerException.Message);
                    return;
                }
                catch (Exception ex)
                {
                    m_User.RaiseError(ex.Message);
                    return;
                }

                // We'll need to make some registry changes to do this.
                RegistryManager registry_manager = RegistryManager.Instance(CurrentInstance);

                // Remove this version of the module in the registry, if it exists.
                registry_manager.registry.RemoveAvailable(module);

                // Sneakily add our version in...
                registry_manager.registry.AddAvailable(module);

                var changeset = new List <ModChange>();
                changeset.Add(new ModChange(
                                  new GUIMod(module, registry_manager.registry, CurrentInstance.Version()),
                                  GUIModChangeType.Install, null));

                menuStrip1.Enabled = false;

                RelationshipResolverOptions install_ops = RelationshipResolver.DefaultOpts();
                install_ops.with_recommends = false;

                m_InstallWorker.RunWorkerAsync(
                    new KeyValuePair <List <ModChange>, RelationshipResolverOptions>(
                        changeset, install_ops));
                m_Changeset = null;

                UpdateChangesDialog(null, m_InstallWorker);
                ShowWaitDialog();
            }
        }
Beispiel #2
0
        internal static CfanModule LoadCkanFromFile(CKAN.KSP current_instance, string ckan_file)
        {
            CfanModule module = CfanFileManager.fromCfanFile(ckan_file);

            // We'll need to make some registry changes to do this.
            RegistryManager registry_manager = RegistryManager.Instance(current_instance);

            // Remove this version of the module in the registry, if it exists.
            registry_manager.registry.RemoveAvailable(module);

            // Sneakily add our version in...
            registry_manager.registry.AddAvailable(module);

            return(module);
        }
Beispiel #3
0
 public static CfanModule ModuleManagerModule()
 {
     return(CfanFileManager.fromCfanFile(DataDir("FARL_0.2.5.cfan")));
 }
Beispiel #4
0
 public static CfanModule RsoModule()
 {
     return(CfanFileManager.fromCfanFile(Path.Combine(DataDir(), "rso-mod_1.5.1.cfan")));
 }