public static GetTuningByOffsets ( |
||
strings | ||
return | InstrumentTuning |
/// <summary> /// WARNING: This method may not detect the Arrangment Tuning correctly /// <para>Use the Write(Arrangement arr, string outputFile, Platform platform) method to detect tuning correctly ...</para> /// </summary> // [Obsolete("Deprecated, please use Write(Arrangement arr, string outputFile, Platform platform) method.", false)] public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, Platform platform) { using (var reader = new StreamReader(inputFile)) { var bitConverter = platform.GetBitConverter; if (arrangementType == ArrangementType.Vocal) { var serializer = new XmlSerializer(typeof(Vocals)); var vocals = (Vocals)serializer.Deserialize(reader); WriteVocalsFile(vocals, outputFile, bitConverter); } else { var serializer = new XmlSerializer(typeof(Song)); var song = (Song)serializer.Deserialize(reader); // HACK: apply Standard E tuning var tuning = new Int16[] { 0, 0, 0, 0, 0, 0 }; if (song.Tuning != null) { tuning = song.Tuning.ToArray(); } else { var diaMsg = "<WARNING> Arrangement XML contains no tuning element ..." + Environment.NewLine + "The arrangment will be defaulted to Standard E tuning."; MessageBox.Show(diaMsg, "SngFileWriter Null Tuning ..."); } WriteSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(tuning), arrangementType, outputFile, bitConverter); } } }
/// <summary> /// Preferred Write method /// <para>Detects the Arrangment Tuning correctly</para> /// </summary> /// <param name="arr"></param> /// <param name="outputFile"></param> /// <param name="platform"></param> public static void Write(Arrangement arr, string outputFile, Platform platform) { using (var reader = new StreamReader(arr.SongXml.File)) { var bitConverter = platform.GetBitConverter; if (arr.ArrangementType == ArrangementType.Vocal) { var serializer = new XmlSerializer(typeof(Vocals)); var vocals = (Vocals)serializer.Deserialize(reader); WriteVocalsFile(vocals, outputFile, bitConverter); } else { var serializer = new XmlSerializer(typeof(Song)); var song = (Song)serializer.Deserialize(reader); // apply proper fix for null tuning var tuning = new Int16[] { 0, 0, 0, 0, 0, 0 }; if (arr.TuningStrings != null) { tuning = arr.TuningStrings.ToArray(); } WriteSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(tuning), arr.ArrangementType, outputFile, bitConverter); } } }
public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, Platform platform) { using (var reader = new StreamReader(inputFile)) { var bitConverter = platform.GetBitConverter; if (arrangementType == ArrangementType.Vocal) { var serializer = new XmlSerializer(typeof(Vocals)); var vocals = (Vocals)serializer.Deserialize(reader); WriteRocksmithVocalsFile(vocals, outputFile, bitConverter); } else { var serializer = new XmlSerializer(typeof(Song)); var song = (Song)serializer.Deserialize(reader); // TODO: song.Tuning is null in toolkit generated RS1 Xml files // HACK: this is only a quick fix of the root problem var tuning = new Int16[] { 0, 0, 0, 0, 0, 0 }; if (song.Tuning != null) { tuning = song.Tuning.ToArray(); } WriteRocksmithSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(tuning), arrangementType, outputFile, bitConverter); } } }
public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, Platform platform) { using (var reader = new StreamReader(inputFile)) { var bitConverter = platform.GetBitConverter; if (arrangementType == ArrangementType.Vocal) { var serializer = new XmlSerializer(typeof(Vocals)); var vocals = (Vocals)serializer.Deserialize(reader); WriteVocalsFile(vocals, outputFile, bitConverter); } else { var serializer = new XmlSerializer(typeof(Song)); var song = (Song)serializer.Deserialize(reader); // TODO: song.Tuning is null (does not exist in the XML Arrangement) // HACK: apply Standard E tuning var tuning = new Int16[] { 0, 0, 0, 0, 0, 0 }; if (song.Tuning != null) { tuning = song.Tuning.ToArray(); } else { throw new DataException("<ERROR> Arrangement XML contains no tuning element" + Environment.NewLine + "The arrangment will be defaulted to Standard E tuning" + Environment.NewLine); } WriteSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(tuning), arrangementType, outputFile, bitConverter); } } }
public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, Platform platform) { using (var reader = new StreamReader(inputFile)) { var bitConverter = platform.platform == GamePlatform.Pc ? (EndianBitConverter)EndianBitConverter.Little : (EndianBitConverter)EndianBitConverter.Big; if (arrangementType == ArrangementType.Vocal) { var serializer = new XmlSerializer(typeof(Vocals)); var vocals = (Vocals)serializer.Deserialize(reader); WriteRocksmithVocalsFile(vocals, outputFile, bitConverter); } else { var serializer = new XmlSerializer(typeof(Song)); var song = (Song)serializer.Deserialize(reader); WriteRocksmithSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(song.Tuning.ToArray()), arrangementType, outputFile, bitConverter); } } }