//Choose the .zip file of the plugin private void BT_ChooseZipFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Filter = "Fichier .zip" + "|*.zip" }; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string installerEntry = ""; foreach (System.IO.Compression.ZipArchiveEntry item in FileManager.GetZipEntries(ofd.FileName)) { if (item.Name == "Installer" + PluginInstaller.installerExtension) { installerEntry = item.FullName; } } MemoryStream ins = FileManager.GetFileFromZip(ofd.FileName, installerEntry); if (ins != null) { PluginInstaller pi = FileManager.Deserialize <PluginInstaller>(ins); ins.Close(); if (pi != null) { installer = pi; this.TB_ZipFile.Text = ofd.FileName; this.TB_Description.Text = pi.ThePlugin.description; this.TB_Version.Text = pi.ThePlugin.version; } } else { throw new Exception("The Installer" + PluginInstaller.installerExtension + " was not found !"); } } }
public void InstallOutsideTapDir() { var depDef = new PackageDef(); depDef.Name = "Pkg1"; depDef.Version = SemanticVersion.Parse("1.0"); depDef.AddFile("Dependency.txt"); string dep0File = DummyPackageGenerator.GeneratePackage(depDef); string tempFn = Path.Combine(Path.GetTempPath(), Path.GetFileName(dep0File)); if (File.Exists(tempFn)) { File.Delete(tempFn); } File.Move(dep0File, tempFn); try { if (File.Exists("Dependency.txt")) { File.Delete("Dependency.txt"); } int exitCode; string output = RunPackageCli("install " + Path.GetFileName(tempFn), out exitCode, Path.GetDirectoryName(tempFn)); Assert.AreEqual(0, exitCode, "Unexpected exit code"); StringAssert.Contains("Installed Pkg1", output); Assert.IsTrue(File.Exists("Dependency.txt")); PluginInstaller.Uninstall(depDef, Directory.GetCurrentDirectory()); } finally { File.Delete(dep0File); File.Delete(tempFn); } }
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { PluginInstaller.InstallAppSettingKeys(); PluginInstaller.InstallFiles(); }
public void InstallPlugin(string path) { Dispatcher.Invoke(new Action(() => PluginInstaller.Install(path))); }
public PluginSelection(PluginInstaller installer) : this() { _installer = installer; CreateItems(); }
public static void Init() { if (initializing != null) { return; } initializing = new ManualResetEvent(false); plugins.Clear(); BasePluginLoader.ParsePluginsConfig(); if (UserSettingStorage.Instance.EnablePythonPlugins) { plugins.AddRange(new PythonPluginLoader().LoadPlugin()); } plugins.AddRange(new CSharpPluginLoader().LoadPlugin()); Forker forker = new Forker(); foreach (IPlugin plugin in plugins.Select(pluginPair => pluginPair.Plugin)) { IPlugin plugin1 = plugin; PluginPair pluginPair = plugins.FirstOrDefault(o => o.Plugin == plugin1); if (pluginPair != null) { PluginMetadata metadata = pluginPair.Metadata; pluginPair.InitContext = new PluginInitContext() { Plugins = plugins, CurrentPluginMetadata = metadata, ChangeQuery = s => App.Window.Dispatcher.Invoke(new Action(() => App.Window.ChangeQuery(s))), CloseApp = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.CloseApp())), HideApp = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.HideApp())), ShowApp = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.ShowApp())), ShowMsg = (title, subTitle, iconPath) => App.Window.Dispatcher.Invoke(new Action(() => App.Window.ShowMsg(title, subTitle, iconPath))), OpenSettingDialog = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.OpenSettingDialog())), ShowCurrentResultItemTooltip = (msg) => App.Window.Dispatcher.Invoke(new Action(() => App.Window.ShowCurrentResultItemTooltip(msg))), ReloadPlugins = () => App.Window.Dispatcher.Invoke(new Action(() => Init())), InstallPlugin = (filePath) => App.Window.Dispatcher.Invoke(new Action(() => { PluginInstaller.Install(filePath); })), StartLoadingBar = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.StartLoadingBar())), StopLoadingBar = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.StopLoadingBar())), //ShellRun = (cmd) => (bool)App.Window.Dispatcher.Invoke(new Func<bool>(() => App.Window.ShellRun(cmd))) }; pluginPair.InitContext.ShellRun = (cmd) => { try { return((bool)App.Window.Dispatcher.Invoke(new Func <bool>(() => App.Window.ShellRun(cmd)))); } catch (Exception) { return(false); } }; forker.Fork(() => plugin1.Init(pluginPair.InitContext)); } } ThreadPool.QueueUserWorkItem(o => { forker.Join(); initializing.Set(); initializing = null; }); }
public void BeginInstall(List<IPlugin> plugins) { PluginInstaller p = new PluginInstaller(); callBack done = new callBack(InstallFinished); p.InstallPlugin(plugins, progressBar1, label1, this, done); }