static public OldCatanGame Deserialize(string savedGame) { OldCatanGame game = new OldCatanGame(); game.Serializing = true; Dictionary <string, string> sections = null; try { sections = StaticHelpers.GetSections(savedGame); if (sections == null) { game.Error = String.Format($"Error parsing the file into sections.\nThere are no sections. Please load a valid .catangame file."); return(game); } } catch (Exception e) { game.Error = e.Message; return(game); } StaticHelpers.DeserializeObject <OldCatanGame>(game, sections["View"], false); for (int groupCount = 0; groupCount < game.GroupCount; groupCount++) { TileGroup tg = new TileGroup(); string tgAsString = sections[$"TileGroup {groupCount}"]; tg.Deserialize(tgAsString, sections, groupCount); game.TileGroups.Add(tg); } game.Serializing = false; return(game); }
public bool Deserialize(string s) { Dictionary <string, string> sections = StaticHelpers.GetSections(s); StaticHelpers.DeserializeObject <Settings>(this, sections["Settings"], "=", StaticHelpers.lineSeperator); string[] positions = sections["GridPositions"].Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); GridPositions.Clear(); foreach (string line in positions) { GridPosition gp = new GridPosition(line); GridPositions.Add(gp); } return(true); }
// // this only deserializes the [View] section of the file, and in particular doesn't create any XAML objects.. public bool FastDeserialize(string savedGame) { this.Serializing = true; try { this.Sections = StaticHelpers.GetSections(savedGame); if (this.Sections == null) { this.Error = String.Format($"Error parsing the file into sections.\nThere are no sections. Please load a valid .catangame file."); return(false); } } catch (Exception e) { this.Error = e.Message; return(false); } StaticHelpers.DeserializeObject <OldCatanGame>(this, this.Sections["View"], false); this.Serializing = false; return(true); }
public bool DeserializeGame(string s) { StaticHelpers.DeserializeObject <CatanPlayer>(this, s, false); return(true); }
public bool Deserialize(string s, bool oneLine) { StaticHelpers.DeserializeObject <CatanPlayer>(this, s, oneLine); return(true); }
public void Deserialize(string s) { StaticHelpers.DeserializeObject <LogBuildingUpdate>(this, s, ":", ","); }
public void Deserialize(string s) { StaticHelpers.DeserializeObject <LogBaronOrPirate>(this, s, ":", ","); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogRoadTrackingChanged>(this, saved, ":", "-"); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogPropertyChanged>(this, saved, ":", ","); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogResourceCount>(this, saved, ":", ","); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogCardsLost>(this, saved, ":", ","); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogStateTranstion>(this, saved, ":", ","); }
public void Deserialize(string saved) { StaticHelpers.DeserializeObject <LogChangePlayer>(this, saved, ":", ","); }
public LogEntry(string s, ILogParserHelper parseHelper) { StaticHelpers.DeserializeObject <LogEntry>(this, s, "=", "|"); ParsePlayer(PlayerDataString, parseHelper); ParseTag(TagAsString, parseHelper); }
public bool Deserialize(string s, bool oneLine) { StaticHelpers.DeserializeObject <TileData>(this, s, "=", "|"); return(true); }
public bool Deserialize(string s, bool oneLine) { StaticHelpers.DeserializeObject <PlayerGameModel>(this, s, ":", "|"); return(true); }