public DefaultModuleDirectorySupervisor(IDirectoryController directories, ILogger logger, IModuleLoader moduleLoader) { this.directories = directories; this.logger = logger; this.filesToLoad = new ModuleFileLoadQueue(directories); this.loadTimer = new ModuleFileLoadTimer(filesToLoad,moduleLoader); }
public DefaultViewB(IModuleLoader moduleLoader, IModuleEnumerator moduleEnumerator) { this.moduleLoader = moduleLoader; this.moduleEnumerator = moduleEnumerator; InitializeComponent(); }
public static uint GetILOffset(this CorFrame frame, IModuleLoader moduleLoader) { var ip = frame.ILFrameIP; if (ip.IsExact || ip.IsApproximate) { return(ip.Offset); } if (ip.IsProlog) { return(0); } if (ip.IsEpilog) { var func = frame.Function; var file = func == null ? null : moduleLoader.LoadModule(func.Module, true); var mod = file == null ? null : file.ModuleDef; var md = mod == null ? null : mod.ResolveToken(frame.Token) as MethodDef; if (md != null && md.Body != null && md.Body.Instructions.Count > 0) { return(md.Body.Instructions[md.Body.Instructions.Count - 1].Offset); } } return(uint.MaxValue); }
/// <summary> /// Initializes a new instance of the <see cref="PluginLoader"/> class. /// </summary> /// <param name="directory">The directory.</param> /// <param name="jsonUtil">The json util.</param> /// <param name="pluginLoadContextProvider"></param> /// <param name="log">The log.</param> /// <param name="reflectorUtil">The reflector util.</param> /// <param name="objectFactory">The object factory.</param> /// <param name="pluginManagers"></param> /// <param name="moduleLoader"></param> /// <param name="loadActions"></param> /// <param name="unLoadActions"></param> /// <param name="applicationOption"></param> /// <param name="hostEnvironment"></param> public PluginLoader(ISysDirectory directory, IJsonUtil jsonUtil, IPluginLoadContextProvider pluginLoadContextProvider, ILogger <PluginLoader> log, IReflectorUtil reflectorUtil, IObjectFactory objectFactory, IPluginManagers pluginManagers, IModuleLoader moduleLoader, IEnumerable <IPluginLoadAction> loadActions, IEnumerable <IPluginUnLoadAction> unLoadActions, ApplicationOption applicationOption, IHostEnvironment hostEnvironment) { this.directory = directory; this.jsonUtil = jsonUtil; this.pluginLoadContextProvider = pluginLoadContextProvider; this.log = log; pluginContextDic = objectFactory.Create <ConcurrentDictionary <Guid, IPluginsLoadContext> >(); this.reflectorUtil = reflectorUtil; this.objectFactory = objectFactory; _pluginManagers = pluginManagers; _moduleLoader = moduleLoader; _loadActions = loadActions; _unLoadActions = unLoadActions; _applicationOption = applicationOption; _hostEnvironment = hostEnvironment; }
/// <summary> /// Initializes new instance of the <see cref="ModuleManager"/> class. /// </summary> /// <param name="moduleLoader">A module loader service, that will load individual modules. May not be <c>null</c>.</param> /// <param name="moduleFilter">A filter to selected modules that will actually be loaded</param> /// <param name="dependencyChecker">A dependency checker facility which is reposonsible for sorting the modules before loading.</param> /// <exception cref="ArgumentNullException">When <paramref name="moduleLoader"/> is <c>null</c></exception> public ModuleManager(IModuleLoader moduleLoader, IModuleFilter moduleFilter,IDependencyChecker dependencyChecker) { if (moduleLoader == null) throw new ArgumentNullException("moduleLoader"); _moduleLoader = moduleLoader; _moduleFilter = moduleFilter; _dependencyChecker = dependencyChecker; }
public static uint GetILOffset(this CorFrame frame, IModuleLoader moduleLoader) { var ip = frame.ILFrameIP; if (ip.IsExact || ip.IsApproximate) { return(ip.Offset); } if (ip.IsProlog) { return(0); } if (ip.IsEpilog) { var mod = moduleLoader.LoadModule(frame.Function?.Module, canLoadDynFile: true, isAutoLoaded: true)?.ModuleDef; var md = mod?.ResolveToken(frame.Token) as MethodDef; if (md != null && md.Body != null && md.Body.Instructions.Count > 0) { return(md.Body.Instructions[md.Body.Instructions.Count - 1].Offset); } } return(uint.MaxValue); }
public void When_application_context_is_started_it_will_initialized_all_the_module_loader() { MockRepository mocks = new MockRepository(); IModuleLoader mockLoader1 = mocks.DynamicMock <IModuleLoader>(); IModuleLoader mockLoader2 = mocks.DynamicMock <IModuleLoader>(); IModuleLoader mockLoader3 = mocks.DynamicMock <IModuleLoader>(); IApplicationShell stubShell = mocks.Stub <IApplicationShell>(); DefaultApplicationContext context = mocks.PartialMock <DefaultApplicationContext>( stubShell, mocks.DynamicMock <ILayoutRegistry>(), new IModuleLoader[] { mockLoader1, mockLoader2, mockLoader3 }); //we may have order dependnecies, let us verify //that it does this in order using (mocks.Record()) using (mocks.Ordered()) { mockLoader1.Initialize(context, stubShell); mockLoader2.Initialize(context, stubShell); mockLoader3.Initialize(context, stubShell); } using (mocks.Playback()) { context.Start(); } }
public ReferenceFinder(IFileIO fileIo, IModuleLoader loader, Action <ReferenceFinderOptions> optionsFunc) { _fileIo = fileIo; _loader = loader; _options = new ReferenceFinderOptions(); optionsFunc.Invoke(_options); }
public Startup(IHostingEnvironment env) { _env = env; var moduleLoaderFactory = new ModuleLoaderFactory(); _moduleLoader = moduleLoaderFactory.BuidlerModuleLoader(new ModuleLoaderOptions { NugetSources = new List <string> { @"d:\sidfeeds\core\", @"d:\sidfeeds\tools\", "https://api.nuget.org/v3/index.json", "https://www.myget.org/F/advance-ict/api/v3/index.json" }, ModuleFeedUri = new Uri("http://localhost:60008/configuration"), ProjectName = "ScimProvider" }); _moduleLoader.ModuleInstalled += ModuleInstalled; _moduleLoader.UnitsRestored += HandleUnitsRestored; _moduleLoader.ModulesLoaded += ModulesLoaded; _moduleLoader.ModuleCannotBeInstalled += ModuleCannotBeInstalled; _moduleLoader.Initialize(); _moduleLoader.RestoreUnits().Wait(); _moduleLoader.LoadUnits(); }
public void WillInitializeAllModuleLoadersOnStart() { MockRepository mocks = new MockRepository(); IModuleLoader mockLoader1 = mocks.DynamicMock <IModuleLoader>(); IModuleLoader mockLoader2 = mocks.DynamicMock <IModuleLoader>(); IModuleLoader mockLoader3 = mocks.DynamicMock <IModuleLoader>(); IShellView stubShell = mocks.Stub <IShellView>(); DefaultApplicationContext context = mocks.PartialMock <DefaultApplicationContext>( stubShell, new IModuleLoader[] { mockLoader1, mockLoader2, mockLoader3 }); using (mocks.Record()) { //we may have order dependnecies, let us verify //that it does this in order using (mocks.Ordered()) { mockLoader1.Initialize(context, stubShell); mockLoader2.Initialize(context, stubShell); mockLoader3.Initialize(context, stubShell); } //force context to ignore these calls Expect.Call(context.GetShellAsForm()).Return(null).Repeat.Once(); Expect.Call(delegate { context.RunForm(null); }).Repeat.Once(); } using (mocks.Playback()) { context.Start(); } }
public DefaultViewB(IModuleLoader moduleLoader, IModuleEnumerator moduleEnumerator) { this.moduleLoader = moduleLoader; this.moduleEnumerator = moduleEnumerator; InitializeComponent(); }
private int runCount = 0; // number of times run has been called #endregion Fields #region Constructors /// <summary> /// Initializes a new instance of the <see cref="Bot"/> class. /// </summary> /// <param name="client">The client.</param> /// <param name="userInteraction">The user interaction manager..</param> /// <param name="console">The console.</param> /// <param name="settings">The settings.</param> /// <param name="listener">The listener.</param> /// <param name="pluginHandler">The plugin handler.</param> /// <param name="moduleLoader">The module loader.</param> /// <param name="authorization">The authorization manager.</param> public Bot( Client client, IUserInteraction userInteraction, IConsole console, IBotSettings settings, IListener listener, IPluginHandler pluginHandler, IModuleLoader moduleLoader, IAuthorization authorization) { Guard.Against(client.IsNull(), "client"); Guard.Against(userInteraction.IsNull(), "userInteraction"); Guard.Against(console.IsNull(), "console"); Guard.Against(settings.IsNull(), "settings"); Guard.Against(listener.IsNull(), "listener"); Guard.Against(pluginHandler.IsNull(), "pluginHandler"); Guard.Against(moduleLoader.IsNull(), "moduleLoader"); Guard.Against(authorization.IsNull(), "authorization"); this.client = client; this.userInteraction = userInteraction; this.console = console; this.settings = settings; this.listener = listener; this.pluginHandler = pluginHandler; this.moduleLoader = moduleLoader; this.authorization = authorization; this.SessionStart = DateTime.Now; }
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); _env = env; var moduleLoaderFactory = new ModuleLoaderFactory(); _moduleLoader = moduleLoaderFactory.BuidlerModuleLoader(new ModuleLoaderOptions { NugetSources = new List <string> { @"d:\sidfeeds\core\", @"d:\sidfeeds\tools\", "https://api.nuget.org/v3/index.json", "https://www.myget.org/F/advance-ict/api/v3/index.json" }, ModuleFeedUri = new Uri("http://localhost:60008/configuration"), ProjectName = "EventStore" }); _moduleLoader.ModuleInstalled += ModuleInstalled; _moduleLoader.UnitsRestored += HandleUnitsRestored; _moduleLoader.ModulesLoaded += ModulesLoaded; _moduleLoader.ModuleCannotBeInstalled += ModuleCannotBeInstalled; _moduleLoader.Initialize(); _moduleLoader.RestoreUnits().Wait(); _moduleLoader.LoadUnits(); }
public Bootstrapper(IAssemblyLoader assemblyLoader, IModuleLoader moduleLoader, IActivator activator, IModuleImporter moduleImporter) { this.assemblyLoader = assemblyLoader; this.moduleLoader = moduleLoader; this.activator = activator; this.moduleImporter = moduleImporter; }
public ModulesController(ITranportableModuleWriter tranportableModuleWriter, IModuleLoader moduleLoader, ILoadableModuleFactory loadableModuleFactory) { _tranportableModuleWriter = tranportableModuleWriter; _moduleLoader = moduleLoader; _loadableModuleFactory = loadableModuleFactory; }
partial void OnInitialize() { Items = new ObservableCollection<DockBarItem>(); moduleLoader = this.GetDependency<IModuleLoader>(); TryLoadAdminWidgets(); }
public DefaultApplicationContext( IShellView shell, IModuleLoader[] loaders ) { this.shell = shell; this.loaders = loaders; }
public ModuleManager(IUnityContainer container, IModuleLoader containerLoader, IModuleTypeManager typeManager) { Container = container; Loader = containerLoader; TypeManager = typeManager; Modules = new List <ModuleContainer>(); }
public static bool GoTo(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (GoToIL(moduleIdProvider, documentTabService, moduleLoader, frame, newTab)) return true; //TODO: eg. native frame or internal frame return false; }
public static bool GoTo(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (GoToIL(fileTabManager, moduleLoader, frame, newTab)) return true; //TODO: eg. native frame or internal frame return false; }
public IModuleLoader GetModuleLoader() { if (_moduleLoader == null) { _logger.Debug("Resolving ModuleLoader"); _moduleLoader = Container.Resolve <IModuleLoader>(); } return(_moduleLoader); }
public IModuleLoader GetModuleLoader() { if (_moduleLoader == null) { _logger.Debug("Resolving ModuleLoader"); _moduleLoader = Container.Resolve<IModuleLoader>(); } return _moduleLoader; }
partial void OnInitialize() { moduleLoader = this.GetDependency<IModuleLoader>(); Widgets = new ObservableCollection<Widget>(); ErrorInfo = new ErrorInfo(); LoadTraybarWidgets(); }
public AboutViewModel(IModuleLoader loader, IAuthentication auth) { _loader = loader; _authentication = auth; _authentication.PropertyChanged += _authentication_PropertyChanged; AuthStatus = _authentication.Status.ToString(); Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
internal static void GoTo(IFileTabManager fileTabManager, IModuleLoader moduleLoader, IStackFrameManager stackFrameManager, ThreadVM vm, bool newTab) { if (vm == null) { return; } stackFrameManager.SelectedThread = vm.Thread; FrameUtils.GoTo(fileTabManager, moduleLoader, vm.Thread.AllFrames.FirstOrDefault(f => f.IsILFrame), newTab); }
public void AddLoader(IModuleLoader loader) { if (loader == null) { throw new ArgumentNullException(nameof(loader)); } m_loaders.Add(loader); }
public DefaultApplicationContext( IApplicationShell shell, ILayoutRegistry layouts, IModuleLoader[] loaders ) { this.shell = shell; this.layouts = layouts; this.loaders = loaders; }
public Startup(IConfiguration configuration, IConfigurationLoader configurationLoader, IModuleLoader moduleLoader, ILogger <Startup> logger) { this.configuration = configuration; this.configurationLoader = configurationLoader; this.moduleLoader = moduleLoader; this.logger = logger; }
public static bool GoToIL(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (!CanGoToIL(frame)) return false; var func = frame.Function; if (func == null) return false; return DebugUtils.GoToIL(fileTabManager, moduleLoader.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(moduleLoader), newTab); }
public static bool GoToIL(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (!CanGoToIL(frame)) return false; var func = frame.Function; if (func == null) return false; return DebugUtils.GoToIL(moduleIdProvider, documentTabService, moduleLoader.LoadModule(func.Module, canLoadDynFile: true, isAutoLoaded: true), frame.Token, frame.GetILOffset(moduleLoader), newTab); }
/// <summary> /// Initializes new instance of the <see cref="ModuleManager"/> class. /// </summary> /// <param name="moduleLoader">A module loader service, that will load individual modules. May not be <c>null</c>.</param> /// <param name="moduleFilter">A filter to selected modules that will actually be loaded</param> /// <param name="dependencyChecker">A dependency checker facility which is reposonsible for sorting the modules before loading.</param> /// <exception cref="ArgumentNullException">When <paramref name="moduleLoader"/> is <c>null</c></exception> public ModuleManager(IModuleLoader moduleLoader, IModuleFilter moduleFilter, IDependencyChecker dependencyChecker) { if (moduleLoader == null) { throw new ArgumentNullException("moduleLoader"); } _moduleLoader = moduleLoader; _moduleFilter = moduleFilter; _dependencyChecker = dependencyChecker; }
public static bool GoTo(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (GoToIL(fileTabManager, moduleLoader, frame, newTab)) { return(true); } //TODO: eg. native frame or internal frame return(false); }
public StartPageViewModel(IApplication application, IModuleLoader moduleLoader) { CategoryIndex = 0; _moduleLoader = moduleLoader; _application = application; Modules = new ObservableCollection <IModule>(); Modules.AddRange(_moduleLoader.GetModulesForCategory()); TileClickCommand = Command.CreateCommand <string>(TileClick); Categories = new Dictionary <string, int>(_moduleLoader.CategoryModuleCount); FilterCategoryCommand = Command.CreateCommand <KeyValuePair <string, int> >(FilterCategory); }
public virtual void LoadModules(ModularityOptions options = null) { if (options == null) { options = new ModularityOptions(); } ModuleLoader = options.ModuleLoader; Modules = ModuleLoader.Load(options.Folder, options.ConfigurationFile); }
public ProviderViewModel(IApplication app, IDataBase db, IModuleLoader moduleLoader) { _app = app; _db = db; _moduleLoader = moduleLoader; ExternalPrograms = new ObservableCollection <string>(); Places = new ObservableCollection <string>(); Modules = new ObservableCollection <string>(); FolderModules = new ObservableCollection <string>(); InitDbParts(); }
public Module(string id, IVirtualPath virtualPath, Module parent, IModuleLoader loader) { Evaluator = loader.Evaluator; Id = id; Parent = parent; Loader = loader; VirtualPath = virtualPath; parent?.Children?.Add(this); Loaded = false; Children = new List <Module>(); RequireFunction = new RequireFunction(Evaluator, loader, this); }
public FileBrowserViewModel(IApplication app, IDataBase db, IModuleLoader moduleLoader) { _app = app; NavigateCommand = Command.CreateCommand <string>(Navigate); RunModuleCommand = Command.CreateCommand <string>(RunModule); RunModuleDirectoryCommand = Command.CreateCommand <string>(RunModuleDirectory); RunProgramCommand = Command.CreateCommand <string>(RunProgram); FileDoubleClickedCommand = Command.CreateCommand <string>(FileDoubleClicked); CurrentFolder = FileListView.HomePath; ItemProvider = new ProviderViewModel(app, db, moduleLoader); CurrentFolder = @"HOME:\"; }
public V8EngineCore(IModulePathResolver pathResolver, IModuleLoaderFactory loaderFactory, int iDebuggingPort) { // デバッグありモード if (iDebuggingPort > 0) { engine = new V8ScriptEngine(V8ScriptEngineFlags.EnableDebugging, iDebuggingPort); } else { engine = new V8ScriptEngine(); } engine.DefaultAccess = ScriptAccess.Full; engine.SuppressExtensionMethodEnumeration = true; engine.AllowReflection = true; Engine = engine; this.pathResolver = pathResolver; NativeModules = new Dictionary <string, Module>(); Compilers = new Dictionary <string, IModuleCompiler>(); loader = loaderFactory.Create(Engine, NativeModules, Compilers, pathResolver); var scriptCompiler = new ScriptCompiler(); Compilers[".js"] = scriptCompiler; Compilers[".json"] = new JsonCompiler(); Compilers[".dll"] = new DllCompiler(); coreModule = new NativeModule("core", loader, this); NativeModules["core"] = coreModule; // NativeModules["host"] = new NativeModule("host", loader, new HostFunctions()); // NativeModules["xhost"] = new NativeModule("xhost", loader, new ExtendedHostFunctions()); NativeModules["host"] = new NativeModule("host", loader, new ExtendedHostFunctions()); engine.AddHostObject("clr", new HostTypeCollection("mscorlib", "System", "System.Core")); engine.AddHostObject("host", new ExtendedHostFunctions()); foreach (var script in ScriptModules.Scripts.Keys) { NativeModules.Add(script, new ScriptModule(script, loader)); } engine.Script.core = this; engine.Script.EngineInternal.isVoid = new Func <object, bool>(obj => obj is VoidResult); ExecuteWrapped(@" Object.defineProperty(this, 'global', { value: this, enumerable: true }); var engineInternal = this.EngineInternal; delete this.EngineInternal; Object.defineProperty(this, 'EngineInternal', { value: engineInternal }); "); Sleeping = true; }
public Module(string id, IVirtualPath virtualPath, Module parent, IModuleLoader loader) { Evaluator = loader.Evaluator; Id = id; Parent = parent; Loader = loader; VirtualPath = virtualPath; parent?.Children?.Add(this); Loaded = false; Children = new List<Module>(); RequireFunction = new RequireFunction(Evaluator, loader, this); }
public RShipCore(IModulePathResolver pathResolver, IModuleLoaderFactory loaderFactory) { engine = new V8ScriptEngine(V8ScriptEngineFlags.DisableGlobalMembers) { DefaultAccess = ScriptAccess.Full, SuppressExtensionMethodEnumeration = true, AllowReflection = true }; Engine = engine; this.pathResolver = pathResolver; NativeModules = new Dictionary <string, Module>(); Compilers = new Dictionary <string, IModuleCompiler>(); loader = loaderFactory.Create(Engine, NativeModules, Compilers, pathResolver); Console = new VirtualConsole.Console(null, Engine); StdOut = new StdOut.StdOut(); var scriptCompiler = new ScriptCompiler(); Compilers[".ship"] = scriptCompiler; Compilers[".js"] = scriptCompiler; Compilers[".json"] = new JsonCompiler(); Compilers[".dll"] = new DllCompiler(); coreModule = new NativeModule("core", loader, this); NativeModules["core"] = coreModule; NativeModules["console"] = new NativeModule("console", loader, Console); NativeModules["stdout"] = new NativeModule("stdout", loader, StdOut); NativeModules["cast"] = new NativeModule("cast", loader, new TypeCasts()); NativeModules["timer"] = new NativeModule("timer", loader, new TimerController(Console.ErrStream)); NativeModules["host"] = new NativeModule("host", loader, new HostFunctions()); NativeModules["xhost"] = new NativeModule("xhost", loader, new ExtendedHostFunctions()); NativeModules["async"] = new NativeModule("async", loader, new Async(engine)); foreach (var script in ScriptModules.Scripts.Keys) { NativeModules.Add(script, new ScriptModule(script, loader)); } engine.Script.core = this; engine.Script.console = Console; engine.Script.EngineInternal.isVoid = new Func <object, bool>(obj => obj is VoidResult); ExecuteWrapped(@" Object.defineProperty(this, 'global', { value: this, enumerable: true }); var engineInternal = this.EngineInternal; delete this.EngineInternal; Object.defineProperty(this, 'EngineInternal', { value: engineInternal }); "); Sleeping = true; disposePipe = new PipeableStream(engine); }
static Platform() { if (Utils.IsUnix()) { ModuleLoader = new Unix.UnixModuleLoader(); Strings = new Unix.UnixStrings(); } else { ModuleLoader = new Win32.Win32ModuleLoader(); Strings = new Win32.Win32Strings(); } }
public ModuleManager( IHostingEnvironment hostingEnvironment, IOptions <ModuleOptions> moduleOptions, IPlatoFileSystem fileSystem, IModuleLocator moduleLocator, IModuleLoader moduleLoader) { _moduleLocator = moduleLocator; _moduleLoader = moduleLoader; _fileSystem = fileSystem; _contentRootPath = hostingEnvironment.ContentRootPath; _virtualPathToModules = moduleOptions.Value.VirtualPathToModulesFolder; }
public IEnumerable <IAnalyserResult> AnalyseAssembly(IModuleLoader loader) { var result = new List <DependencyResult>(); var references = new List <TypeReference>(); var loadedModules = new List <ModuleDefinition>(); var unloadedModules = new Queue <string>(); unloadedModules.Enqueue(null); while (unloadedModules.Count > 0) { var moduleName = unloadedModules.Dequeue(); var module = loader.GetModule(moduleName); if (module == null) { continue; } var deps = GetDependencies(module).ToList(); references.AddRange(deps); loadedModules.Add(module); foreach (var scopeName in deps.SelectMany(d => d.References.Select(dd => dd.Scope)).Distinct()) { if (InternalModules.Contains(scopeName)) { continue; } if (loadedModules.Any(m => m.Name == scopeName)) { continue; } if (unloadedModules.Contains(scopeName)) { continue; } unloadedModules.Enqueue(scopeName); } } if (references.Any()) { result = Mapper.MapResults(references) .Select(r => new DependencyResult { Definition = r }).ToList(); } return(result); }
private static App SetupApplication() { var application = new App(); _moduleLoader = new ModuleLoader(application); Resolver.Register <IApplication>(() => application); Resolver.Register <IModuleLoader>(() => _moduleLoader); CommandLineParser = new CommandLineParser(application); JumpListFactory.CreateJumplist(); application.InitializeComponent(); application.ShutdownMode = ShutdownMode.OnMainWindowClose; application.MainWindow = new MainWindow(application); return(application); }
public static uint GetILOffset(this CorFrame frame, IModuleLoader moduleLoader) { var ip = frame.ILFrameIP; if (ip.IsExact || ip.IsApproximate) return ip.Offset; if (ip.IsProlog) return 0; if (ip.IsEpilog) { var mod = moduleLoader.LoadModule(frame.Function?.Module, canLoadDynFile: true, isAutoLoaded: true)?.ModuleDef; var md = mod?.ResolveToken(frame.Token) as MethodDef; if (md != null && md.Body != null && md.Body.Instructions.Count > 0) return md.Body.Instructions[md.Body.Instructions.Count - 1].Offset; } return uint.MaxValue; }
public static bool GoToIL(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab) { if (!CanGoToIL(frame)) { return(false); } var func = frame.Function; if (func == null) { return(false); } return(DebugUtils.GoToIL(fileTabManager, moduleLoader.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(moduleLoader), newTab)); }
public static uint GetILOffset(this CorFrame frame, IModuleLoader moduleLoader) { var ip = frame.ILFrameIP; if (ip.IsExact || ip.IsApproximate) return ip.Offset; if (ip.IsProlog) return 0; if (ip.IsEpilog) { var func = frame.Function; var file = func == null ? null : moduleLoader.LoadModule(func.Module, true); var mod = file == null ? null : file.ModuleDef; var md = mod == null ? null : mod.ResolveToken(frame.Token) as MethodDef; if (md != null && md.Body != null && md.Body.Instructions.Count > 0) return md.Body.Instructions[md.Body.Instructions.Count - 1].Offset; } return uint.MaxValue; }
public CompositionMapper(IModuleLoader loader) { if(!loader.ModulesLoaded) loader.InitializeModules(); Modules = new List<IModule>(); CompositionMaps = new Dictionary<string, CompositionMap>(); foreach (var module in loader.Modules) { Modules.Add(module); foreach (ModuleMapAttribute mapping in module.GetType().GetCustomAttributes(typeof(ModuleMapAttribute), false)) { CompositionMaps.Add(mapping.Key, new CompositionMap(mapping.Key, mapping.Type)); } } }
public ReactBridgeImpl( IReactAssemblyProvider assemblyProvider, IModuleLoader moduleLoader, IJavaScriptExecutor executor, IUIManager uiManager) { _assemblyProvider = assemblyProvider; _moduleLoader = moduleLoader; _executor = executor; _uiManager = uiManager; _timer = new Timer(16.67); // _timer = new Timer(5000); _timer.Elapsed += (e, a) => { PollQueue(); }; }
public RShipCore(IScriptEngine engine, IModulePathResolver pathResolver, IModuleLoaderFactory loaderFactory) { this.engine = engine; Evaluator = engine; engine.DefaultAccess = ScriptAccess.None; this.pathResolver = pathResolver; NativeModules = new Dictionary<string, Module>(); Compilers = new Dictionary<string, IModuleCompiler>(); loader = loaderFactory.Create(Evaluator, NativeModules, Compilers, pathResolver); Console = new VirtualConsole.Console(null, Evaluator); StdOut = new StdOut.StdOut(); CommandPipe = new CommandPipe(this); Compilers[".ship"] = Compilers[".js"] = new ScriptCompiler(); Compilers[".json"] = new JsonCompiler(); Compilers[".dll"] = new DllCompiler(); coreModule = new NativeModule("core", loader, this); NativeModules["core"] = coreModule; NativeModules["console"] = new NativeModule("console", loader, Console); NativeModules["stdout"] = new NativeModule("stdout", loader, StdOut); NativeModules["host"] = new NativeModule("host", loader, engine.CreateHostFunctions()); NativeModules["xhost"] = new NativeModule("xhost", loader, engine.CreateExtendedHostFunctions()); foreach (var script in ScriptModules.Scripts.Keys) { NativeModules.Add(script, new ScriptModule(script, loader)); } engine.Script.EngineInternal.isVoid = new Func<object, bool>(obj => obj is VoidResult); ExecuteWrapped(@" Object.defineProperty(this, 'global', { value: this, enumerable: true }); var engineInternal = this.EngineInternal; delete this.EngineInternal; Object.defineProperty(this, 'EngineInternal', { value: engineInternal }); "); Sleeping = true; }
public CustomServiceLocatorForTesting() { timerFake = new Mock<ITimer>(); timer = timerFake.Object; uiInvokerFake = new Mock<IUIInvoker>(); uiInvoker = uiInvokerFake.Object; uiInvokerFake.Setup(s => s.Invoke(It.IsAny<Action>())).Callback((Action a) => a.Invoke()); moduleLoaderFake = new Mock<IModuleLoader>(); moduleLoader = moduleLoaderFake.Object; moduleLoaderFake.Setup(s => s.LoadTraybarWidgets(It.IsAny<Traybar>())). Callback((Traybar traybar) => { traybar.Widgets.Add(new TraybarWidget()); }); moduleLoaderFake.Setup(s => s.LoadSlides(It.IsAny<Slideshow>())). Callback((Slideshow slideshow) => { slideshow.Slides.Add(new Slide(){ Title = "First slide" }); slideshow.Slides.Add(new Slide(){ Title = "Second slide" }); }); DomainContextFactory = new DomainContextFactoryMock(); aggregateCatalog.Catalogs.Add(new TypeCatalog(typeof(CustomServiceLocatorForTesting))); /*var myKernel = kernel as StandardKernel; myKernel.Bind<Mock<ITimer>>().ToConstant(timerFake); myKernel.Bind<ITimer>().ToConstant(timerFake.Object); myKernel.Bind<Mock<IUIInvoker>>().ToConstant(uiInvokerFake); myKernel.Bind<IUIInvoker>().ToConstant(uiInvokerFake.Object); myKernel.Bind<Mock<IModuleLoader>>().ToConstant(moduleLoaderFake); myKernel.Bind<IModuleLoader>().ToConstant(moduleLoaderFake.Object);*/ }
partial void OnInitialize() { SelectWidgetsDialog = new SelectWidgetsDialog(); moduleLoader = this.GetDependency<IModuleLoader>(); log = this.GetDependency<ILog>(); ErrorInfo = new ErrorInfo(); Slides = new ObservableCollection<Slide>(); Slides.CollectionChanged += Slides_CollectionChanged; TryLoadSlides(); SetSlideshowInfo(); timer = this.GetDependency<ITimer>(); timer.Elapsed += timer_Elapsed; modalDialogService = this.GetDependency<IModalDialogService>(); if (Slides.Count > 0) { cursor = 0; ChangeSlide(); } }
private void RegisterCoreServices() { switch (KernelConfiguration.DefaultSecurityChanged) { case false: { ModuleAppDomain = AppDomain.CreateDomain("Modules AppDomain", new Evidence( AppDomain.CurrentDomain. Evidence), AppDomain.CurrentDomain. BaseDirectory, AppDomain.CurrentDomain. BaseDirectory, true); break; } case true: { AppDomainSetup appDomainSetup = new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, }; ModuleAppDomain = AppDomain.CreateDomain( "Sandboxed Modules AppDomain", new Evidence(AppDomain.CurrentDomain.Evidence), appDomainSetup, KernelConfiguration.ModulesDomainPermissions, KernelConfiguration.FullTrustAssembliesSet.ToArray() ); break; } } // create kernel version of the event aggregator4 var siteEventAggregator = new EventAggregator(new NullGuiThreadProvider()); // use container creator to create communication services on modules app domain string asmName = typeof (ContainerCreator).Assembly.FullName; string typeName = typeof (ContainerCreator).FullName; var moduleLoaderCreator = (ContainerCreator) ModuleAppDomain.CreateInstanceAndUnwrap(asmName, typeName); // create facade for event aggregator combining proxy and on site object EventAggregator = new ForwardingEventAggregator(moduleLoaderCreator.EventAggregatorOnModulesDomain, siteEventAggregator); // used proxied service locator ServiceLocator = moduleLoaderCreator.ServiceLocator; ModuleLoader = moduleLoaderCreator.CreateModuleLoaderInstance(); _moduleManager = new ModuleManager(ModuleLoader, KernelConfiguration.ModuleFilter, KernelConfiguration.DependencyChecker); }
private void RegisterCoreServices(NomadConfiguration nomadConfiguration) { ModuleAppDomain = AppDomain.CreateDomain("Modules AppDomain", new Evidence(AppDomain.CurrentDomain.Evidence), AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory, true); // create kernel version of the event aggregator4 var siteEventAggregator = new EventAggregator(new NullGuiThreadProvider()); // use container creator to create communication services on modules app domain string asmName = typeof (ContainerCreator).Assembly.FullName; string typeName = typeof (ContainerCreator).FullName; if (typeName != null) { _moduleLoaderCreator = (ContainerCreator) ModuleAppDomain.CreateInstanceAndUnwrap(asmName, typeName); DistributedConfiguration distributedConfiguration = nomadConfiguration.DistributedConfiguration; String loggerConfiguration = KernelConfiguration.ModulesLoggerConfigurationFilePath; _moduleLoaderCreator.Install(distributedConfiguration, loggerConfiguration); // create facade for event aggregator combining proxy and on site object EventAggregator = new ForwardingEventAggregator(_moduleLoaderCreator.EventAggregatorOnModulesDomain, siteEventAggregator); // used proxied service locator ServiceLocator = _moduleLoaderCreator.ServiceLocator; ModuleLoader = _moduleLoaderCreator.CreateModuleLoaderInstance(); } _moduleManager = new ModuleManager(ModuleLoader, KernelConfiguration.ModuleFilter, KernelConfiguration.DependencyChecker); }
public RequireFunction(IScriptEvaluator scriptEvaluator, IModuleLoader loader, Module module) { this.scriptEvaluator = scriptEvaluator; Loader = loader; Module = module; }
public NativeModule(string id, IModuleLoader loader, object exports) : base(id, new NativeModulePath(id), null, loader) { OverrideExports(exports); Loaded = true; }
public static void GoToIL(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, ModuleId moduleId, uint token, uint ilOffset, bool newTab) { var file = moduleLoader.LoadModule(moduleId, canLoadDynFile: true, diskFileOk: false, isAutoLoaded: true); GoToIL(moduleIdProvider, documentTabService, file, token, ilOffset, newTab); }
public ModuleFileLoadTimer(ModuleFileLoadQueue modulesToLoad, IModuleLoader moduleLoader) { this.modulesToLoad = modulesToLoad; this.moduleLoader = moduleLoader; loadTick = new System.Threading.Timer(this.OnTick); }
public ScriptModule(string id, IModuleLoader loader) : base(id, new ScriptModulePath(id), null, loader) { }
private static bool ModuleLoadMapper(ReceiverList<IModuleLoader, Type[]> list, IModuleLoader receiver, Type[] parameter) { return receiver.Initialize(parameter); }