当前位置: 首页>>代码示例>>C#>>正文


C# Xml.Song2014类代码示例

本文整理汇总了C#中RocksmithToolkitLib.Xml.Song2014的典型用法代码示例。如果您正苦于以下问题:C# Song2014类的具体用法?C# Song2014怎么用?C# Song2014使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Song2014类属于RocksmithToolkitLib.Xml命名空间,在下文中一共展示了Song2014类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadSong

        public void ReadSong(Song2014 songXml, Sng2014File sngFile)
        {
            Int16[] tuning = {
                songXml.Tuning.String0,
                songXml.Tuning.String1,
                songXml.Tuning.String2,
                songXml.Tuning.String3,
                songXml.Tuning.String4,
                songXml.Tuning.String5,
            };
            parseEbeats(songXml, sngFile);
            parsePhrases(songXml, sngFile);
            parseChords(songXml, sngFile, tuning, songXml.Arrangement == "Bass");
            // vocals use different parse function
            sngFile.Vocals = new VocalSection { Vocals = new Vocal[0] };
            parsePhraseIterations(songXml, sngFile);
            parsePhraseExtraInfo(songXml, sngFile);
            parseNLD(songXml, sngFile);
            parseActions(songXml, sngFile);
            parseEvents(songXml, sngFile);
            parseTones(songXml, sngFile);
            parseDNAs(songXml, sngFile);
            parseSections(songXml, sngFile);
            parseArrangements(songXml, sngFile);
            parseMetadata(songXml, sngFile, tuning);

            // this needs to be initialized after arrangements
            parseChordNotes(songXml, sngFile);
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:29,代码来源:Sng2014FileWriter.cs

示例2: GetScoreForMaxDifficultyLevel

        /// <param name="song"></param>
        /// <param name="difficultyLevel">null = highest level available</param>
        public static Score GetScoreForMaxDifficultyLevel(Song2014 song, int? difficultyLevel)
        {
            List<PhraseIterationWithEndTime> iterationsWithEndTime = PhraseIterationWithEndTime.listFromBaseArray(song.PhraseIterations);

            IEnumerable<SongNoteChordWrapper> allSounds = Enumerable.Empty<SongNoteChordWrapper>();

            for (int phraseId = 0; phraseId < song.Phrases.Length;phraseId++)
            {
                var phrase = song.Phrases[phraseId];
                var diffLevel = phrase.MaxDifficulty;
                if (difficultyLevel.HasValue && difficultyLevel < diffLevel)
                    diffLevel = difficultyLevel.Value;

                var selectedLevel = song.Levels.FirstOrDefault(x => x.Difficulty == diffLevel);

                var phraseIterations = iterationsWithEndTime.Where(x => x.PhraseId == phraseId).ToArray();
                for (int i = 0; i < phraseIterations.Length; i++)
                {
                    var iterationWithEndTime = phraseIterations[i];
                    var notes = selectedLevel.Notes.Where(x => iterationWithEndTime.contains(x.Time));
                    var chords = selectedLevel.Chords.Where(x => iterationWithEndTime.contains(x.Time));

                    allSounds = allSounds.Union(notes.Select(x => new SongNoteChordWrapper(x)))
                                .Union(chords.Select(x => new SongNoteChordWrapper(x)));
                }
            }
            var score = CreateSong(song, allSounds);
            return score;
        }
开发者ID:InevitableHimes,项目名称:RSTabExplorer,代码行数:31,代码来源:RockSmithImporter.cs

示例3: Song2014ToSong

        public Song Song2014ToSong(Song2014 rs2014Song)
        {
            var rs1Song = new Song();
            AddSongMetadata(rs2014Song, rs1Song);
            AddElements(rs2014Song, rs1Song);
            AddDifferences(rs2014Song, rs1Song);

            return rs1Song;
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:9,代码来源:Rs2014Converter.cs

示例4: AttributesHeader2014

        public AttributesHeader2014(string arrangementFileName, Arrangement arrangement, DLCPackageData info, Platform platform)
        {
            IsVocal = arrangement.ArrangementType == Sng.ArrangementType.Vocal;
            SongContent = (IsVocal) ? null : Song2014.LoadFromFile(arrangement.SongXml.File);
            var dlcName = info.Name.ToLower();

            var albumUrn = String.Format(URN_TEMPLATE, TagValue.Image.GetDescription(), TagValue.DDS.GetDescription(), String.Format("album_{0}", dlcName));
            var jsonUrn = String.Format(URN_TEMPLATE, TagValue.Database.GetDescription(), TagValue.JsonDB.GetDescription(), String.Format("{0}_{1}", dlcName, arrangementFileName));

            //FILL ATTRIBUTES
            this.AlbumArt = albumUrn;
            ArrangementName = arrangement.Name.ToString();
            DLC = true;
            DLCKey = info.Name;
            LeaderboardChallengeRating = 0;
            ManifestUrn = jsonUrn;
            MasterID_RDV = arrangement.MasterId;
            PersistentID = arrangement.Id.ToString().Replace("-", "").ToUpper();
            Shipping = true;
            SKU = "RS2";
            SongKey = info.Name;

            if (!IsVocal)
            {
                AlbumName = AlbumNameSort = info.SongInfo.Album;
                ArtistName = info.SongInfo.Artist;
                CentOffset = arrangement.TuningPitch != 0 ? TuningFrequency.Frequency2Cents(arrangement.TuningPitch) : 0.0;
                ArtistNameSort = info.SongInfo.ArtistSort;
                CapoFret = (arrangement.Sng2014.Metadata.CapoFretId == 0xFF) ? CapoFret = 0 : Convert.ToDecimal(arrangement.Sng2014.Metadata.CapoFretId);
                DNA_Chords = arrangement.Sng2014.DNACount[(int) DNAId.Chord];
                DNA_Riffs = arrangement.Sng2014.DNACount[(int) DNAId.Riff];
                DNA_Solo = arrangement.Sng2014.DNACount[(int) DNAId.Solo];
                NotesEasy = arrangement.Sng2014.NoteCount[0];
                NotesMedium = arrangement.Sng2014.NoteCount[1];
                NotesHard = arrangement.Sng2014.NoteCount[2];
                EasyMastery = NotesEasy / NotesHard;
                MediumMastery = NotesMedium / NotesHard;
                Representative = Convert.ToInt32(!arrangement.BonusArr);
                RouteMask = (int)arrangement.RouteMask;

                // TODO this is not quite it but much closer
                SongDiffEasy = SongContent.SongLength / NotesEasy;
                SongDiffMed = SongContent.SongLength / NotesMedium;
                SongDiffHard = SongContent.SongLength / NotesHard;
                SongDifficulty = SongDiffHard;

                SongLength = (double?)Math.Round(SongContent.SongLength, 3, MidpointRounding.AwayFromZero);
                SongName = info.SongInfo.SongDisplayName;
                SongNameSort = info.SongInfo.SongDisplayNameSort;
                SongYear = info.SongInfo.SongYear;

                var tunDef = TuningDefinitionRepository.Instance().Select(arrangement.Tuning, platform.version);
                Tuning = tunDef.Tuning;
            }
        }
开发者ID:Jamedjo,项目名称:rocksmith-custom-song-toolkit,代码行数:55,代码来源:AttributesHeader2014.cs

示例5: Convert

        public void Convert(string zigSrcPath, string destPath)
        {
            var deser = new XmlSerializer(typeof(ZpeSong));
            ZpeSong zigSong;
            using (FileStream stream = new FileStream(zigSrcPath, FileMode.Open))
            {
                zigSong = (ZpeSong)deser.Deserialize(stream);
            }

            if (zigSong.PueVersion != 46)
                throw new Exception("Incompatable version of Ziggy Pro Editor XML file");

            bool foundTrack = false;
            StringBuilder sb = new StringBuilder();
            // cross matching arrangment arrays
            string[] rsArray = new string[] { "Lead", "Rhythm", "Bass" };
            string[] zigArray = new string[] { "PART REAL_GUITAR_22", "PART REAL_GUITAR", "PART REAL_BASS_22" };
            int arrIndex = -1;

            foreach (var arrangement in zigArray)
            {
                arrIndex++;
                var guitarTrack = zigSong.Tracks.SingleOrDefault(tr => arrangement.Equals(tr.Name));

                if (guitarTrack == null)
                {
                    continue;
                    //throw new Exception("Couldn't find a guitar track");
                }

                foundTrack = true;
                var rsSong = new Song2014();
                AddSongMetadata(rsSong, zigSong, rsArray[arrIndex]);
                AddEbeats(rsSong, zigSong, arrangement);
                AddNotes(rsSong, zigSong, arrangement);
                AddToneProps(rsSong, rsArray[arrIndex]);

                var destDir = Path.GetDirectoryName(destPath);
                var destName = Path.GetFileNameWithoutExtension(destPath);
                var xmlDestPath = String.Format("{0}_{1}.xml", Path.Combine(destDir, destName), rsArray[arrIndex]);

                using (FileStream stream = new FileStream(xmlDestPath, FileMode.Create))
                {
                    rsSong.Serialize(stream, true);
                }
            }

            if (!foundTrack)
                throw new NullReferenceException("Did not find any Rocksmith 2014 compatible Ziggy Pro tracks in " + Path.GetFileName(zigSrcPath) + Environment.NewLine);
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:50,代码来源:Converter2014.cs

示例6: AddSongMetadata

        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 };
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:48,代码来源:Converter2014.cs

示例7: GetScoreForExactDifficultyLevel

        /// <param name="song"></param>
        /// <param name="difficultyLevel">null = highest level available</param>
        public static Score GetScoreForExactDifficultyLevel(Song2014 song, int? difficultyLevel)
        {
            SongLevel2014 selectedLevel;

            if(difficultyLevel.HasValue)
                selectedLevel = song.Levels.FirstOrDefault(x => x.Difficulty == difficultyLevel);
            else
                selectedLevel = song.Levels.OrderBy(x => x.Difficulty).LastOrDefault();

            if (selectedLevel == null)
                return null;

            var allSounds = selectedLevel.Notes.Select(x => new SongNoteChordWrapper(x))
                            .Union(selectedLevel.Chords.Select(x => new SongNoteChordWrapper(x)));

            var score = CreateSong(song, allSounds);
            return score;
        }
开发者ID:InevitableHimes,项目名称:RSTabExplorer,代码行数:20,代码来源:RockSmithImporter.cs

示例8: Song2014ToXml

        /// <summary>
        /// Convert RS2014 (Song2014) to XML file
        /// </summary>
        /// <param name="rs2014Song"></param>
        /// <param name="outputPath"></param>
        /// <param name="overWrite"></param>
        /// <returns>RS2014 XML file path</returns>
        public string Song2014ToXml(Song2014 rs2014Song, string outputPath, bool overWrite)
        {
            if (File.Exists(outputPath) && overWrite)
                File.Delete(outputPath);
            else
            {
                var outputDir = Path.GetDirectoryName(outputPath);
                var outputFile = String.Format("{0}_{1}", rs2014Song.Title, rs2014Song.Arrangement);
                outputFile = String.Format("{0}{1}", outputFile.GetValidName(false, true).ToLower(), "_rs2014.xml");
                outputPath = Path.Combine(outputDir, outputFile);
            }

            using (var stream = File.OpenWrite(outputPath))
            {
                rs2014Song.Serialize(stream, false);
            }

            return outputPath;
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:26,代码来源:Rs2014Converter.cs

示例9: AddSongMetadata

        private void AddSongMetadata(Song2014 rs2014Song, Song rs1Song)
        {
            // for consistency apply old naming method ;(
            rs1Song.Title = String.Format("{0} - {1}", rs2014Song.Title, rs2014Song.Arrangement);
            if (rs2014Song.Part > 1)
                rs1Song.Title = String.Format("{0} {1}", rs1Song.Title, rs2014Song.Part);

            rs1Song.Arrangement = rs2014Song.Arrangement;
            rs1Song.Part = rs2014Song.Part;
            rs1Song.Offset = rs2014Song.Offset;
            rs1Song.SongLength = rs2014Song.SongLength;
            rs1Song.StartBeat = rs2014Song.StartBeat;
            rs1Song.AverageTempo = rs2014Song.AverageTempo;
            rs1Song.Tuning = rs2014Song.Tuning;
            rs1Song.Artist = rs2014Song.ArtistName;
            rs1Song.AlbumName = rs2014Song.AlbumName;
            rs1Song.AlbumYear = rs2014Song.AlbumYear;

            // use correct LastConversionDateTime format
            rs1Song.LastConversionDateTime = DateTime.Now.ToString("MM-dd-yy HH:mm");
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:21,代码来源:Rs2014Converter.cs

示例10: ExportArrangement

 static void ExportArrangement(Score score, Song2014 arrangement, string identifier, int difficulty, 
     string originalFile, ToolkitInfo toolkitInfo)
 {
     var track = Converter.ConvertArrangement(arrangement, identifier, difficulty);
     score.Tracks.Add(track);
     score.Title = arrangement.Title;
     score.Artist = arrangement.ArtistName;
     score.ArtistSort = arrangement.ArtistNameSort;
     score.Album = arrangement.AlbumName;
     score.Year = arrangement.AlbumYear;
     score.Comments = new List<string>();
     score.Comments.Add("Generated by RocksmithToTab v" + VersionInfo.VERSION);
     score.Comments.Add("=> http://www.rocksmithtotab.de");
     score.Comments.Add("Created from archive: " + Path.GetFileName(originalFile));
     if (toolkitInfo != null && toolkitInfo.PackageAuthor != string.Empty)
     {
         score.Comments.Add("CDLC author:  " + toolkitInfo.PackageAuthor);
         score.Tabber = toolkitInfo.PackageAuthor;
     }
     if (toolkitInfo != null && toolkitInfo.PackageVersion != string.Empty)
         score.Comments.Add("CDLC version: " + toolkitInfo.PackageVersion);
 }
开发者ID:killergege,项目名称:RocksmithToTab,代码行数:22,代码来源:Program.cs

示例11: SongFile2Song2014File

        public string SongFile2Song2014File(string songFilePath, bool overWrite)
        {
            Song2014 song2014 = new Song2014();
            using (var obj = new Rs1Converter())
                song2014 = obj.SongToSong2014(Song.LoadFromFile(songFilePath));

            if (!overWrite)
            {
                var srcDir = Path.GetDirectoryName(songFilePath);
                var srcName = Path.GetFileNameWithoutExtension(songFilePath);
                var backupSrcPath = String.Format("{0}_{1}.xml", Path.Combine(srcDir, srcName), "RS1");

                // backup original RS1 file
                File.Copy(songFilePath, backupSrcPath);
            }

            // write converted RS1 file
            using (FileStream stream = new FileStream(songFilePath, FileMode.Create))
                song2014.Serialize(stream, true);

            return songFilePath;
        }
开发者ID:ray,项目名称:rocksmith-custom-song-toolkit,代码行数:22,代码来源:Rs1Converter.cs

示例12: parseMetadata

        private void parseMetadata(Song2014 xml, Sng2014File sng, Int16[] tuning)
        {
            // Easy, Medium, Hard
            NoteCount = new int[3];
            NoteCount[0] = getNoteCount(sng, 0);
            NoteCount[1] = getNoteCount(sng, 1);
            NoteCount[2] = getNoteCount(sng, 2);

            sng.Metadata = new Metadata();
            sng.Metadata.MaxScore = 100000;

            sng.Metadata.MaxDifficulty = getMaxDifficulty(xml);
            sng.Metadata.MaxNotesAndChords = NoteCount[2];
            sng.Metadata.MaxNotesAndChords_Real = sng.Metadata.MaxNotesAndChords;//num unique notes+not ignored
            sng.Metadata.PointsPerNote = sng.Metadata.MaxScore / sng.Metadata.MaxNotesAndChords;

            sng.Metadata.FirstBeatLength = xml.Ebeats[1].Time - xml.Ebeats[0].Time;
            sng.Metadata.StartTime = xml.Offset * -1;
            sng.Metadata.CapoFretId = (xml.Capo == 0) ? unchecked((Byte)(-1)) : xml.Capo;
            readString(xml.LastConversionDateTime, sng.Metadata.LastConversionDateTime);
            sng.Metadata.Part = xml.Part;
            sng.Metadata.SongLength = xml.SongLength;
            sng.Metadata.StringCount = 6;
            sng.Metadata.Tuning = tuning ?? new Int16[sng.Metadata.StringCount];
            // calculated when parsing arrangements
            sng.Metadata.Unk11_FirstNoteTime = first_note_time;
            sng.Metadata.Unk12_FirstNoteTime = first_note_time;
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:28,代码来源:Sng2014FileWriter.cs

示例13: parseEvents

        private void parseEvents(Song2014 xml, Sng2014File sng)
        {
            sng.Events = new EventSection();
            sng.Events.Count = xml.Events.Length;
            sng.Events.Events = new Event[sng.Events.Count];

            for (int i = 0; i < sng.Events.Count; i++)
            {
                var evnt = xml.Events[i];
                var e = new Event();
                e.Time = evnt.Time;
                readString(evnt.Code, e.EventName);
                sng.Events.Events[i] = e;
            }
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:15,代码来源:Sng2014FileWriter.cs

示例14: parseEbeats

 private void parseEbeats(Song2014 xml, Sng2014File sng)
 {
     sng.BPMs = new BpmSection();
     sng.BPMs.Count = xml.Ebeats.Length;
     sng.BPMs.BPMs = new Bpm[sng.BPMs.Count];
     Int16 measure = 0;
     Int16 beat = 0;
     for (int i = 0; i < sng.BPMs.Count; i++)
     {
         var ebeat = xml.Ebeats[i];
         var bpm = new Bpm();
         bpm.Time = ebeat.Time;
         if (ebeat.Measure >= 0)
         {
             measure = ebeat.Measure;
             beat = 0;
         }
         else
         {
             beat++;
         }
         bpm.Measure = measure;
         bpm.Beat = beat;
         bpm.PhraseIteration = getPhraseIterationId(xml, bpm.Time, true);
         if (beat == 0)
         {
             bpm.Mask |= 1;
             if (measure % 2 == 0)
                 bpm.Mask |= 2;
         }
         sng.BPMs.BPMs[i] = bpm;
     }
 }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:33,代码来源:Sng2014FileWriter.cs

示例15: parseDNAs

        private void parseDNAs(Song2014 xml, Sng2014File sng)
        {
            sng.DNAs = new DnaSection();
            List<Dna> dnas = new List<Dna>();

            DNACount = new int[4];

            // based on events: dna_none=0, dna_solo=1, dna_riff=2, dna_chord=3
            foreach (var e in xml.Events)
            {
                Int32 id = -1;
                switch (e.Code)
                {
                    case "dna_none":
                        id = 0;
                        break;
                    case "dna_solo":
                        id = 1;
                        break;
                    case "dna_riff":
                        id = 2;
                        break;
                    case "dna_chord":
                        id = 3;
                        break;
                }

                if (id != -1)
                {
                    var dna = new Dna();
                    dna.Time = e.Time;
                    dna.DnaId = id;
                    DNACount[id] += 1;
                    dnas.Add(dna);
                }
            }

            sng.DNAs.Dnas = dnas.ToArray();
            sng.DNAs.Count = sng.DNAs.Dnas.Length;
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:40,代码来源:Sng2014FileWriter.cs


注:本文中的RocksmithToolkitLib.Xml.Song2014类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。