public bool LoadArrangementData(string xmlfilepath) { //Song XML File Arrangement.SongXml.File = xmlfilepath; // SONG INFO if (!ReferenceEquals(xmlSong, null)) { if (String.IsNullOrEmpty(parentControl.SongTitle)) { parentControl.SongTitle = xmlSong.Title ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.SongTitleSort)) { parentControl.SongTitleSort = xmlSong.SongNameSort.GetValidSortName() ?? parentControl.SongTitle.GetValidSortName(); } if (String.IsNullOrEmpty(parentControl.AverageTempo)) { parentControl.AverageTempo = Math.Round(xmlSong.AverageTempo).ToString() ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.Artist)) { parentControl.Artist = xmlSong.ArtistName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.ArtistSort)) { parentControl.ArtistSort = xmlSong.ArtistNameSort.GetValidSortName() ?? parentControl.Artist.GetValidSortName(); } if (String.IsNullOrEmpty(parentControl.Album)) { parentControl.Album = xmlSong.AlbumName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.AlbumYear)) { parentControl.AlbumYear = xmlSong.AlbumYear ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.DLCName)) { parentControl.DLCName = parentControl.Artist.Acronym() + parentControl.SongTitleSort; } } //Arrangment Information Arrangement.Name = (ArrangementName)arrangementNameCombo.SelectedItem; Arrangement.ArrangementType = (ArrangementType)arrangementTypeCombo.SelectedItem; Arrangement.ScrollSpeed = scrollSpeedTrackBar.Value; Arrangement.PluckedType = Picked.Checked ? PluckedType.Picked : PluckedType.NotPicked; Arrangement.BonusArr = BonusCheckBox.Checked; Arrangement.Metronome = MetronomeCb.Checked ? Metronome.Generate : Metronome.None; // Tuning TuningDefinition tuning = (TuningDefinition)tuningComboBox.SelectedItem; Arrangement.Tuning = tuning.UIName; Arrangement.TuningStrings = tuning.Tuning; // TODO: Add capo selection to arrangement form if (!ReferenceEquals(xmlSong, null)) { Arrangement.CapoFret = xmlSong.Capo; } UpdateCentOffset(); //ToneSelector Arrangement.ToneBase = toneBaseCombo.SelectedItem.ToString(); Arrangement.ToneA = (toneACombo.SelectedItem != null) ? toneACombo.SelectedItem.ToString() : ""; //Only need if have more than one tone Arrangement.ToneB = (toneBCombo.SelectedItem != null) ? toneBCombo.SelectedItem.ToString() : ""; Arrangement.ToneC = (toneCCombo.SelectedItem != null) ? toneCCombo.SelectedItem.ToString() : ""; Arrangement.ToneD = (toneDCombo.SelectedItem != null) ? toneDCombo.SelectedItem.ToString() : ""; //Gameplay Path Arrangement.RouteMask = RouteMask; //Xml data cleanup xmlSong = null; // DLC IDs Guid guid; if (Guid.TryParse(PersistentId.Text, out guid) == false) { PersistentId.Focus(); } else { Arrangement.Id = guid; } int masterId; if (int.TryParse(MasterId.Text, out masterId) == false) { MasterId.Focus(); } else { Arrangement.MasterId = masterId; } return(true); }
private void OkButton_Click(object sender, EventArgs e) { //Validations var xmlfilepath = XmlFilePath.Text; if (!File.Exists(xmlfilepath)) { if (MessageBox.Show("Xml Arrangement file path is not valid.", DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { XmlFilePath.Focus(); return; } } if (currentGameVersion != GameVersion.RS2012) { if (!routeMaskLeadRadio.Checked && !routeMaskRhythmRadio.Checked && !routeMaskBassRadio.Checked && (ArrangementType)arrangementTypeCombo.SelectedItem != ArrangementType.Vocal) { if (MessageBox.Show("You did not select a Gameplay Path for this arrangement.", DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel) { gbGameplayPath.Focus(); return; } } } //Song XML File Arrangement.SongXml.File = xmlfilepath; // SONG INFO if (!ReferenceEquals(xmlSong, null)) { if (String.IsNullOrEmpty(parentControl.SongTitle)) { parentControl.SongTitle = xmlSong.Title ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.SongTitleSort)) { parentControl.SongTitleSort = xmlSong.SongNameSort.GetValidSortName() ?? parentControl.SongTitle.GetValidSortName(); } if (String.IsNullOrEmpty(parentControl.AverageTempo)) { parentControl.AverageTempo = Math.Round(xmlSong.AverageTempo).ToString() ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.Artist)) { parentControl.Artist = xmlSong.ArtistName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.ArtistSort)) { parentControl.ArtistSort = xmlSong.ArtistNameSort.GetValidSortName() ?? parentControl.Artist.GetValidSortName(); } if (String.IsNullOrEmpty(parentControl.Album)) { parentControl.Album = xmlSong.AlbumName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.AlbumYear)) { parentControl.AlbumYear = xmlSong.AlbumYear ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.DLCName)) { parentControl.DLCName = parentControl.Artist.Acronym() + parentControl.SongTitleSort; } } //Arrangment Information Arrangement.Name = (ArrangementName)arrangementNameCombo.SelectedItem; Arrangement.ArrangementType = (ArrangementType)arrangementTypeCombo.SelectedItem; Arrangement.ScrollSpeed = scrollSpeedTrackBar.Value; Arrangement.PluckedType = Picked.Checked ? PluckedType.Picked : PluckedType.NotPicked; Arrangement.BonusArr = BonusCheckBox.Checked; Arrangement.Metronome = MetronomeCb.Checked ? Metronome.Generate : Metronome.None; // Tuning TuningDefinition tuning = (TuningDefinition)tuningComboBox.SelectedItem; Arrangement.Tuning = tuning.UIName; Arrangement.TuningStrings = tuning.Tuning; // TODO: Add capo selection to arrangement form if (!ReferenceEquals(xmlSong, null)) { Arrangement.CapoFret = xmlSong.Capo; } UpdateCentOffset(); //ToneSelector Arrangement.ToneBase = toneBaseCombo.SelectedItem.ToString(); Arrangement.ToneA = (toneACombo.SelectedItem != null) ? toneACombo.SelectedItem.ToString() : ""; //Only need if have more than one tone Arrangement.ToneB = (toneBCombo.SelectedItem != null) ? toneBCombo.SelectedItem.ToString() : ""; Arrangement.ToneC = (toneCCombo.SelectedItem != null) ? toneCCombo.SelectedItem.ToString() : ""; Arrangement.ToneD = (toneDCombo.SelectedItem != null) ? toneDCombo.SelectedItem.ToString() : ""; //Gameplay Path Arrangement.RouteMask = RouteMask; //Xml data cleanup xmlSong = null; // DLC IDs Guid guid; if (Guid.TryParse(PersistentId.Text, out guid) == false) { PersistentId.Focus(); } else { Arrangement.Id = guid; } int masterId; if (int.TryParse(MasterId.Text, out masterId) == false) { MasterId.Focus(); } else { Arrangement.MasterId = masterId; } DialogResult = DialogResult.OK; Close(); }
public bool LoadArrangementData(string xmlfilepath) { //Song XML File Arrangement.SongXml.File = xmlfilepath; // SONG INFO // TODO: get song info from json or hsan file (would be better than from xml) if (!ReferenceEquals(xmlSong, null)) { var defaultAuthor = ConfigRepository.Instance()["general_defaultauthor"].Trim(); if (String.IsNullOrEmpty(parentControl.SongTitle)) { parentControl.SongTitle = xmlSong.Title ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.SongTitleSort)) { parentControl.SongTitleSort = xmlSong.SongNameSort.GetValidSortableName() ?? parentControl.SongTitle.GetValidSortableName(); } if (String.IsNullOrEmpty(parentControl.AverageTempo)) { parentControl.AverageTempo = Math.Round(xmlSong.AverageTempo).ToString() ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.Artist)) { parentControl.Artist = xmlSong.ArtistName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.ArtistSort)) { parentControl.ArtistSort = xmlSong.ArtistNameSort.GetValidSortableName() ?? parentControl.Artist.GetValidSortableName(); } if (String.IsNullOrEmpty(parentControl.Album)) { parentControl.Album = xmlSong.AlbumName ?? String.Empty; } if (String.IsNullOrEmpty(parentControl.AlbumYear)) { parentControl.AlbumYear = xmlSong.AlbumYear ?? String.Empty; } // using first three letters of defaultAuthor to make DLCKey unique if (String.IsNullOrEmpty(parentControl.DLCKey)) { parentControl.DLCKey = String.Format("{0}{1}{2}", defaultAuthor.Substring(0, Math.Min(3, defaultAuthor.Length)), parentControl.Artist.GetValidAcronym(), parentControl.SongTitle).GetValidKey(parentControl.SongTitle); } if (String.IsNullOrEmpty(parentControl.AlbumSort)) { // use default author for AlbumSort or generate var useDefaultAuthor = ConfigRepository.Instance().GetBoolean("creator_usedefaultauthor"); if (useDefaultAuthor) // && currentGameVersion == GameVersion.RS2014) { parentControl.AlbumSort = defaultAuthor.GetValidSortableName(); } else { parentControl.AlbumSort = xmlSong.AlbumNameSort.GetValidSortableName() ?? parentControl.Album.GetValidSortableName(); } } } //Arrangment Information Arrangement.Name = (ArrangementName)arrangementNameCombo.SelectedItem; Arrangement.ArrangementType = (ArrangementType)arrangementTypeCombo.SelectedItem; Arrangement.ScrollSpeed = scrollSpeedTrackBar.Value; Arrangement.PluckedType = Picked.Checked ? PluckedType.Picked : PluckedType.NotPicked; Arrangement.BonusArr = BonusCheckBox.Checked; Arrangement.Metronome = MetronomeCb.Checked ? Metronome.Generate : Metronome.None; // Tuning TuningDefinition tuning = (TuningDefinition)tuningComboBox.SelectedItem; Arrangement.Tuning = tuning.UIName; Arrangement.TuningStrings = tuning.Tuning; // TODO: Add capo selection to arrangement form if (!ReferenceEquals(xmlSong, null)) { Arrangement.CapoFret = xmlSong.Capo; } UpdateCentOffset(); //ToneSelector //TODO: add parsing tones events Arrangement.ToneBase = toneBaseCombo.SelectedItem.ToString(); Arrangement.ToneA = (toneACombo.SelectedItem != null) ? toneACombo.SelectedItem.ToString() : ""; //Only need if have more than one tone Arrangement.ToneB = (toneBCombo.SelectedItem != null) ? toneBCombo.SelectedItem.ToString() : ""; Arrangement.ToneC = (toneCCombo.SelectedItem != null) ? toneCCombo.SelectedItem.ToString() : ""; Arrangement.ToneD = (toneDCombo.SelectedItem != null) ? toneDCombo.SelectedItem.ToString() : ""; //Gameplay Path Arrangement.RouteMask = RouteMask; //Xml data cleanup xmlSong = null; // DLC IDs Guid guid; if (Guid.TryParse(PersistentId.Text, out guid) == false) { PersistentId.Focus(); } else { Arrangement.Id = guid; } int masterId; if (int.TryParse(MasterId.Text, out masterId) == false) { MasterId.Focus(); } else { Arrangement.MasterId = masterId; } return(true); }
private void addArrangementButton_Click(object sender, EventArgs e) { //Validations var xmlfilepath = XmlFilePath.Text; if (!File.Exists(xmlfilepath)) { XmlFilePath.Focus(); return; } if (currentGameVersion == GameVersion.RS2014) { if (!routeMaskLeadRadio.Checked && !routeMaskRhythmRadio.Checked && !routeMaskBassRadio.Checked && (ArrangementType)arrangementTypeCombo.SelectedItem != ArrangementType.Vocal) { if (MessageBox.Show("You not selected a Gameplay Path, this arrangement you show only in song list.", DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel) { gbGameplayPath.Focus(); return; } } } //Song XML File arrangement.SongXml.File = xmlfilepath; //Arrangment Information arrangement.Name = (ArrangementName)arrangementNameCombo.SelectedItem; arrangement.ArrangementType = (ArrangementType)arrangementTypeCombo.SelectedItem; // Tuning arrangement.Tuning = tuningComboBox.SelectedItem.ToString(); arrangement.TuningPitch = 440; var value = frequencyTB.Text; if (!String.IsNullOrEmpty(value)) { double freq = 440; Double.TryParse(value, out freq); arrangement.TuningPitch = freq; } arrangement.ScrollSpeed = scrollSpeedTrackBar.Value; arrangement.PluckedType = Picked.Checked ? PluckedType.Picked : PluckedType.NotPicked; arrangement.BonusArr = BonusCheckBox.Checked; //ToneSelector arrangement.ToneBase = toneBaseCombo.SelectedItem.ToString(); arrangement.ToneA = (toneBCombo.SelectedItem != null) ? toneBaseCombo.SelectedItem.ToString() : ""; //Only need if have more than one tone arrangement.ToneB = (toneBCombo.SelectedItem != null) ? toneBCombo.SelectedItem.ToString() : ""; arrangement.ToneC = (toneCCombo.SelectedItem != null) ? toneCCombo.SelectedItem.ToString() : ""; arrangement.ToneD = (toneDCombo.SelectedItem != null) ? toneDCombo.SelectedItem.ToString() : ""; //Gameplay Path arrangement.RouteMask = RouteMask; // DLC IDs Guid guid; if (Guid.TryParse(PersistentId.Text, out guid) == false) { PersistentId.Focus(); } else { arrangement.Id = guid; } int masterId; if (int.TryParse(MasterId.Text, out masterId) == false) { MasterId.Focus(); } else { arrangement.MasterId = masterId; } DialogResult = DialogResult.OK; Close(); }