Permalink
Browse files

- added verbose messages to '<ERROR> DLCPackageData is null' exception

  • Loading branch information...
cozy1 committed Feb 3, 2019
1 parent e972ddc commit 5b20d98110b7ee2ca9450e718b6bf6af543d6c18
@@ -518,7 +518,8 @@ public string SaveTemplateFile(string templateDir = "", bool validate = true)

var templatePath = String.Empty;
var fileName = String.Empty;
DLCPackageData packageData = GetPackageData(validate);
var packageDataError = String.Empty;
DLCPackageData packageData = GetPackageData(validate, out packageDataError);

try
{
@@ -1013,8 +1014,11 @@ public void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir)
IsDirty = CurrentGameVersion != GameVersion.RS2014;
}

private DLCPackageData GetPackageData(bool validate = true)
string errorMsg;
private DLCPackageData GetPackageData(bool validate, out string errorMsg)
{
errorMsg = String.Empty;

if (validate)
{
if (CurrentGameVersion != GameVersion.RS2012)
@@ -1037,6 +1041,7 @@ private DLCPackageData GetPackageData(bool validate = true)
if (String.IsNullOrEmpty(DLCKey))
{
txtDlcKey.Focus();
errorMsg = "DLCKey is missing ...";
return null;
}

@@ -1065,48 +1070,56 @@ private DLCPackageData GetPackageData(bool validate = true)
if (String.IsNullOrEmpty(SongTitle))
{
txtSongTitle.Focus();
errorMsg = "SongTitle is missing ...";
return null;
}
if (string.IsNullOrEmpty(Album))
{
txtAlbum.Focus();
errorMsg = "Album is missing ...";
return null;
}

if (String.IsNullOrEmpty(Artist))
{
txtArtist.Focus();
errorMsg = "Artist is missing ...";
return null;
}

if (string.IsNullOrEmpty(ArtistSort))
{
txtArtistSort.Focus();
errorMsg = "ArtistSort is missing ...";
return null;
}

if (String.IsNullOrEmpty(SongTitleSort))
{
txtSongTitleSort.Focus();
errorMsg = "SongTitleSort is missing ...";
return null;
}

if (String.IsNullOrEmpty(AlbumSort))
{
txtAlbumSort.Focus();
errorMsg = "AlbumSort is missing ...";
return null;
}

if (String.IsNullOrEmpty(AppId))
{
txtAppId.Focus();
errorMsg = "AppId is missing ...";
return null;
}

if (String.IsNullOrEmpty(PackageVersion))
{
// force user to make entry rather than defaulting
// PackageVersion = "1";
errorMsg = "PackageVersion is missing ...";
txtVersion.Focus();
return null;
}
@@ -1135,6 +1148,7 @@ private DLCPackageData GetPackageData(bool validate = true)
if (!File.Exists(AudioPath))
{
txtAudioPath.Focus();
errorMsg = "Audio file could not be found ...";
return null;
}

@@ -1146,7 +1160,10 @@ private DLCPackageData GetPackageData(bool validate = true)
txtYear.Focus();

if (validate)
{
errorMsg = "Invalid Year ...";
return null;
}
}

int tempo;
@@ -1155,7 +1172,10 @@ private DLCPackageData GetPackageData(bool validate = true)
txtTempo.Focus();

if (validate)
{
errorMsg = "Invalid AverageTempo ...";
return null;
}
}

var arrangements = lstArrangements.Items.OfType<Arrangement>().ToList();
@@ -1677,9 +1697,10 @@ private void btnPackageGenerate_Click(object sender, EventArgs e)

public DLCPackageData PackageGenerate()
{
var packageData = GetPackageData();
var packageDataError = String.Empty;
var packageData = GetPackageData(true, out packageDataError);
if (packageData == null)
throw new InvalidDataException("<ERROR> DLCPackageData is null ...");
throw new InvalidDataException("<ERROR> DLCPackageData is null, " + packageDataError + Environment.NewLine + Environment.NewLine);

var playableArrCount = packageData.Arrangements.Count(arr => arr.ArrangementType == ArrangementType.Guitar || arr.ArrangementType == ArrangementType.Bass);
if (playableArrCount > 5) // may crash RS14R
@@ -2127,7 +2148,8 @@ private void GameVersion_MouseUp(object sender, MouseEventArgs e)
// ======== Convert Song2014 XML to Song XML ========
if (!String.IsNullOrEmpty(DLCKey))
{
DLCPackageData packageData = GetPackageData(true);
var packageDataError = String.Empty;
DLCPackageData packageData = GetPackageData(true, out packageDataError);
foreach (var arr in packageData.Arrangements)
{
if (arr.ArrangementType == ArrangementType.Vocal)
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.0")]
[assembly: AssemblyInformationalVersion("bacdb7d3")]
[assembly: AssemblyInformationalVersion("e972ddc7")]
[assembly: AssemblyConfiguration("")]
@@ -1,5 +1,6 @@
Rocksmith Toolkit Release Notes

- added verbose messages to '<ERROR> DLCPackageData is null' exception
- fixed CDLC 2 Tab menu generator
- fixed AlbumArtPath exceptions caused by image file names that have extra underscores '_'
(thanks to cu1t for the contribution and pull request)
@@ -27,5 +27,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.0")]
[assembly: AssemblyInformationalVersion("bacdb7d3")]
[assembly: AssemblyInformationalVersion("e972ddc7")]
[assembly: AssemblyConfiguration("")]
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.0")]
[assembly: AssemblyInformationalVersion("bacdb7d3")]
[assembly: AssemblyInformationalVersion("e972ddc7")]
[assembly: AssemblyConfiguration("")]
@@ -1,3 +1,3 @@
2.9.2.0
bacdb7d3
e972ddc7

0 comments on commit 5b20d98

Please sign in to comment.