public Player <Playable> GetPlayable(string filePath, Koioto.Support.FileReader.Courses courses) { if (Path.GetExtension(filePath) == ".tci") { return(TCIPlayable(filePath, courses)); } else if (Path.GetExtension(filePath) == ".tcm") { return(TCMPlayable(filePath, courses)); } return(null); }
private Player <Playable> TCMPlayable(string filePath, Koioto.Support.FileReader.Courses courses) { var medley = GetOpenTaikoChartMedley(filePath); var chartInfo = new ChartInfo(); chartInfo.Title = new string[medley.Charts.Length]; // コースの読み込み。 foreach (var item in medley.Charts) { var course = GetCoursesFromStirng(item.Difficulty); } return(null); }
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); }