Exemple #1
0
 // ShaiDeath's Initialization
 private static void Unit()
 {
     try
     {
         AssemblyListEnumerator ale = Utility.externAsm.GetEnumerator();
         while (ale.MoveNext())
         {
             if (ale.Key == "Creatures" || ale.Key == "Items")
             {
                 continue;
             }
             Type[] types = ale.Value.GetTypes();
             for (int i = 0; i < types.Length; i++)
             {
                 if (types[i].GetInterface("IInitialize", true) != null)
                 {
                     System.Reflection.MethodInfo info = ((Type)types[i]).GetMethod("Initialize", BindingFlags.Static | BindingFlags.Public);
                     if (info != null)
                     {
                         info.Invoke(null, null);
                         //	Console.WriteLine("Found object {0}", info.Name);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in Globals.Unit() !");
         Console.WriteLine(e.Message);
         Console.WriteLine(e.Source);
         Console.WriteLine(e.StackTrace);
     }
 }
        public static void GenerateList()
        {
            //Assembly ass = Utility.externAsm;
            AssemblyListEnumerator ale = Utility.externAsm.GetEnumerator();

            while (ale.MoveNext())
            {
                if (ale.Key != "creatures" && ale.Key != "Items")
                {
                    continue;
                }
                Type[] types = ale.Value.GetTypes();
                for (int i = 0; i < types.Length; i++)
                {
                    if (types[i].GetInterface("ISerialize", true) != null)
                    {
                        ConstructorInfo info = Utility.FindConstructor(types[i].FullName);
                        SerializeList.Add(info.Invoke(null));
                    }
                }
            }
        }