コード例 #1
0
        private static void AddSongMetadata(Song2014 rsSong, ZpeSong zigSong, string arrangment)
        {
            // standard meta header data
            rsSong.Version                = "7";
            rsSong.Arrangement            = arrangment;
            rsSong.Part                   = 1;
            rsSong.Offset                 = 0;
            rsSong.CentOffset             = "0";
            rsSong.StartBeat              = 0;
            rsSong.Capo                   = 0;
            rsSong.AlbumName              = "Unknown Album";
            rsSong.AlbumYear              = DateTime.Now.ToString("yyyy");
            rsSong.CrowdSpeed             = "1";
            rsSong.LastConversionDateTime = DateTime.Now.ToString();
            rsSong.SongLength             = zigSong.Length;

            Regex regex = new Regex(" - ");

            string[] artistTitle = regex.Split(zigSong.Name);
            rsSong.ArtistName = artistTitle[0] == null ? zigSong.Name : artistTitle[0];
            rsSong.Title      = artistTitle[1] == null ? zigSong.Name : artistTitle[1];

            ZpeTempo tempo = zigSong.Tracks[0].Tempos[0];
            float    BPM   = (float)Math.Round((float)60000000 / tempo.RawTempo, 3);

            rsSong.AverageTempo = BPM;

            ZpeTuning tuning = null;

            for (int i = 0; i < zigSong.Tunings.Tuning.Count; i++)
            {
                if (arrangment == "Lead" || arrangment == "Rhythm")
                {
                    if (zigSong.Tunings.Tuning[i].IsGuitarTuning)
                    {
                        tuning = zigSong.Tunings.Tuning[i];
                        break;
                    }
                }

                if (arrangment == "Bass")
                {
                    if (zigSong.Tunings.Tuning[i].IsBassTuning)
                    {
                        tuning = zigSong.Tunings.Tuning[i];
                        break;
                    }
                }
            }

            if (tuning == null)
            {
                throw new Exception("ZPE XML does not contain tuning");
            }

            rsSong.Tuning = new TuningStrings {
                String0 = tuning.E, String1 = tuning.A, String2 = tuning.D, String3 = tuning.G, String4 = tuning.B, String5 = tuning.HighE
            };
        }
コード例 #2
0
        private void AddSongMetadata(Song rsSong, ZpeSong zigSong)
        {
            rsSong.Arrangement            = "Combo";
            rsSong.Artist                 = "Unknown Artist";
            rsSong.Title                  = zigSong.Name;
            rsSong.Offset                 = 0;
            rsSong.Part                   = 1;
            rsSong.LastConversionDateTime = DateTime.Now.ToString();
            rsSong.SongLength             = zigSong.Length;

            ZpeTempo tempo = zigSong.Tracks[0].Tempos[0];
            float    BPM   = (float)Math.Round((float)60000000 / tempo.RawTempo, 3);

            rsSong.AverageTempo = BPM;

            ZpeTuning tuning = null;

            for (int i = 0; i < zigSong.Tunings.Tuning.Count - 1; i++)
            {
                if (zigSong.Tunings.Tuning[i].IsGuitarTuning)
                {
                    tuning = zigSong.Tunings.Tuning[i];
                    break;
                }
            }

            if (tuning == null)
            {
                throw new Exception("ZPE XML does not contain guitar tuning");
            }

            rsSong.Tuning = new TuningStrings
            {
                String0 = tuning.E,
                String1 = tuning.A,
                String2 = tuning.D,
                String3 = tuning.G,
                String4 = tuning.B,
                String5 = tuning.HighE
            };
        }