Пример #1
0
        private static DataManager _CreateDataManager()
        {
            if (File.Exists(backupFile))
            {
                Console.WriteLine("Trying restore from backup...");
                try
                {
                    return(JsonConvert.DeserializeObject <DataManager>(File.ReadAllText(backupFile)));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Restoring from backup failed. Trying to start normaly...");
                }
            }

            Console.WriteLine("Normal cold start.");

            string hintsJson = "hints.json";
            string teamsJson = "teams.json";

            Hints         hints      = JsonConvert.DeserializeObject <Hints>(File.ReadAllText(hintsJson));
            QuestTeamsMap questTeams = JsonConvert.DeserializeObject <QuestTeamsMap>(File.ReadAllText(teamsJson));

            Console.WriteLine(JsonConvert.SerializeObject(questTeams));
            return(new DataManager(questTeams, hints));
        }
Пример #2
0
 public DataManager(QuestTeamsMap map, Hints hints)
 {
     _data              = map;
     _hints             = hints;
     _chatToTeamMapping = new Dictionary <ChatID, TeamID>();
 }