示例#1
0
 /// <summary>
 /// Adda game to history, and optionally save to file
 /// </summary>
 /// <param name="gr">Game record to add</param>
 /// <param name="saveGame">If true, game should be saved</param>
 /// <param name="gameLog">Game event log to save</param>
 public static void AddGameRecord(GameRecord gr, bool saveGame = false, List <string> gameLog = null)
 {
     if (saveGame)
     {
         // Save game record to file
         gr.Timestamp = DateTime.Now;
         gr.Log       = Log.CurrentLogRtf;
         string fileName = string.Format(@"{0}_{1}_{2}_{3}_{4}_{5}",
                                         gr.Timestamp.Year,
                                         gr.Timestamp.Month,
                                         gr.Timestamp.Day,
                                         gr.Timestamp.Hour,
                                         gr.Timestamp.Minute,
                                         gr.Timestamp.Second);
         gr.SaveToFile(Constants.GetLocalGamesPath() + "\\" + fileName + ".txt");
         if (gameLog != null && gameLog.Count > 0)
         {
             File.WriteAllBytes(Constants.GetLocalGamesPath() + "\\" + fileName + ".playback", Utilities.ZipFromStringList(gameLog));
         }
     }
     try {
         gr.OpponentName = AIDeckNames[gr.OpponentName];
         gr.OpponentIsAI = true;
     } catch { }
     Games.Insert(0, gr);
 }
示例#2
0
 /// <summary>
 /// Save game record to file
 /// </summary>
 /// <param name="path">file path</param>
 public void SaveToFile(string path)
 {
     GameRecord.SaveToFile(path, MyDeckName, MyDeckCode, MyDeck, OpponentName, OpponentDeck, Result, Notes, Timestamp, Log, ExpeditionSignature, ExpeditionDraftPicks);
 }