public void LoadAssemblyGames(string file)
{
const string CLASS = "gbrainy.Games.GameList";
const string LOGIC_METHOD = "LogicPuzzles";
const string CALCULATION_METHOD = "Calculation";
const string MEMORY_METHOD = "Memory";
Assembly asem;
Type type = null;
PropertyInfo prop;
object obj;
try
{
if (domain_load == false)
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler (ResolveAssemblyLoad);
domain_load = true;
}
asem = Assembly.Load (file);
foreach (Type t in asem.GetTypes())
{
if (t.FullName == CLASS)
{
type = t;
break;
}
}
obj = Activator.CreateInstance (type);
prop = type.GetProperty (LOGIC_METHOD);
if (prop != null)
cnt_logic += AddGamesAndVariations ((Type []) prop.GetValue (obj, null));
prop = type.GetProperty (MEMORY_METHOD);
if (prop != null)
cnt_memory += AddGamesAndVariations ((Type []) prop.GetValue (obj, null));
prop = type.GetProperty (CALCULATION_METHOD);
if (prop != null)
cnt_calculation += AddGamesAndVariations ((Type []) prop.GetValue (obj, null));
}
catch (Exception e)
{
Console.WriteLine ("GameManager.LoadAssemblyGames. Could not load file {0}. Error {1}", file, e);
}
}