try
{
+ Console.WriteLine("Start preload : " + fileName);
BindingFlags bindingFlag = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
foreach (string line in File.ReadLines(path))
{
typenameStr = typenameStr.Replace("." + methodStr + parenthesis, "");
}
- try
+ if (assemblyStr == "" || typenameStr == "" || typenameStr.Contains(parenthesis))
{
- if (assemblyStr == "")
- continue;
+ Console.WriteLine("[Warning] Skip the '" + line + "' in " + fileName);
+ continue;
+ }
+ try
+ {
Assembly asm = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(assemblyStr));
- if (asm == null || typenameStr == "")
- continue;
-
Type type = asm.GetType(typenameStr);
- if (type == null || methodStr == "")
- continue;
-
- MethodInfo method = type.GetMethod(methodStr, bindingFlag);
- if (method == null)
- continue;
+ if (type == null)
+ Console.WriteLine("[Warning] Check the '" + line + "' in " + fileName);
- method.Invoke(null, null);
+ if (methodStr != "")
+ {
+ MethodInfo method = type.GetMethod(methodStr, bindingFlag);
+ method.Invoke(null, null);
+ }
}
- catch (Exception e)
+ catch
{
- Console.WriteLine(e.ToString());
- Console.WriteLine("[ERROR] Failed to '" + line + "' preload");
+ Console.WriteLine("[Error] Fail the '" + line + "' in " + fileName);
}
}
}
catch (IOException e)
{
Console.WriteLine(e.ToString());
- Console.WriteLine("[ERROR] Failed to " + path + " file open");
- }
- finally
- {
- Console.WriteLine("Success to preload : " + fileName);
+ Console.WriteLine("[Error] Failed to open file : " + fileName);
}
}