/// <summary>
        /// Uses the ExtensionPoint type to scan the plugins folder for extensions.
        /// </summary>
        /// <returns>
        /// An enumerable collection that contains information on each extension that will help the loader
        /// load them into the AppDomain. If no extensions are found, null is returned.</returns>
        public ShredStartupInfoList ScanExtensions()
        {
            Platform.Log(LogLevel.Debug, this.GetType().ToString() + ":" + this.GetType().Name + " in AppDomain [" + AppDomain.CurrentDomain.FriendlyName + "]");

            var shredInfoList = new ShredStartupInfoList();
			var xp = new ShredExtensionPoint();
            var shredObjects = xp.CreateExtensions();
            foreach (var shredObject in shredObjects)
            {
				var shredType = shredObject.GetType();
            	var asShred = shredObject as IShred;
				if (asShred == null)
				{
					Platform.Log(LogLevel.Debug, "Shred extension '{0}' does not implement IShred.", shredType.FullName);
					continue;
				}

            	var shredIsolation = shredType.GetCustomAttributes(typeof (ShredIsolationAttribute), true).OfType<ShredIsolationAttribute>().FirstOrDefault();
            	var shredIsolationLevel = shredIsolation == null ? ShredIsolationLevel.OwnAppDomain : shredIsolation.Level;

				var assemblyPath = new Uri(shredType.Assembly.CodeBase);
				var startupInfo = new ShredStartupInfo(assemblyPath, ((IShred)shredObject).GetDisplayName(), shredType.FullName, shredIsolationLevel);
                shredInfoList.Add(startupInfo);
            }

            return shredInfoList;
        }
Exemple #2
0
        /// <summary>
        /// Uses the ExtensionPoint type to scan the plugins folder for extensions.
        /// </summary>
        /// <returns>
        /// An enumerable collection that contains information on each extension that will help the loader
        /// load them into the AppDomain. If no extensions are found, null is returned.</returns>
        public ShredStartupInfoList ScanExtensions()
        {
            Platform.Log(LogLevel.Debug, this.GetType().ToString() + ":" + this.GetType().Name + " in AppDomain [" + AppDomain.CurrentDomain.FriendlyName + "]");

            var shredInfoList = new ShredStartupInfoList();
            var xp            = new ShredExtensionPoint();
            var shredObjects  = xp.CreateExtensions();

            foreach (var shredObject in shredObjects)
            {
                var shredType = shredObject.GetType();
                var asShred   = shredObject as IShred;
                if (asShred == null)
                {
                    Platform.Log(LogLevel.Debug, "Shred extension '{0}' does not implement IShred.", shredType.FullName);
                    continue;
                }

                var shredIsolation      = shredType.GetCustomAttributes(typeof(ShredIsolationAttribute), true).OfType <ShredIsolationAttribute>().FirstOrDefault();
                var shredIsolationLevel = shredIsolation == null ? ShredIsolationLevel.OwnAppDomain : shredIsolation.Level;

                if (shredIsolationLevel != ShredIsolationLevel.None)
                {
                    Platform.Log(LogLevel.Info, "Shred {0} is running in a seperate app domain", shredType.Name);
                }

                var assemblyPath = new Uri(shredType.Assembly.CodeBase);
                var startupInfo  = new ShredStartupInfo(assemblyPath, ((IShred)shredObject).GetDisplayName(), shredType.FullName, shredIsolationLevel);
                shredInfoList.Add(startupInfo);
            }

            return(shredInfoList);
        }
Exemple #3
0
        /// <summary>
        /// Uses the ExtensionPoint type to scan the plugins folder for extensions.
        /// </summary>
        /// <returns>
        /// An enumerable collection that contains information on each extension that will help the loader
        /// load them into the AppDomain. If no extensions are found, null is returned.</returns>
        public ShredStartupInfoList ScanExtensions()
        {
            Platform.Log(LogLevel.Debug, this.GetType().ToString() + ":" + this.GetType().Name + " in AppDomain [" + AppDomain.CurrentDomain.FriendlyName + "]");

            ShredStartupInfoList shredInfoList = new ShredStartupInfoList();
            ShredExtensionPoint xp = new ShredExtensionPoint();
            object[] shredObjects = xp.CreateExtensions();
            foreach (object shredObject in shredObjects)
            {
                if (shredObject is IShred)
                {
                    Uri assemblyPath = new Uri(shredObject.GetType().Assembly.CodeBase);
                    shredInfoList.Add(new ShredStartupInfo(assemblyPath, (shredObject as IShred).GetDisplayName(), shredObject.GetType().FullName));
                }
            }

            return shredInfoList;
        }
Exemple #4
0
        /// <summary>
        /// Uses the ExtensionPoint type to scan the plugins folder for extensions.
        /// </summary>
        /// <returns>
        /// An enumerable collection that contains information on each extension that will help the loader
        /// load them into the AppDomain. If no extensions are found, null is returned.</returns>
        public ShredStartupInfoList ScanExtensions()
        {
            Platform.Log(LogLevel.Debug, this.GetType().ToString() + ":" + this.GetType().Name + " in AppDomain [" + AppDomain.CurrentDomain.FriendlyName + "]");

            ShredStartupInfoList shredInfoList = new ShredStartupInfoList();
            ShredExtensionPoint  xp            = new ShredExtensionPoint();

            object[] shredObjects = xp.CreateExtensions();
            foreach (object shredObject in shredObjects)
            {
                if (shredObject is IShred)
                {
                    Uri assemblyPath = new Uri(shredObject.GetType().Assembly.CodeBase);
                    shredInfoList.Add(new ShredStartupInfo(assemblyPath, (shredObject as IShred).GetDisplayName(), shredObject.GetType().FullName));
                }
            }

            return(shredInfoList);
        }