internal LoaderScriptExtension(string path) : base(path) { _script = File.ReadAllText(Path); _usings = new Usings(); _commands = new List <ScriptedCommand>(); _imports = new List <AssemblyName>(); _container = new ScriptedCommandContainer(this); ExtensionStore.InitExtension(this); Description = System.IO.Path.GetFileName(Path); Load(); foreach (var command in _commands) { var lcInfo = new LoaderCommand(this, command); command.LoaderCommand = lcInfo; AddItem(lcInfo); } var lccInfo = new LoaderCommandContainer(this, _container, typeof(ScriptedCommandContainer)); ExtensionStore.InitCommandContainer(lccInfo, Items.Cast <LoaderCommand>()); AddItem(lccInfo); }
void Initialize(AssemblyDescriber describer, TypeDescriptor[] types) { ExtensionStore.InitExtension(this); foreach (var type in types .OrderBy(x => x.IsInterface ? 0 : 1) .ThenBy(x => x.Implements(typeof(IFacet)) ? 0 : 1)) { try { if (type.Implements(typeof(IFacet))) { LoadFacetType(type, describer); } else if (type.Implements(typeof(IFacetFactory))) { LoadFacetFactory(type, describer); } else if (type.Implements(typeof(CommandContainer))) { LoadCommandContainer(type, describer); } else if (type.Implements(typeof(IConfigurator))) { if (!type.IsAbstract && type.HasPublicParameterlessConstructor) { AddItem(new LoaderConfiguratorType(this, type)); } } } catch (LoaderItemInitException e) { Debug.WriteLine("Could not load type {0}: {1}", type.FullName, e.Message); } } }