public static int Main (string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus (args[0] == "v"); try { string registryPath = Console.In.ReadLine (); string startupDir = Console.In.ReadLine (); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir); switch (args [1]) { case "scan": reg.ScanFolders (monitor, args.Length > 2 ? args [2] : null); break; case "get-desc": reg.ParseAddin (monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError ("Unexpected error in setup process", ex); return 1; } return 0; }
public AddinDatabase (AddinEngine addinEngine, AddinRegistry registry) { this.addinEngine = addinEngine; this.registry = registry; addinDbDir = Path.Combine (registry.AddinCachePath, "addin-db-" + VersionTag); fileDatabase = new FileDatabase (AddinDbDir); }
public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { AddinRegistry reg = new AddinRegistry (registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath); reg.CopyExtensionsFrom (registry); StringCollection files = new StringCollection (); for (int n=0; n<filesToIgnore.Length; n++) files.Add (filesToIgnore[n]); reg.ScanFolders (monitor, scanFolder, files); }
public AddinInstallerDialog (AddinRegistry reg, string message, string[] addinIds) { this.Build(); this.addinIds = addinIds; setup = new SetupService (reg); if (!CheckAddins (true)) UpdateRepos (); }
public SetupService () { if (AddinManager.IsInitialized) registry = AddinManager.Registry; else registry = AddinRegistry.GetGlobalRegistry (); repositories = new RepositoryRegistry (this); store = new AddinStore (this); }
public AddinInstallerDialog (AddinRegistry reg, string message, string[] addinIds, Builder builder, IntPtr handle): base (handle) { builder.Autoconnect (this); this.addinIds = addinIds; setup = new SetupService (reg); if (!CheckAddins (true)) UpdateRepos (); }
void IAddinInstaller.InstallAddins(AddinRegistry reg, string message, string[] addinIds) { if (logLevel > 0) { if (message != null && message.Length > 0) { Console.WriteLine (message); } else { Console.WriteLine ("Additional extensions are required to perform this operation."); } } ArrayList entries = new ArrayList (); SetupService setup = new SetupService (reg); string idNotFound; do { idNotFound = null; foreach (string id in addinIds) { string name = Addin.GetIdName (id); string version = Addin.GetIdVersion (id); AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin (name, version); if (ares.Length == 0) { idNotFound = id; entries.Clear (); break; } else entries.Add (ares[0]); } if (idNotFound != null) { if (repoUpdated) throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); if (prompt) { Console.WriteLine ("The add-in '" + idNotFound + "' could not be found in the registered repositories."); Console.WriteLine ("The repository indices may be outdated."); if (!Confirm ("Do you wan't to update them now?")) throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); } setup.Repositories.UpdateAllRepositories (new ConsoleProgressStatus (logLevel)); repoUpdated = true; } } while (idNotFound != null); if (logLevel > 0) { Console.WriteLine ("The following add-ins will be installed:"); foreach (AddinRepositoryEntry addin in entries) Console.WriteLine (" - " + addin.Addin.Name + " v" + addin.Addin.Version); if (prompt) { if (!Confirm ("Do you want to continue with the installation?")) throw new InstallException ("Installation cancelled"); } } setup.Install (new ConsoleProgressStatus (logLevel), (AddinRepositoryEntry[]) entries.ToArray (typeof(AddinRepositoryEntry))); }
public void InstallAddins (AddinRegistry reg, string message, string[] addinIds) { AddinInstallerDialog dlg = new AddinInstallerDialog (reg, message, addinIds); try { if (dlg.Run () == (int) Gtk.ResponseType.Cancel) throw new InstallException (Catalog.GetString ("Installation cancelled")); else if (dlg.ErrMessage != null) throw new InstallException (dlg.ErrMessage); } finally { dlg.Destroy (); } }
public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor); try { RemoteSetupDomain rsd = GetDomain (); rsd.GetAddinDescription (remMonitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, file, outFile); } catch (Exception ex) { throw new ProcessFailedException (remMonitor.ProgessLog, ex); } finally { System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor); ReleaseDomain (); } }
public void InstallAddins (AddinRegistry reg, string message, string[] addinIds) { Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.AddinInstallerDialog.ui", null); AddinInstallerDialog dlg = new AddinInstallerDialog (reg, message, addinIds, builder, builder.GetObject ("window1").Handle); try { if (dlg.Run () == (int) Gtk.ResponseType.Cancel) throw new InstallException (Catalog.GetString ("Installation cancelled")); else if (dlg.ErrMessage != null) throw new InstallException (dlg.ErrMessage); } finally { dlg.Destroy (); } }
public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "get-desc", file, outFile); }
public static int Main (string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus (int.Parse (args[0])); try { string registryPath = Console.In.ReadLine (); string startupDir = Console.In.ReadLine (); string addinsDir = Console.In.ReadLine (); string databaseDir = Console.In.ReadLine (); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); switch (args [1]) { case "scan": string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) folder = null; StringCollection filesToIgnore = new StringCollection (); for (int n=3; n<args.Length; n++) filesToIgnore.Add (args[n]); reg.ScanFolders (monitor, folder, filesToIgnore); break; case "get-desc": reg.ParseAddin (monitor, args[2], args[3]); break; } } catch (Exception ex) { monitor.ReportError ("Unexpected error in setup process", ex); return 1; } return 0; }
public AddinService(AddinRegistry ad) { this.ad = ad; }
public void GenerateScanDataFiles(IProgressStatus monitor, AddinRegistry registry, string scanFolder, bool recursive) { ExecuteCommand(monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "pre-scan", scanFolder, new List <string> { recursive.ToString() }); }
internal override bool CheckInstalled (AddinRegistry registry) { // TODO return true; }
public AssemblyLocatorVisitor(AddinDatabase database, AddinRegistry registry, bool usePreScanDataFiles) : base(database) { this.registry = registry; this.usePreScanDataFiles = usePreScanDataFiles; }
public AddinNavigationPoint(AddinRegistry registry) { this.registry = registry; }
internal abstract bool CheckInstalled (AddinRegistry registry);
void IAddinInstaller.InstallAddins(AddinRegistry reg, string message, string[] addinIds) { if (logLevel > 0) { if (message != null && message.Length > 0) { Console.WriteLine(message); } else { Console.WriteLine("Additional extensions are required to perform this operation."); } } ArrayList entries = new ArrayList(); SetupService setup = new SetupService(reg); string idNotFound; do { idNotFound = null; foreach (string id in addinIds) { string name = Addin.GetIdName(id); string version = Addin.GetIdVersion(id); AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin(name, version); if (ares.Length == 0) { idNotFound = id; entries.Clear(); break; } else { entries.Add(ares[0]); } } if (idNotFound != null) { if (repoUpdated) { throw new InstallException("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); } if (prompt) { Console.WriteLine("The add-in '" + idNotFound + "' could not be found in the registered repositories."); Console.WriteLine("The repository indices may be outdated."); if (!Confirm("Do you wan't to update them now?")) { throw new InstallException("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); } } setup.Repositories.UpdateAllRepositories(new ConsoleProgressStatus(logLevel)); repoUpdated = true; } }while (idNotFound != null); if (logLevel > 0) { Console.WriteLine("The following add-ins will be installed:"); foreach (AddinRepositoryEntry addin in entries) { Console.WriteLine(" - " + addin.Addin.Name + " v" + addin.Addin.Version); } if (prompt) { if (!Confirm("Do you want to continue with the installation?")) { throw new InstallException("Installation cancelled"); } } } setup.Install(new ConsoleProgressStatus(logLevel), (AddinRepositoryEntry[])entries.ToArray(typeof(AddinRepositoryEntry))); }
internal override bool CheckInstalled(AddinRegistry registry) { // TODO return(true); }
public void Scan(IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { ExecuteCommand(monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, filesToIgnore); }
public SetupTool(AddinRegistry registry) { this.registry = registry; service = new SetupService(registry); CreateCommands(); }
public PluginManager(AddinRegistry registry) : base(registry) { PluginRegistry = registry; }
public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { registry.ParseAddin (monitor, file, outFile); }
public AssemblyLocator(AddinDatabase database, AddinRegistry registry, AssemblyIndex index) { this.index = index; globalLocator = new AssemblyLocatorVisitor(database, registry, false); }
public void Fill(AddinRegistry reg, Extension ex) { Fill(reg, ex.ParentAddinDescription, ex.ParentAddinDescription, ex.Path); }
public static int Main(string[] args) { if (args.Length == 0 || args [0] == "--help" || args [0] == "help") { Console.WriteLine("Mono.Addins Setup Utility"); Console.WriteLine("Usage: mautil [options] <command> [arguments]"); Console.WriteLine(); Console.WriteLine("Options:"); Console.WriteLine(" --registry (-reg) Specify add-in registry path"); Console.WriteLine(" --path (-p) Specify startup path"); Console.WriteLine(" -v Verbose output"); } int ppos = 0; bool verbose = false; foreach (string a in args) { if (a == "-v") { verbose = true; } } string path = null; string startupPath = null; bool toolParam = true; while (toolParam && ppos < args.Length) { if (args [ppos] == "-reg" || args [ppos] == "--registry") { if (ppos + 1 >= args.Length) { Console.WriteLine("Registry path not provided."); return(1); } path = args [ppos + 1]; ppos += 2; } if (args [ppos] == "-p" || args [ppos] == "--path") { if (ppos + 1 >= args.Length) { Console.WriteLine("Startup path not provided."); return(1); } startupPath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-v") { verbose = true; ppos++; } else { toolParam = false; } } if (startupPath == null) { startupPath = Environment.CurrentDirectory; } AddinRegistry reg = path != null ? new AddinRegistry(path, startupPath) : AddinRegistry.GetGlobalRegistry(); try { SetupTool setupTool = new SetupTool(reg); setupTool.VerboseOutput = verbose; return(setupTool.Run(args, ppos)); } catch (Exception ex) { Console.WriteLine(ex); return(-1); } finally { reg.Dispose(); } }
/// <summary> /// Initializes a new instance /// </summary> /// <param name="registry"> /// Add-in registry to manage /// </param> public SetupService(AddinRegistry registry) { this.registry = registry; repositories = new RepositoryRegistry(this); store = new AddinStore(this); }
internal abstract bool CheckInstalled(AddinRegistry registry);
public AddinDescription LoadAddinManifest() { AddinDescription d = AddinRegistry.ReadAddinManifestFile(AddinManifestFileName); return(d); }
public void Scan(IProgressStatus monitor, AddinRegistry registry, string scanFolder, ScanOptions context) { var data = new List <string> (context.Write()); ExecuteCommand(monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, data); }
public CommandManager(AddinRegistry registry) { PluginRegistry = registry; PluginManager = new PluginManager(PluginRegistry); AddManagementCommands(); }
public void GetAddinDescription(IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { ExecuteCommand(monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "get-desc", file, new List <string> { outFile }); }
internal override bool CheckInstalled(AddinRegistry registry) { Addin[] addins = registry.GetAddins (); foreach (Addin addin in addins) { if (addin.Id == id && addin.SupportsVersion (version)) { return true; } } return false; }
public AddinBrowserViewContent(AddinRegistry registry) { ContentName = "Addin Browser"; widget = new AddinBrowserWidget(registry); }
public SingleFileAssemblyResolver (IProgressStatus progressStatus, AddinRegistry registry, AddinScanner scanner) { this.scanner = scanner; this.registry = registry; this.progressStatus = progressStatus; }
public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, filesToIgnore); }
public SetupService(AddinRegistry registry) { this.registry = registry; repositories = new RepositoryRegistry (this); store = new AddinStore (this); }
protected bool InitializeAddinRegistry() { if (string.IsNullOrEmpty(ConfigDir)) { Log.LogError("ConfigDir must be specified"); } if (string.IsNullOrEmpty(AddinsDir)) { Log.LogError("AddinsDir must be specified"); } if (string.IsNullOrEmpty(DatabaseDir)) { Log.LogError("DatabaseDir must be specified"); } if (string.IsNullOrEmpty(BinDir)) { Log.LogError("BinDir must be specified"); } ConfigDir = Path.GetFullPath(ConfigDir); BinDir = Path.GetFullPath(BinDir); AddinsDir = Path.GetFullPath(AddinsDir); DatabaseDir = Path.GetFullPath(DatabaseDir); bool rebuild = false; //the registry can get confused if we switch bindirs var markerFile = Path.Combine(DatabaseDir, "lastbin.txt"); if (Directory.Exists(DatabaseDir)) { if (!File.Exists(markerFile) || File.ReadAllText(markerFile) != BinDir) { rebuild = true; } } Registry = new AddinRegistry( ConfigDir, BinDir, AddinsDir, DatabaseDir ); Registry.RegisterExtension(new CecilReflectorExtension()); var progress = new LogProgressStatus(Log, 2); if (rebuild) { Log.LogMessage(MessageImportance.Normal, "Rebuilding addin database at {0}", DatabaseDir); Registry.Rebuild(progress); } else { Log.LogMessage(MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir); Registry.Update(progress); } File.WriteAllText(markerFile, BinDir); return(!Log.HasLoggedErrors); }
internal AddinSetupService(AddinRegistry r) : base(r) { }
public static int Main(string[] args) { if (args.Length == 0 || args [0] == "--help" || args [0] == "help") { Console.WriteLine("Hyena.Addins Setup Utility"); Console.WriteLine("Usage: mautil [options] <command> [arguments]"); Console.WriteLine(); Console.WriteLine("Options:"); Console.WriteLine(" --path (-p) Specify the startup path of the application"); Console.WriteLine(" --registry (-reg) Specify the add-in registry path"); Console.WriteLine(" --addinspath (-ap) Specify the default add-ins path of the application"); Console.WriteLine(" The path can be absolute or relative to the registry path"); Console.WriteLine(" --cachepath (-cp) Specify add-in cache path for the application"); Console.WriteLine(" The path can be absolute or relative to the registry path"); Console.WriteLine(" --package (-pkg) Specify the package name of the application"); Console.WriteLine(" -v Verbose output. Use multiple times to increase log level"); } int ppos = 0; int verbose = 1; string path = null; string startupPath = null; string addinsPath = null; string databasePath = null; string package = null; bool toolParam = true; while (toolParam && ppos < args.Length) { if (args [ppos] == "-reg" || args [ppos] == "--registry") { if (ppos + 1 >= args.Length) { Console.WriteLine("Registry path not provided."); return(1); } path = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-p" || args [ppos] == "--path") { if (ppos + 1 >= args.Length) { Console.WriteLine("Startup path not provided."); return(1); } startupPath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-ap" || args [ppos] == "--addinspath") { if (ppos + 1 >= args.Length) { Console.WriteLine("Add-ins path not provided."); return(1); } addinsPath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-cp" || args [ppos] == "--cachepath") { if (ppos + 1 >= args.Length) { Console.WriteLine("Add-ins cache path not provided."); return(1); } databasePath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-pkg" || args [ppos] == "--package") { if (ppos + 1 >= args.Length) { Console.WriteLine("Package name not provided."); return(1); } package = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-v") { verbose++; ppos++; } else { toolParam = false; } } AddinRegistry reg; if (package != null) { if (startupPath != null || path != null || addinsPath != null || databasePath != null) { Console.WriteLine("The --registry, --path, --cachepath and --addinspath options\ncan't be used when --package is specified."); return(1); } Application app = SetupService.GetExtensibleApplication(package); if (app == null) { Console.WriteLine("The package could not be found or does not provide add-in registry information."); return(1); } reg = app.Registry; } else { if (startupPath == null) { startupPath = Environment.CurrentDirectory; } reg = path != null ? new AddinRegistry(path, startupPath, addinsPath, databasePath) : AddinRegistry.GetGlobalRegistry(); } try { SetupTool setupTool = new SetupTool(reg); setupTool.VerboseOutputLevel = verbose; return(setupTool.Run(args, ppos)); } catch (Exception ex) { Console.WriteLine(ex); return(-1); } finally { reg.Dispose(); } }
internal override bool CheckInstalled(AddinRegistry registry) { return(false); }
internal override bool CheckInstalled(AddinRegistry registry) { return false; }
public void Scan (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string scanFolder, string[] filesToIgnore) { AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); StringCollection files = new StringCollection (); for (int n=0; n<filesToIgnore.Length; n++) files.Add (filesToIgnore[n]); reg.ScanFolders (monitor, scanFolder, files); }
public AddinDatabase (AddinRegistry registry) { this.registry = registry; addinDbDir = Path.Combine (registry.RegistryPath, "addin-db-" + VersionTag); fileDatabase = new FileDatabase (AddinDbDir); }
public void GetAddinDescription (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string file, string outFile) { AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); reg.ParseAddin (monitor, file, outFile); }
public void GetAddinDescription(IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { registry.ParseAddin(monitor, file, outFile); }