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 long Build_Init(EngineState s, string name) { if (s.DisableLogger) { return(0); } // Build Id DB_BuildInfo dbBuild = new DB_BuildInfo() { StartTime = DateTime.UtcNow, Name = name, }; DB.Insert(dbBuild); buildDict[dbBuild.Id] = dbBuild; s.BuildId = dbBuild.Id; // Fire Event BuildInfoUpdated?.Invoke(this, new BuildInfoUpdateEventArgs(dbBuild)); // Variables - Fixed, Global, Local List <DB_Variable> varLogs = new List <DB_Variable>(); foreach (VarsType type in Enum.GetValues(typeof(VarsType))) { Dictionary <string, string> dict = s.Variables.GetVarDict(type); foreach (var kv in dict) { DB_Variable dbVar = new DB_Variable() { BuildId = dbBuild.Id, Type = type, Key = kv.Key, Value = kv.Value, }; varLogs.Add(dbVar); // Fire Event VariableUpdated?.Invoke(this, new VariableUpdateEventArgs(dbVar)); } } DB.InsertAll(varLogs); System_Write(new LogInfo(LogState.Info, $"Build [{name}] started")); return(dbBuild.Id); }
public VariableUpdateEventArgs(DB_Variable log) : base() { Log = log; }