Esempio n. 1
0
        private Player <Playable> TCIPlayable(string filePath, Koioto.Support.FileReader.Courses course)
        {
            var info = GetOpenTaikoChartInfomation(filePath);

            var result = new Player <Playable>();

            // とりあえず、難易度を入れる
            var neededCourse = info.Courses.Where(d => GetCoursesFromStirng(d.Difficulty) == course);

            if (!neededCourse.Any())
            {
                // コースが無ければnullを返す。
                return(null);
            }

            // コースが存在すれば処理を続行。
            var diff = neededCourse.First();

            var singleFile = File.ReadAllText(Path.Combine(Path.GetDirectoryName(filePath), diff.Single), Encoding.UTF8);

            var multipleFile = new string[0];

            if (diff.Multiple != null)
            {
                multipleFile = new string[diff.Multiple.Length];
                for (var i = 0; i < multipleFile.Length; i++)
                {
                    multipleFile[i] = File.ReadAllText(Path.Combine(Path.GetDirectoryName(filePath), diff.Multiple[i]), Encoding.UTF8);
                }
            }

            var single   = JsonConvert.DeserializeObject <OpenTaikoChartCourse>(singleFile);
            var multiple = new OpenTaikoChartCourse[multipleFile.Length];

            for (var i = 0; i < multiple.Length; i++)
            {
                multiple[i] = JsonConvert.DeserializeObject <OpenTaikoChartCourse>(multipleFile[i]);
            }

            result.Single   = CourseParser.Parse(info, single);
            result.Multiple = multiple.Select(m => CourseParser.Parse(info, m)).ToArray();

            return(result);
        }