public long Build_Plugin_Init(EngineState s, Plugin p, int order) { if (s.DisableLogger) { return(0); } long buildId = s.BuildId; DB_Plugin dbPlugin = new DB_Plugin() { BuildId = buildId, Level = p.Level, Order = order, Name = p.Title, Path = p.ShortPath, Version = p.Version, }; DB.Insert(dbPlugin); pluginDict[dbPlugin.Id] = new Tuple <DB_Plugin, Stopwatch>(dbPlugin, Stopwatch.StartNew()); // Fire Event if (!s.DelayedLogging) { PluginUpdated?.Invoke(this, new PluginUpdateEventArgs(dbPlugin)); } return(dbPlugin.Id); }
public void Build_Plugin_Finish(EngineState s, Dictionary <string, string> localVars) { if (s.DisableLogger) { return; } if (s.DelayedLogging) { DB.InsertAll(BuildLogPool); BuildLogPool.Clear(); } if (s.DisableLogger == false) { long buildId = s.BuildId; long pluginId = s.PluginId; // Plugins pluginDict.TryRemove(pluginId, out Tuple <DB_Plugin, Stopwatch> tuple); if (tuple == null) { throw new KeyNotFoundException($"Unable to find DB_Plugin Instance, id = {pluginId}"); } DB_Plugin dbPlugin = tuple.Item1; Stopwatch watch = tuple.Item2; watch.Stop(); dbPlugin.ElapsedMilliSec = watch.ElapsedMilliseconds; if (localVars != null) { List <DB_Variable> varLogs = new List <DB_Variable>(localVars.Count); foreach (var kv in localVars) { DB_Variable dbVar = new DB_Variable() { BuildId = buildId, PluginId = pluginId, Type = VarsType.Local, Key = kv.Key, Value = kv.Value, }; varLogs.Add(dbVar); // Fire Event VariableUpdated?.Invoke(this, new VariableUpdateEventArgs(dbVar)); } DB.InsertAll(varLogs); } DB.Update(dbPlugin); // Fire Event if (s.DelayedLogging) { PluginUpdated?.Invoke(this, new PluginUpdateEventArgs(dbPlugin)); } } }
public PluginUpdateEventArgs(DB_Plugin log) : base() { Log = log; }