Beispiel #1
0
        public async Task LoadAsync(string path)
        {
            using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var reader = new StreamReader(fs, Encoding.UTF8))
                {
                    var str = await reader.ReadToEndAsync().ConfigureAwait(false);

                    var cs = new CsvSplitter(str);

                    while (cs.ToNextLine())
                    {
                        if (cs.TokenCount < 3)
                        {
                            continue;
                        }

                        var recordName = cs.GetString(0);
                        if (recordName == "replace")
                        {
                            var info = new ReplaceInfo(cs.GetString(1), cs.GetString(2));

                            if (cs.TokenCount > 3)
                            {
                                info.SongTitleConstraint = cs.GetString(3);
                            }

                            if (cs.TokenCount > 4)
                            {
                                info.Exact = cs.GetBoolOrDeraulf(4, false);
                            }

                            this.ReplaceList.Add(info);
                        }
                        else if (recordName == "preset")
                        {
                            var info = new ZanmaiSongInfo
                            {
                                ShortDescription = cs.GetString(1),
                                Title            = cs.GetString(2),
                                Artists          = cs.GetString(3).Split(','),
                                Genre            = cs.GetString(4),
                                Series           = cs.GetString(5),
                                SongType         = cs.GetString(6)
                            };

                            this.SongPresetList.Add(info);
                        }
                    }
                }
        }
Beispiel #2
0
        public ZanmaiSongInfo Convert(ZanmaiSongInfo gInfo)
        {
            var replacedTitle = this.Replace(gInfo.Title);
            var result        = new ZanmaiSongInfo
            {
                Title    = replacedTitle,
                Artists  = this.Replace(string.Join(",", gInfo.Artists.Select(x => this.Replace(x, replacedTitle)).Where(x => !string.IsNullOrWhiteSpace(x))), replacedTitle).Split(','),
                Genre    = this.Replace(gInfo.Genre, replacedTitle),
                Series   = this.Replace(gInfo.Series, replacedTitle),
                SongType = this.Replace(gInfo.SongType, replacedTitle)
            };

            // ジャンルを置換
            if (gInfo.Genre != null)
            {
                switch (gInfo.Genre)
                {
                case "GM":
                    result.Genre = "GM";
                    break;

                case "RD":
                case "WR":
                    result.Genre = "RD";
                    break;

                case "DK":
                    result.Genre = "同人";
                    break;

                case "KK":
                    result.Genre = "企画";
                    break;

                case "SF":
                case "SS":
                case "SV":
                case "SM":
                case "WS":
                case "NG":
                    result.Genre = "特撮";
                    break;

                case "TV":
                case "TS":
                case "VD":
                case "MV":
                case "WA":
                    result.Genre = null;
                    break;

                default:                         // 一般曲扱い
                    result.Genre    = null;
                    result.SongType = null;
                    result.Series   = "一般曲";
                    break;
                }
            }

            // 曲種に基づいてジャンルを置換
            if (gInfo.SongType != null)
            {
                switch (gInfo.SongType)
                {
                case "KK":
                    result.Genre    = "企画";
                    result.SongType = null;
                    break;
                }
            }

            return(result);
        }