private void SetCallingAssembly(Assembly assembly)
 {
   if (!assembly.Equals(Assembly.GetExecutingAssembly()))
   {
     _callingAssembly = assembly;
   }
 }
Esempio n. 2
0
        /// <summary>
        /// Load module from an assembly
        /// </summary>
        /// <param name="moduleAssembly">Assembly that contains module that you want to load</param>
        public EssModule LoadModule( Assembly moduleAssembly )
        {
            Preconditions.NotNull( moduleAssembly, "ModuleAssembly cannot be null" );

            // Prevents to load uEssentials dll accidently
            if ( moduleAssembly.Equals( typeof(EssCore).Assembly ) )
                return null;

            EssModule moduleInstance = null;

            foreach ( var type in moduleAssembly.GetTypes() )
            {
                if ( !type.IsSubclassOf( typeof (EssModule) ) ) continue;

                moduleInstance = (EssModule) Activator.CreateInstance( type );
                moduleInstance.Assembly = moduleAssembly;
            }

            Preconditions.NotNull( moduleInstance, "Could load module from assembly " +
                moduleAssembly.FullName +
                $" because it does not contains any class that extends '{typeof (EssModule)}" );

            LoadModule( moduleInstance );

            return moduleInstance;
        }
 internal virtual bool IsEntryAssembly(Assembly assembly)
 {
     return assembly.Equals(Assembly.GetEntryAssembly());
 }
Esempio n. 4
0
        public static bool IsInheritable(Assembly assembly, FieldInfo member)
        {
            if (member == null)
                return false;

            if (member.IsPublic)
                return true;
            if (!member.IsPrivate && assembly.Equals(member.DeclaringType.Assembly))
                return true;

            return false;
        }
Esempio n. 5
0
		internal static AssemblyTreeNode FindAssemblyTreeNode(Assembly assy)
		{
			foreach (TreeNode node in _assyRootNode.LogicalNodes) {
				if (node is AssemblyTreeNode) {
					AssemblyTreeNode atNode = (AssemblyTreeNode)node;
					if (assy.Equals(atNode.Assembly))
						return atNode;
				}
			}
			return null;
		}