示例#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();
            }
        }
示例#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);
        }
示例#3
0
文件: TestData.cs 项目: trakos/CFAN
 public static CfanModule ModuleManagerModule()
 {
     return(CfanFileManager.fromCfanFile(DataDir("FARL_0.2.5.cfan")));
 }
示例#4
0
文件: TestData.cs 项目: trakos/CFAN
 public static CfanModule RsoModule()
 {
     return(CfanFileManager.fromCfanFile(Path.Combine(DataDir(), "rso-mod_1.5.1.cfan")));
 }