Permalink
Browse files

- added validation to sortable fields on initial load into CDLC Creator

  • Loading branch information...
cozy1 committed Oct 1, 2018
1 parent cc87983 commit 528b9d4dee55cabd5a1a978f7352f472d4672ec7
@@ -745,6 +745,7 @@ private void AddValidationEventHandlers()
txtAlbum.Validating += ValidateName;
txtAlbumSort.Validating += ValidateSortName;
txtYear.Validating += ValidateYear;
txtVersion.Validating += ValidateVersion;
txtDlcKey.Validating += ValidateDlcKey;
txtVersion.Validating += ClickedInputControl;
txtTempo.Validating += ValidateTempo;
@@ -867,16 +868,17 @@ public void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir)
SelectComboAppId(AppId);
// validate on-load to address old CDLC issues
txtAlbum.Text = info.SongInfo.Album;
txtAlbumSort.Text = info.SongInfo.AlbumSort;
txtAlbumSort.Text = info.SongInfo.AlbumSort.GetValidSortableName();
txtJapaneseSongTitle.Text = info.SongInfo.JapaneseSongName;
txtJapaneseArtistName.Text = info.SongInfo.JapaneseArtistName;
cbJapaneseTitle.Checked = !string.IsNullOrEmpty(txtJapaneseSongTitle.Text) || !string.IsNullOrEmpty(txtJapaneseArtistName.Text);
txtSongTitle.Text = info.SongInfo.SongDisplayName;
txtSongTitleSort.Text = info.SongInfo.SongDisplayNameSort;
txtSongTitleSort.Text = info.SongInfo.SongDisplayNameSort.GetValidSortableName();
txtYear.Text = info.SongInfo.SongYear.ToString();
txtArtist.Text = info.SongInfo.Artist;
txtArtistSort.Text = info.SongInfo.ArtistSort;
txtArtistSort.Text = info.SongInfo.ArtistSort.GetValidSortableName();
txtTempo.Text = info.SongInfo.AverageTempo.ToString();
// fill in the new AlbumSort textbox if it is empty
@@ -1648,7 +1650,7 @@ private void btnPackageGenerate_Click(object sender, EventArgs e)
break;
}
var packageVersion = String.Format("{0}{1}", versionPrefix, PackageVersion.Replace(".", "_"));
var packageVersion = String.Format("{0}{1}", versionPrefix, PackageVersion);
var fileName = StringExtensions.GetValidShortFileName(ArtistSort, SongTitleSort, packageVersion, ConfigRepository.Instance().GetBoolean("creator_useacronyms"));
sfd.FileName = fileName.GetValidFileName();
sfd.Filter = CurrentRocksmithTitle + " CDLC (*.*)|*.*";
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.1.0")]
[assembly: AssemblyInformationalVersion("f664cada")]
[assembly: AssemblyInformationalVersion("cc87983a")]
[assembly: AssemblyConfiguration("BETA")]
@@ -211,7 +211,7 @@ static int Main(string[] args)
var artist = packageData.SongInfo.ArtistSort;
var title = packageData.SongInfo.SongDisplayNameSort;
// var destDir = Path.Combine(arguments.Output, Path.GetFileName(srcDirs[i]).GetValidName());
var fileName = StringExtensions.GetValidShortFileName(artist, title, arguments.Revision.Replace(".", "_"), ConfigRepository.Instance().GetBoolean("creator_useacronyms"));
var fileName = StringExtensions.GetValidShortFileName(artist, title, arguments.Revision, ConfigRepository.Instance().GetBoolean("creator_useacronyms"));
var destPath = Path.Combine(arguments.Output, fileName);
var fullFileName = String.Format("{0}{1}.psarc", fileName, DLCPackageCreator.GetPathName(arguments.Platform)[2]);
Console.WriteLine(@"Packing: " + Path.GetFileName(fullFileName));
@@ -173,7 +173,6 @@ public static void Audio2Ogg(string sourcePath, string destinationPath, int qual
GeneralExtensions.RunExternalExecutable(APP_OGGENC, true, false, true, cmdArgs);
}
public static void Ogg2Preview(string sourcePath, string destinationPath, long msLength = 30000, long msStart = 4000)
{
var cmdArgs = String.Format(" -s {2} -l {3} \"{0}\" \"{1}\"", sourcePath, destinationPath, msStart, msLength);
@@ -222,18 +222,19 @@ public static string GetValidPathName(this string pathName)
/// <returns></returns>
public static string GetValidShortFileName(string artist, string title, string version, bool acronym = false)
{
// TODO remove periods may need to fix version
if (String.IsNullOrEmpty(artist) || String.IsNullOrEmpty(title) || String.IsNullOrEmpty(version))
throw new DataException("Artist, title, or version field is null or empty ...");
// cleanup version numbering
version = version.Replace(".", "_");
string value;
if (!acronym)
value = String.Format("{0}_{1}_{2}", artist.GetValidAtaSpaceName(), title.GetValidAtaSpaceName(), version).Replace(" ", "-");
else
value = String.Format("{0}_{1}_{2}", artist.GetValidAcronym(), title.GetValidAtaSpaceName(), version).Replace(" ", "-");
value = value.GetValidFileName().StripExcessWhiteSpace();
// value = value.Replace(".", ""); // Remove all periods from file name without extension
return value;
}
@@ -27,5 +27,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.1.0")]
[assembly: AssemblyInformationalVersion("f664cada")]
[assembly: AssemblyInformationalVersion("cc87983a")]
[assembly: AssemblyConfiguration("BETA")]
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.1.0")]
[assembly: AssemblyInformationalVersion("f664cada")]
[assembly: AssemblyInformationalVersion("cc87983a")]
[assembly: AssemblyConfiguration("BETA")]
@@ -1,3 +1,3 @@
2.9.1.0
f664cada
cc87983a
BETA

0 comments on commit 528b9d4

Please sign in to comment.