Ejemplo n.º 1
0
 private static void TraceOut(string text, string category)
 {
     if (writeTrace)
     {
         if (category.Equals("Start"))
         {
             TcTrace.TraceDelimiter();
         }
         TcTrace.TraceOut(TraceLevel.Warning, text, category);
     }
 }
Ejemplo n.º 2
0
        private static TPlugin CreatePluginInstance <TPlugin>(Type pluginClass)
        {
            TcTrace.TraceDelimiter();
            var name  = pluginClass.Assembly.GetName().Name;
            var types = typeof(TPlugin).GetInterfaces().Select(_ => _.Name);

            TcTrace.TraceOut(TraceLevel.Warning, $"[{name}]{pluginClass.FullName}", $"{string.Join(",", types)} plugin load");

            var settings = GetSettings(pluginClass.Assembly);

            var ctor     = pluginClass.GetConstructor(new[] { typeof(Settings) });
            var tcPlugin = (TPlugin)ctor.Invoke(new object[] { settings });

            return(tcPlugin);
        }