Esempio n. 1
0
		public override void LoaderHook (TypeArray types)
		{
			foreach (Type type in types.types) {
				if (type.IsEnum) {
					this [type.FullName] = new EnumStuff (type);
				}
			}
		}
Esempio n. 2
0
		public abstract void LoaderHook (TypeArray types);
Esempio n. 3
0
		public override void LoaderHook (TypeArray types)
		{
			foreach (Type type in types.types) {
				if (type.IsInterface) {
					this [type.FullName] = new InterfaceStuff (type);
				}
			}
		}
Esempio n. 4
0
		public bool LoadFrom (string assemblyName)
		{
			bool res = false;
			try {
				TypeArray types = TypeArray.empty;

				lock (cache) {
					if (cache.Contains (assemblyName)) {
						types = (cache [assemblyName] as TypeArray);
						if (types == null) types = TypeArray.empty;
					} else {
						Assembly asm = Assembly.LoadFrom (assemblyName);
						Type [] allTypes = asm.GetTypes ();
						if (allTypes == null) allTypes = Type.EmptyTypes;
						types = new TypeArray (allTypes);
						cache [assemblyName] = types;
					}
				}
				hook (types);
				res = true;
			} catch (ReflectionTypeLoadException rtle) {
				// FIXME: Should we try to recover? Use loaded portion of types.
				Type [] loaded = rtle.Types;
				for (int i = 0, xCnt = 0; i < loaded.Length; i++) {
					if (loaded [i] == null) {
						Verifier.log.Write ("fatal error",
						    String.Format ("Unable to load {0}, reason - {1}", loaded [i], rtle.LoaderExceptions [xCnt++]),
						    ImportanceLevel.LOW);
					}
				}
			} catch (FileNotFoundException fnfe) {
					Verifier.log.Write ("fatal error", fnfe.ToString (), ImportanceLevel.LOW);
			} catch (Exception x) {
					Verifier.log.Write ("fatal error", x.ToString (), ImportanceLevel.LOW);
			}

			return res;
		}