예제 #1
0
파일: game.cs 프로젝트: joelong01/Catan
        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);
        }
예제 #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);
        }
예제 #3
0
파일: game.cs 프로젝트: joelong01/Catan
        //
        //  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);
        }
예제 #4
0
 public bool DeserializeGame(string s)
 {
     StaticHelpers.DeserializeObject <CatanPlayer>(this, s, false);
     return(true);
 }
예제 #5
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <CatanPlayer>(this, s, oneLine);
     return(true);
 }
예제 #6
0
 public void Deserialize(string s)
 {
     StaticHelpers.DeserializeObject <LogBuildingUpdate>(this, s, ":", ",");
 }
예제 #7
0
 public void Deserialize(string s)
 {
     StaticHelpers.DeserializeObject <LogBaronOrPirate>(this, s, ":", ",");
 }
예제 #8
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogRoadTrackingChanged>(this, saved, ":", "-");
 }
예제 #9
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogPropertyChanged>(this, saved, ":", ",");
 }
예제 #10
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogResourceCount>(this, saved, ":", ",");
 }
예제 #11
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogCardsLost>(this, saved, ":", ",");
 }
예제 #12
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogStateTranstion>(this, saved, ":", ",");
 }
예제 #13
0
 public void Deserialize(string saved)
 {
     StaticHelpers.DeserializeObject <LogChangePlayer>(this, saved, ":", ",");
 }
예제 #14
0
 public LogEntry(string s, ILogParserHelper parseHelper)
 {
     StaticHelpers.DeserializeObject <LogEntry>(this, s, "=", "|");
     ParsePlayer(PlayerDataString, parseHelper);
     ParseTag(TagAsString, parseHelper);
 }
예제 #15
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <TileData>(this, s, "=", "|");
     return(true);
 }
예제 #16
0
 public bool Deserialize(string s, bool oneLine)
 {
     StaticHelpers.DeserializeObject <PlayerGameModel>(this, s, ":", "|");
     return(true);
 }