public void NameFromStringsTest() { string tName = string.Empty; var t = new TuningDefinition(); var Estd = new TuningStrings(new Int16[] { 0, 0, 0, 0, 0, 0 }); tName = t.NameFromStrings(Estd, false); Assert.AreEqual("E Standard", tName); var Ebstd = new TuningStrings(new Int16[] { -1, -1, -1, -1, -1, -1 }); tName = t.NameFromStrings(Ebstd, true); Assert.AreEqual("Eb Standard", tName); var EbstdB = new TuningStrings(new Int16[] { -1, -1, -1, -1 }); //TODO: support bass tName = t.NameFromStrings(EbstdB, true); //Assert.AreEqual("Eb Standard", tName); var Ccstd = new TuningStrings(new Int16[] { -3, -3, -3, -3, -3, -3 }); tName = t.NameFromStrings(Ccstd, false); Assert.AreEqual("C# Standard", tName); var DropEb = new TuningStrings(new Int16[] { -3, -1, -1, -1, -1, -1 }); tName = t.NameFromStrings(DropEb, true); Assert.AreEqual("Eb Drop Db", tName); var DropA = new TuningStrings(new Int16[] { 5, 7, 7, 7, 7, 7 }); tName = t.NameFromStrings(DropA, false); Assert.AreEqual("B Drop A", tName); }
private void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir) { RS2012.Checked = info.GameVersion == GameVersion.RS2012; RS2014.Checked = info.GameVersion == GameVersion.RS2014; platformPC.Checked = info.Pc; platformMAC.Checked = info.Mac; platformXBox360.Checked = info.XBox360; platformPS3.Checked = info.PS3; PackageVersion = info.PackageVersion; TonesLB.Items.Clear(); switch (CurrentGameVersion) { case GameVersion.RS2012: if (info.Tones == null) info.Tones = new List<Tone>(); if (info.Tones.Count == 0) info.Tones.Add(CreateNewTone()); foreach (var tone in info.Tones) { if (String.IsNullOrEmpty(tone.Key)) tone.Key = tone.Name.GetValidName(); TonesLB.Items.Add(tone); } break; case GameVersion.RS2014: if (info.TonesRS2014 == null) info.TonesRS2014 = new List<Tone2014>(); if (info.TonesRS2014.Count == 0) info.TonesRS2014.Add(CreateNewTone()); foreach (var toneRS2014 in info.TonesRS2014) { if (String.IsNullOrEmpty(toneRS2014.Key)) toneRS2014.Key = toneRS2014.Name.GetValidName(); TonesLB.Items.Add(toneRS2014); } break; } var BasePath = Path.GetDirectoryName(filesBaseDir); // Song INFO DlcNameTB.Text = info.Name; PopulateAppIdCombo(); Application.DoEvents(); AppIdTB.Text = info.AppId; SelectComboAppId(info.AppId); AlbumTB.Text = info.SongInfo.Album; SongDisplayNameTB.Text = info.SongInfo.SongDisplayName; SongDisplayNameSortTB.Text = info.SongInfo.SongDisplayNameSort; YearTB.Text = info.SongInfo.SongYear.ToString(); ArtistTB.Text = info.SongInfo.Artist; ArtistSortTB.Text = info.SongInfo.ArtistSort; AverageTempoTB.Text = info.SongInfo.AverageTempo.ToString(); // Album art AlbumArtPath = BasePath.AbsoluteTo(info.AlbumArtPath); // Audio file if (!String.IsNullOrEmpty(info.OggPath)) AudioPath = BasePath.AbsoluteTo(info.OggPath); platformPC.Checked = !String.IsNullOrEmpty(info.OggPath); songVolumeBox.Value = Decimal.Round((decimal)info.Volume, 2); previewVolumeBox.Value = (info.PreviewVolume != null) ? Decimal.Round((decimal)info.PreviewVolume, 2) : songVolumeBox.Value; //if (platformXBox360.Checked) // rbuttonSignatureLIVE.Checked = info.SignatureType == PackageMagic.LIVE; ArrangementLB.Items.Clear(); foreach (var arrangement in info.Arrangements) { arrangement.SongXml.File = BasePath.AbsoluteTo(arrangement.SongXml.File); if (arrangement.ToneBase == null) { switch (CurrentGameVersion) { case GameVersion.RS2012: arrangement.ToneBase = info.Tones[0].Name; break; case GameVersion.RS2014: arrangement.ToneBase = info.TonesRS2014[0].Name; break; } } if (arrangement.ArrangementType != ArrangementType.Vocal) { try { //Load tunig from Arrangement var tuning = TuningDefinitionRepository.Instance().SelectAny(arrangement.TuningStrings, CurrentGameVersion); if (tuning == null) { tuning = new TuningDefinition(); tuning.Tuning = arrangement.TuningStrings; tuning.Custom = true; tuning.GameVersion = CurrentGameVersion; tuning.Name = tuning.UIName = arrangement.Tuning; if (String.IsNullOrEmpty(tuning.Name)) { tuning.Name = tuning.UIName = tuning.NameFromStrings(arrangement.TuningStrings, arrangement.ArrangementType == ArrangementType.Bass); } TuningDefinitionRepository.Instance().Add(tuning, true); } tuning = null; //Cleanup after } catch { /* Handle old types of *.dlc.xml */ } } ArrangementLB.Items.Add(arrangement); } }
private void SetTuningCombo(TuningStrings tuningStrings, bool isBass = false) { //Detect tuning TuningDefinition tuning = TuningDefinitionRepository.Instance().SelectAny(tuningStrings, currentGameVersion); //Create tuning if (tuning == null) { using (var form = new TuningForm()) { tuning = new TuningDefinition(); tuning.Tuning = tuningStrings; tuning.Custom = true; tuning.GameVersion = currentGameVersion; tuning.Name = tuning.UIName = tuning.NameFromStrings(tuningStrings, isBass); form.Tuning = tuning; form.IsBass = isBass; if (DialogResult.OK != form.ShowDialog()) { return; } FillTuningCombo(); } } //Set tuning tuningComboBox.SelectedItem = tuning; }