/// <summary> /// Creates a new update item and creates a NEW COPY of the passed cache /// Can we quite slow ~ 1ms. /// </summary> /// <param name="cache"></param> public UpdateItem(databaseCache cache) { currentHandId = cache.getCurrentHandId(); playerIds = cache.getSatInPlayerIds(); tableId = cache.TableId; cache = databaseCache.DeSerialise(cache.Serialise()); }
public static void LogAIError(Exception ex, databaseCache cache) { //Save the cache for later checking and try again WebLogging.AddLog("GPA", WebLogging.LogCategory.AIError, "AI error logged - " + ex.ToString()); string errorFileName = "pokerAIError " + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString() + "." + DateTime.Now.Millisecond.ToString() + " " + DateTime.Now.ToString("dd-MM-yyyy"); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(errorFileName + ".log", false)) { sw.WriteLine("Hand Id: " + cache.getCurrentHandId().ToString() + " Player Id: " + cache.getPlayerId(cache.getCurrentActiveTablePosition()).ToString()); if (ex.GetBaseException() != null) { sw.WriteLine("Base Exception Type: " + ex.GetBaseException().ToString()); } if (ex.InnerException != null) { sw.WriteLine("Inner Exception Type: " + ex.InnerException.ToString()); } if (ex.StackTrace != null) { sw.WriteLine(""); sw.WriteLine("Stack Trace: " + ex.StackTrace.ToString()); } File.WriteAllBytes(errorFileName + ".FBPcache", cache.Serialise()); sw.Close(); } }