Exemplo n.º 1
0
        public async Task <bool> LoadApplicationScript(string bundle, string sourceUrl)
        {
            Reset();

            _modules = _moduleLoader.Load(this, _assemblyProvider.Assemblies()).ToList();

            _modules.Apply(m => m.Instance.Initialize(this));

            System.Diagnostics.Debug.WriteLine("Executor Setup");
            _executor.Setup();

            System.Diagnostics.Debug.WriteLine("Injecting Modules");
            InjectModules();

            System.Diagnostics.Debug.WriteLine("Executing Script");
            await _executor.Execute(bundle, sourceUrl);

            System.Diagnostics.Debug.WriteLine("flushing");
            var results = await _executor.ExecuteJSCall("BatchedBridge", "flushedQueue", null);

            HandleBuffer(results);
            _timer.Enabled = true;

            return(true);
        }
Exemplo n.º 2
0
        public ObjectModel(IModuleLoader modules)
        {
            modules.Scan(); // Scan to ensure we have an up to date list of modules.

            var module = modules.GetModules().FirstOrDefault(m => m.ObjectModel);

            if (module != null)
            {
                this.InstalledVersion = module.Version;
            }

            AutoUpdate.Updater <ObjectModel> .Mandatory            = true;
            AutoUpdate.Updater <ObjectModel> .UpdateMode           = Mode.ForcedDownload;
            AutoUpdate.Updater <ObjectModel> .DownloadPath         = modules.DataPath;
            AutoUpdate.Updater <ObjectModel> .CheckForUpdateEvent += (UpdateInfoEventArgs args) =>
            {
                if (args == null)
                {
                    return;
                }
                if (args.IsUpdateAvailable)
                {
                    AutoUpdate.Updater <ObjectModel> .DownloadUpdate();

                    AutoUpdate.Updater <ObjectModel> .Exit();

                    modules.Scan();
                }

                modules.Load();
            };
            AutoUpdate.Updater <ObjectModel> .ApplicationExitEvent += () =>
            {
                int i = 0;
            };

            if (CoreExtensionApplication._current.Configuration.EnableObjectModelUpdate)
            {
                AutoUpdate.Updater <ObjectModel> .Start(CoreExtensionApplication._current.Configuration.ObjectModelUrl, this);
            }
            else
            {
                modules.Scan();
                modules.Load();
            }
        }
        public virtual void LoadModules(ModularityOptions options = null)
        {
            if (options == null)
            {
                options = new ModularityOptions();
            }

            ModuleLoader = options.ModuleLoader;

            Modules = ModuleLoader.Load(options.Folder, options.ConfigurationFile);
        }
Exemplo n.º 4
0
 private static void LoadAssemblyModules(Assembly target)
 {
     //We simply use reflection to call a loading class for each module.
     foreach (Type type in target.GetTypes())
     {
         if (InterfaceTest(type))
         {
             IModuleLoader ml = Activator.CreateInstance(type) as IModuleLoader;
             if (ml == null)
             {
                 continue;
             }
             Debug.WriteLine(string.Format("Found Module \"{0}\", Version {1}", ml.Name, ml.Version));
             ml.Load();
         }
     }
 }
Exemplo n.º 5
0
        public Module Run(string request)
        {
            if (!Sleeping)
            {
                throw new InvalidOperationException("Running at this state is not permitted.");
            }

            Sleeping = false;
            try
            {
                return(loader.Load(request, null, true));
            }
            catch (Exception ex)
            {
                Console.WriteErr(ex.GetScriptStack());
                Sleeping = true;
                throw;
            }
        }
Exemplo n.º 6
0
        public IEnumerable <(IFullName referee, IFullName reference)> FindReferences(out IEnumerable <FailedModule> failedModules)
        {
            _modules = new List <IModule>();
            var failed = new List <FailedModule>();
            var dlls   = _fileIo.GetFilePaths(_options.Directory, "*.dll", _options.SearchOption);

            foreach (var dll in dlls)
            {
                var module = _loader.Load(dll);
                if (module is FailedModule f)
                {
                    failed.Add(f);
                }
                _modules.Add(module);
            }

            failedModules = failed;
            return(FindReferences(_modules, _options.FindReferenceName));
        }