private void LoadToolWindows() { RegistryUtil.ForEachPackage(this, "ToolWindows", (packageId, key) => { foreach (string toolWindowId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(toolWindowId)) { Log.InfoFormat("Loading tool window {0}", toolWindowId); try { _registrations.Add(new ToolWindowRegistration( packageId, Guid.Parse(toolWindowId), RegistryUtil.GetBool(subKey.GetValue("MultipleInstances")), Enum <NiToolWindowOrientation> .Parse((string)subKey.GetValue("Orientation")), Enum <NiDockStyle> .Parse((string)subKey.GetValue("Style")), RegistryUtil.GetBool(subKey.GetValue("Transient")) )); } catch (Exception ex) { Log.Error("Could not load tool window", ex); } } } }); }
private void LoadProjectFactories() { RegistryUtil.ForEachPackage(this, "Projects", (packageId, key) => { foreach (string projectId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(projectId)) { Log.InfoFormat("Loading project factory {0}", projectId); try { _registrations.Add(new ProjectFactoryRegistration( packageId, Guid.Parse(projectId), (string)subKey.GetValue("DisplayName"), (string)subKey.GetValue("ProjectFileExtensions"), (string)subKey.GetValue("DefaultProjectExtension"), (string)subKey.GetValue("PossibleProjectExtensions") )); } catch (Exception ex) { Log.Error("Could not load project factory", ex); } } } }); }
private void LoadOptionPages() { RegistryUtil.ForEachPackage(this, "OptionPages", (packageId, key) => { foreach (string pageId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(pageId)) { Log.InfoFormat("Loading page {0}", pageId); try { _registrations.Add(new OptionPageRegistration( packageId, Guid.Parse(pageId), (string)subKey.GetValue("Class"), (string)subKey.GetValue("CategoryName"), (string)subKey.GetValue("PageName"), (string)subKey.GetValue("CategoryNameResourceId"), (string)subKey.GetValue("PageNameResourceId") )); } catch (Exception ex) { Log.Error("Could not load page", ex); } } } }); }
private void LoadClasses() { RegistryUtil.ForEachPackage(this, "CLSID", (packageId, key) => { foreach (string classId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(classId)) { Log.InfoFormat("Loading CLSID {0}", classId); try { _registrations.Add(new TypeRegistration( packageId, Guid.Parse(classId), (string)subKey.GetValue("Class") )); } catch (Exception ex) { Log.Error("Could not load CLSID", ex); } } } }); }
private void LoadEditorFactories() { RegistryUtil.ForEachPackage(this, "Editors", (packageId, key) => { foreach (string editorId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(editorId)) { Log.InfoFormat("Loading editor {0}", editorId); try { _registrations.Add(new EditorFactoryRegistration( packageId, Guid.Parse(editorId), (string)subKey.GetValue("DisplayName") )); } catch (Exception ex) { Log.Error("Could not load editor", ex); } } } }); }
private void LoadExtensions() { var projectRegistry = new ProjectExtensionRegistry(); RegistryUtil.ForEachPackage(this, "Projects", (packageId, key) => { foreach (string projectId in key.GetSubKeyNames()) { using (var subKey = key.OpenSubKey(projectId + "\\Extensions")) { if (subKey != null) { projectRegistry.Add(LoadExtensionRegistry(new Guid(projectId), subKey)); } } } }); ProjectRegistries = new ReadOnlyKeyedCollection <Guid, IKeyedCollection <string, ExtensionRegistration> >(projectRegistry); RegistryUtil.ForEachPackage(this, "Extensions", (packageId, key) => { DefaultRegistry = new ReadOnlyKeyedCollection <string, ExtensionRegistration>(LoadExtensionRegistry(null, key)); }); }
public NiCommandLine(IServiceProvider serviceProvider, string[] args) : base(serviceProvider) { _switches["RuntimeUpdate"] = false; RegistryUtil.ForEachPackage(this, "CommandLine", (packageId, key) => { foreach (string name in key.GetSubKeyNames()) { using (var switchKey = key.OpenSubKey(name)) { Log.InfoFormat("Loading switch '{0}'", switchKey); try { _switches[name] = RegistryUtil.GetBool(switchKey.GetValue("ExpectArgument")); } catch (Exception ex) { Log.Warn("Could not load switch", ex); } } } }); string failedArgument = null; if (args != null) { for (int i = 0; i < args.Length; i++) { string arg = args[i]; if (arg.StartsWith("/")) { bool expectArgument; if (!_switches.TryGetValue(arg.Substring(1), out expectArgument)) { failedArgument = arg; break; } string value = null; if (expectArgument) { if (i >= args.Length - 1) { failedArgument = arg; break; } value = args[++i]; } if (!_arguments.ContainsKey(arg)) { _arguments.Add(arg, value); } } else { _remainingArguments.Add(arg); } } } if (failedArgument != null) { MessageBox.Show( String.Format(Labels.CannotProcessSwitch, failedArgument), Labels.NetIde, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error ); Environment.Exit(0); } }