示例#1
0
        public static string BuildTrackItem(int pIndex, Nsfe pNsfeData, string pPath)
        {
            int    tempTime;
            int    timeMinutes = 0;
            int    timeSeconds = 0;
            string timeTotal   = String.Empty;
            int    fadeMinutes = 0;
            int    fadeSeconds = 0;
            string fadeTotal   = String.Empty;
            string title;
            string entry;

            title = NsfUtil.ParseTitle(pNsfeData, pIndex);

            if (pNsfeData.Times != null)
            {
                tempTime = pNsfeData.Times[pIndex];

                if (tempTime >= 0)
                {
                    timeMinutes = tempTime / 60000;
                    timeSeconds = ((tempTime - (timeMinutes * 60000)) % 60000) / 1000;
                    timeTotal   = timeMinutes + ":" + timeSeconds.ToString("d2");
                }
            }

            if (pNsfeData.Fades != null)
            {
                tempTime = pNsfeData.Fades[pIndex];

                if (tempTime >= 0)
                {
                    fadeMinutes = tempTime / 60000;
                    fadeSeconds = ((tempTime - (fadeMinutes * 60000)) % 60000) / 1000;
                    fadeTotal   = fadeMinutes + ":" + fadeSeconds.ToString("d2");
                }
            }

            entry = NezPlugUtil.BuildPlaylistEntry(NezPlugUtil.FORMAT_NSF,
                                                   Path.GetFileNameWithoutExtension(pPath) + ".nsf",
                                                   (pIndex + 1).ToString(),
                                                   title.Trim(),
                                                   timeTotal,
                                                   String.Empty,
                                                   fadeTotal,
                                                   String.Empty);
            return(entry);
        }
示例#2
0
        public static string BuildPlaylistTrackItem(int index, INezPlugPlaylistFormat vgmData, string pPath)
        {
            System.Text.Encoding enc = System.Text.Encoding.ASCII;
            string title             = enc.GetString(FileUtil.ReplaceNullByteWithSpace(vgmData.SongArtist)).Trim() + " - " +
                                       enc.GetString(FileUtil.ReplaceNullByteWithSpace(vgmData.SongName)).Trim() + " - " +
                                       "Track " + index.ToString().PadLeft(2, '0');;

            string entry = NezPlugUtil.BuildPlaylistEntry(vgmData.GetNezPlugPlaylistFormat(),
                                                          Path.GetFileName(pPath),
                                                          (index).ToString(),
                                                          title,
                                                          String.Empty,
                                                          String.Empty,
                                                          String.Empty,
                                                          String.Empty);

            return(entry);
        }
示例#3
0
        public static string BuildKnurekFormatPlaylistTrackItem(int index, INezPlugPlaylistFormat vgmData, string pPath)
        {
            System.Text.Encoding enc = System.Text.Encoding.ASCII;

            short dummy;
            int   dateIndex = -1;

            string fileName = Path.GetFileNameWithoutExtension(vgmData.FilePath);

            string[] splitFileName = fileName.Split(new char[] { '(' }, StringSplitOptions.RemoveEmptyEntries);

            // track title
            string trackTitle = "Track " + (index + 1).ToString().PadLeft(2, '0');

            // composer
            string composer = enc.GetString(FileUtil.ReplaceNullByteWithSpace(vgmData.SongArtist)).Trim();

            composer = composer.Replace("<?>", "Unknown");

            // game name
            string gameName = splitFileName[0].Trim();

            // year
            string year = String.Empty;

            // check for system identifiers (GBC), (FDS), etc...
            if ((splitFileName.Length > 1) && Int16.TryParse(splitFileName[1].Substring(0, 2), out dummy))
            {
                dateIndex = 1;
            }
            else if ((splitFileName.Length > 2) && Int16.TryParse(splitFileName[2].Substring(0, 2), out dummy))
            {
                dateIndex = 2;
            }

            year = splitFileName[dateIndex].Replace(")", String.Empty).Substring(0, 4);

            // developer
            string developer;

            developer = splitFileName[(dateIndex + 1)].Replace(")", String.Empty).Trim();

            // publisher
            string publisher = String.Empty;

            if (splitFileName.GetUpperBound(0) > (dateIndex + 1))
            {
                publisher = splitFileName[splitFileName.GetUpperBound(0)].Replace(")", String.Empty).Trim();
            }

            string title = trackTitle + " - " + composer + " - " + gameName + " - (c)" + year + " " + developer;

            title = String.IsNullOrEmpty(publisher) ? title : (title + ", " + publisher);
            title = title.Trim();

            string entry = NezPlugUtil.BuildPlaylistEntry(vgmData.GetNezPlugPlaylistFormat(),
                                                          Path.GetFileName(pPath),
                                                          (index).ToString(),
                                                          title,
                                                          String.Empty,
                                                          String.Empty,
                                                          String.Empty,
                                                          String.Empty);

            return(entry);
        }