protected override void OnAggregationComplete()
        {
            base.OnAggregationComplete();
            MSBuildProject = Microsoft.Build.BuildEngine.Engine.GlobalEngine.GetLoadedProject(fileName);
            package.explorer.projectMngrs.Add(fileName, this);
            SectionHandler sh = new SectionHandler();
            sh.Application = "Bistro.Application";
            sh.LoggerFactory = "Bistro.Logging.DefaultLoggerFactory";
            Bistro.Application.Initialize(sh);
            Engine = new Bistro.MethodsEngine.EngineControllerDispatcher(Bistro.Application.Instance);

        }
        /// <summary>
        /// Loads the assembly.
        /// </summary>
        /// <param name="assm">The assm.</param>
        public static bool LoadAssemblies(List<Assembly> assmlist,EngineControllerDispatcher engine)
        {
            bool controllerFound = false;
            int k = 0;
            try
            {
                foreach (Assembly assm in assmlist)
                {
                    var aaa = assm.GetTypes();
                    int i = 0;
                    int j = aaa.Length;
                    foreach (Type t in aaa)
                    {
                        if (t.GetInterface(typeof(IController).Name) != null)
                        {
                            controllerFound = true;
                            if (!t.IsAbstract)
                            {
                                IControllerDescriptor descriptor = ControllerDescriptor.CreateDescriptor(t, null);
                                engine.RegisterController(descriptor);
                            }
                        }
                        i++;
                    }
                    k++;
                }
            }
            catch (ReflectionTypeLoadException ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(ex.Message);
                for (int i = 0; i < ex.Types.Length; i++)
                    if (ex.Types[i] != null)
                        sb.AppendFormat("\t{0} loaded\r\n", ex.Types[i].Name);

                for (int i = 0; i < ex.LoaderExceptions.Length; i++)
                    if (ex.LoaderExceptions[i] != null)
                        sb.AppendFormat("\texception {0}\r\n", ex.LoaderExceptions[i].Message);

                Debug.WriteLine("ExceptionLoadingAssembly " + assmlist[k].FullName + " " + sb.ToString());
            }
            return controllerFound;
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Resource"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="name">The resource name.</param>
 public Resource(EngineControllerDispatcher engine, string _name)
 {
     this.name = _name;
     this.engine = engine;
 }