コード例 #1
0
        /// <summary>
        /// Load All Settings from file
        /// </summary>
        /// <returns>return settings</returns>
        /// <exception cref="ArgumentNullException">throw null exception if data not found</exception>
        public static GameSettings LoadSettings()
        {
            string file = PathConstants.GetPath(PathConstants.DATA_PATH + PathConstants.SETTING_FILE);

            if (FileHelper <GameSettings> .FileExist(file))
            {
                string       json         = File.ReadAllText(file);
                GameSettings gameSettings = FileHelper <GameSettings> .JsonStringParserToObject(json, new GameSettings());

                return(gameSettings);
            }

            GameSettings gameSetting = LoadDefaultGameSettings();

            File.WriteAllText(@"" + PathConstants.DATA_PATH + PathConstants.SETTING_FILE,
                              FileHelper <GameSettings> .ObjectParserToJsonString(gameSetting));

            return(gameSetting);
        }
コード例 #2
0
ファイル: EventService.cs プロジェクト: frapslover63/OTP
        /// <summary>
        /// Search If Checkpoint Exist;
        /// </summary>
        /// <returns>return true if CheckPoint Exist, return false
        /// if CheckPoint not Exist</returns>
        public static bool CheckPointExist()
        {
            string file = PathConstants.GetPath(CHECKPOINT_FILES);

            return(FileHelper <CheckPoint> .FileExist(file));
        }