Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        //
        //  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);
        }
Ejemplo n.º 4
0
 public bool DeserializeGame(string s)
 {
     StaticHelpers.DeserializeObject <CatanPlayer>(this, s, false);
     return(true);
 }
Ejemplo n.º 5
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <CatanPlayer>(this, s, oneLine);
     return(true);
 }
Ejemplo n.º 6
0
 public void Deserialize(string s)
 {
     StaticHelpers.DeserializeObject <LogBuildingUpdate>(this, s, ":", ",");
 }
Ejemplo n.º 7
0
 public void Deserialize(string s)
 {
     StaticHelpers.DeserializeObject <LogBaronOrPirate>(this, s, ":", ",");
 }
Ejemplo n.º 8
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogRoadTrackingChanged>(this, saved, ":", "-");
 }
Ejemplo n.º 9
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogPropertyChanged>(this, saved, ":", ",");
 }
Ejemplo n.º 10
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogResourceCount>(this, saved, ":", ",");
 }
Ejemplo n.º 11
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogCardsLost>(this, saved, ":", ",");
 }
Ejemplo n.º 12
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogStateTranstion>(this, saved, ":", ",");
 }
Ejemplo n.º 13
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogChangePlayer>(this, saved, ":", ",");
 }
Ejemplo n.º 14
0
 public LogEntry(string s, ILogParserHelper parseHelper)
 {
     StaticHelpers.DeserializeObject <LogEntry>(this, s, "=", "|");
     ParsePlayer(PlayerDataString, parseHelper);
     ParseTag(TagAsString, parseHelper);
 }
Ejemplo n.º 15
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <TileData>(this, s, "=", "|");
     return(true);
 }
Ejemplo n.º 16
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <PlayerGameModel>(this, s, ":", "|");
     return(true);
 }