private void SaveGame1() { App.Model.GameData GD = new App.Model.GameData(this.Game); this.Game.GetGameXml(); string fileName = "Tournaments.icd";// InfinityChess.Offline.Forms.GlobalSet.Default.CurrentGameFile; this.Game.SaveGame(fileName); }
private void SaveGame(string P1, string P2, int MatchID) { App.Model.GameData _GameData = new App.Model.GameData(this.Game); // Players and Result _GameData.White1 = P1; _GameData.White2 = P1; _GameData.Black1 = P2; _GameData.Black2 = P2; _GameData.Tournament = Title; _GameData.TournamentGuid = TournamentGuid; _GameData.IsECO = false; _GameData.EcoCode = "344"; _GameData.IsEloWhite = false; _GameData.EloWhite = 0; _GameData.IsEloBlack = false; _GameData.EloBlack = 0; _GameData.Result = ""; _GameData.ResultSymbol = ""; _GameData.IsYear = false; _GameData.Year = 0; _GameData.IsMonth = false; _GameData.Month = 0; _GameData.IsDay = false; _GameData.Day = 0; _GameData.TournamentMatchID = MatchID; string gameXml = UData.ToString(_GameData.Kv.DataTable); string fileName = "uba.icd";// InfinityChess.Offline.Forms.GlobalSet.Default.CurrentGameFile; if (gameXml != "") { Ap.LoadDatabase(fileName); Ap.Database.AppendGame(gameXml); Ap.Database.Save(); } }
public frmGameData(App.Model.GameData gameData, MainForm mainForm) { InitializeComponent(); this.MainForm = mainForm; this.gameData = gameData; }
private GameData GetGameData(Kv kvGame) { //Game game = new Game(); GameData gameData = new GameData(this.Game); gameData.Clear(); // load game data if (!string.IsNullOrEmpty(kvGame.Get("Event"))) { gameData.Tournament = kvGame.Get("Event"); } else { gameData.Tournament = string.Empty; } if (!string.IsNullOrEmpty(kvGame.Get("Date"))) { string[] date = kvGame.Get("Date").Split('.'); if (date[0] != "????") { gameData.Year = Convert.ToDecimal(date[0]); gameData.IsYear = true; } if (date[1] != "??") { gameData.Month = Convert.ToDecimal(date[1]); gameData.IsMonth = true; } if (date[2] != "??") { gameData.Day = Convert.ToDecimal(date[2]); gameData.IsDay = true; } } if (!string.IsNullOrEmpty(kvGame.Get("White"))) { string[] white = kvGame.Get("White").Split(','); if (white.Length > 1) { gameData.White1 = white[0]; gameData.White2 = white[1]; } else { gameData.White1 = white[0]; } } else { gameData.White1 = string.Empty; gameData.White2 = string.Empty; } if (!string.IsNullOrEmpty(kvGame.Get("Black"))) { string[] black = kvGame.Get("Black").Split(','); if (black.Length > 1) { gameData.Black1 = black[0]; gameData.Black2 = black[1]; } else { gameData.Black1 = black[0]; } } else { gameData.Black1 = string.Empty; gameData.Black2 = string.Empty; } if (!string.IsNullOrEmpty(kvGame.Get("BlackElo"))) { gameData.EloBlack = Convert.ToDecimal(kvGame.Get("BlackElo")); } if (!string.IsNullOrEmpty(kvGame.Get("WhiteElo"))) { gameData.EloWhite = Convert.ToDecimal(kvGame.Get("WhiteElo")); } if (!string.IsNullOrEmpty(kvGame.Get("Result"))) { gameData.Result = kvGame.Get("Result"); } else { gameData.Result = string.Empty; } return(gameData); }