Skip to content
Permalink
Browse files

- autoconvert old template relative path format to the new format

- added additional exception handling for corrupt '*.dlc.xml' templates
  • Loading branch information
cozy1 committed Nov 15, 2019
1 parent fa63cc4 commit 9e2420bb6bf778a12ed2903c71f79c1e2ea4df68

Large diffs are not rendered by default.

@@ -121,16 +121,17 @@
<value>17, 17</value>
</metadata>
<data name="ddc_autogen.ToolTip" xml:space="preserve">
<value>NOTE: The checkbox action was recently changed!
<value>Developer Use Only
Force generation of DDC for RS 2014 Remastered

If checked, DD will be automatically added to any
When checked, DD will be automatically added to any
arrangement that does not have DDC. CDLC author's
existing DDC is not be overwritten.
existing custom DDC are never overwritten.

All CDLC arrangements must have DDC for Rocksmith
2014 Remastered Play Count to function properly.

If you wish to overwrite existing DDC you must first
If you wish to overwrite existing DDC, you must first
remove the existing DDC from the CDLC. DDC may be
removed/added using the main DDC tab menu feature.</value>
</data>
@@ -426,9 +426,9 @@ public Arrangement GenMetronomeArr(Arrangement arr)
public void LoadTemplateFile(string templatePath)
{
// Make the paths relative
var BasePath = Path.GetDirectoryName(templatePath);
var basePath = Path.GetDirectoryName(templatePath);
if (String.IsNullOrEmpty(UnpackedDir))
UnpackedDir = BasePath;
UnpackedDir = basePath;

DLCPackageData info = null;

@@ -463,7 +463,7 @@ public void LoadTemplateFile(string templatePath)
foreach (var arr in info.Arrangements)
{
// load xml comments
arr.XmlComments = Song2014.ReadXmlComments(Path.Combine(BasePath, arr.SongXml.File));
arr.XmlComments = Song2014.ReadXmlComments(Path.Combine(basePath, arr.SongXml.File));

// apply bassfix to template info in case arrangement was changed in EOF
if (arr.ArrangementType == ArrangementType.Bass)
@@ -489,7 +489,7 @@ public void LoadTemplateFile(string templatePath)
// Fix Low Bass Tuning
if (bassFix && TuningFrequency.ApplyBassFix(arr, fixLowBass))
{
arr.TuningStrings = Song2014.LoadFromFile(Path.Combine(BasePath, arr.SongXml.File)).Tuning;
arr.TuningStrings = Song2014.LoadFromFile(Path.Combine(basePath, arr.SongXml.File)).Tuning;
arr.TuningPitch = 220.00;
arr.Tuning = TuningDefinitionRepository.Instance.Detect(arr.TuningStrings, GameVersion.RS2014, false).UIName;

@@ -501,7 +501,17 @@ public void LoadTemplateFile(string templatePath)
}
}

FillPackageCreatorForm(info, templatePath);
try
{
FillPackageCreatorForm(info, templatePath);
}
catch (Exception ex)
{
throw new Exception("<ERROR> LoadTemplateFile Failed, Corrupt Template ..." + Environment.NewLine +
Path.GetFileName(templatePath) + Environment.NewLine + Environment.NewLine +
"Delete this template, and manually load the project files." + Environment.NewLine +
ex.Message);
}

// RS2014 ONLY FIELDS
chkPlatformMAC.Enabled = CurrentGameVersion != GameVersion.RS2012;
@@ -570,27 +580,27 @@ public string SaveTemplateFile(string templateDir = "", bool validate = true)
}

// Make the paths relative
var BasePath = Path.GetDirectoryName(templatePath);
var basePath = Path.GetDirectoryName(templatePath);
if (String.IsNullOrEmpty(UnpackedDir))
UnpackedDir = BasePath;
UnpackedDir = basePath;

if (!String.IsNullOrEmpty(packageData.OggPath))
packageData.OggPath = packageData.OggPath.RelativeTo(BasePath);
packageData.OggPath = packageData.OggPath.RelativeTo(basePath);
if (!String.IsNullOrEmpty(packageData.OggPreviewPath))
packageData.OggPreviewPath = packageData.OggPreviewPath.RelativeTo(BasePath);
packageData.OggPreviewPath = packageData.OggPreviewPath.RelativeTo(basePath);
if (!string.IsNullOrEmpty(packageData.AlbumArtPath))
packageData.AlbumArtPath = packageData.AlbumArtPath.RelativeTo(BasePath);
packageData.AlbumArtPath = packageData.AlbumArtPath.RelativeTo(basePath);

foreach (var arr in packageData.Arrangements)
{
if (String.IsNullOrEmpty(arr.SongXml.File))
continue;
arr.SongXml.File = arr.SongXml.File.RelativeTo(BasePath);
arr.SongXml.File = arr.SongXml.File.RelativeTo(basePath);
arr.SongFile.File = "";
if (!String.IsNullOrEmpty(arr.LyricsArtPath))
arr.LyricsArtPath = arr.LyricsArtPath.RelativeTo(BasePath);
arr.LyricsArtPath = arr.LyricsArtPath.RelativeTo(basePath);
if (!String.IsNullOrEmpty(arr.GlyphsXmlPath))
arr.GlyphsXmlPath = arr.GlyphsXmlPath.RelativeTo(BasePath);
arr.GlyphsXmlPath = arr.GlyphsXmlPath.RelativeTo(basePath);
}

try
@@ -609,20 +619,20 @@ public string SaveTemplateFile(string templateDir = "", bool validate = true)

// Re-Absolutize the paths
if (!String.IsNullOrEmpty(packageData.OggPath))
packageData.OggPath = packageData.OggPath.AbsoluteTo(BasePath);
packageData.OggPath = packageData.OggPath.AbsoluteTo(basePath);
if (!String.IsNullOrEmpty(packageData.OggPreviewPath))
packageData.OggPreviewPath = packageData.OggPreviewPath.AbsoluteTo(BasePath);
packageData.OggPreviewPath = packageData.OggPreviewPath.AbsoluteTo(basePath);
if (!string.IsNullOrEmpty(packageData.AlbumArtPath))
packageData.AlbumArtPath = packageData.AlbumArtPath.AbsoluteTo(BasePath);
packageData.AlbumArtPath = packageData.AlbumArtPath.AbsoluteTo(basePath);

foreach (var arr in packageData.Arrangements)
{
if (!String.IsNullOrEmpty(arr.SongXml.File))
arr.SongXml.File = arr.SongXml.File.AbsoluteTo(BasePath);
arr.SongXml.File = arr.SongXml.File.AbsoluteTo(basePath);
if (!String.IsNullOrEmpty(arr.LyricsArtPath))
arr.LyricsArtPath = arr.LyricsArtPath.AbsoluteTo(BasePath);
arr.LyricsArtPath = arr.LyricsArtPath.AbsoluteTo(basePath);
if (!String.IsNullOrEmpty(arr.GlyphsXmlPath))
arr.GlyphsXmlPath = arr.GlyphsXmlPath.AbsoluteTo(BasePath);
arr.GlyphsXmlPath = arr.GlyphsXmlPath.AbsoluteTo(basePath);
}

if (String.IsNullOrEmpty(templateDir)) //if in GUI mode.
@@ -894,7 +904,7 @@ public void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir)
break;
}

var BasePath = Path.GetDirectoryName(filesBaseDir);
var basePath = Path.GetDirectoryName(filesBaseDir);

// Song INFO
txtDlcKey.Text = info.Name;
@@ -950,13 +960,19 @@ public void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir)
// AlbumArtPath from template RelativeTo path must be re-converted AbsoluteTo path
if (!String.IsNullOrEmpty(info.AlbumArtPath))
{
AlbumArtPath = info.AlbumArtPath.AbsoluteTo(BasePath);
// remove old template relative path identifiers
info.AlbumArtPath = info.AlbumArtPath.Replace(@"..\..\", "").Replace(@"..\", "");
AlbumArtPath = info.AlbumArtPath.AbsoluteTo(basePath);
info.ArtFiles = null; // force ArtFiles array to be generated from the AlbumArtPath
}

// OggPath from template RelativeTo path must be re-converted AbsoluteTo path
// OggPath/WemPath from template RelativeTo path must be re-converted AbsoluteTo path
if (!String.IsNullOrEmpty(info.OggPath))
AudioPath = info.OggPath.AbsoluteTo(BasePath);
{
// remove old template relative path identifiers
info.OggPath = info.OggPath.Replace(@"..\", "");
AudioPath = info.OggPath.AbsoluteTo(basePath);
}

numVolSong.Value = Decimal.Round((decimal)info.Volume, 2);
numVolPreview.Value = info.PreviewVolume != null ? Decimal.Round((decimal)info.PreviewVolume, 2) : numVolSong.Value;
@@ -970,13 +986,15 @@ public void FillPackageCreatorForm(DLCPackageData info, string filesBaseDir)
for (int i = 0; i < info.Arrangements.Count; i++)
{
var arrangement = info.Arrangements[i];

// remove old template relative path identifiers
arrangement.SongXml.File = arrangement.SongXml.File.Replace(@"..\..\", "").Replace(@"..\", "");
// Template RelativeTo paths must be re-converted AbsoluteTo paths
arrangement.SongXml.File = arrangement.SongXml.File.AbsoluteTo(BasePath);
arrangement.SongXml.File = arrangement.SongXml.File.AbsoluteTo(basePath);

if (!String.IsNullOrEmpty(arrangement.LyricsArtPath))
arrangement.LyricsArtPath = arrangement.LyricsArtPath.AbsoluteTo(BasePath);
arrangement.LyricsArtPath = arrangement.LyricsArtPath.AbsoluteTo(basePath);
if (!String.IsNullOrEmpty(arrangement.GlyphsXmlPath))
arrangement.GlyphsXmlPath = arrangement.GlyphsXmlPath.AbsoluteTo(BasePath);
arrangement.GlyphsXmlPath = arrangement.GlyphsXmlPath.AbsoluteTo(basePath);

arrangement.ClearCache();

@@ -1772,12 +1790,12 @@ public DLCPackageData PackageGenerate()
}

// TODO: monitor this change
var invalidRepresent = packageData.Arrangements.Any(ar => ar.Represent && ar.BonusArr);
var hasRepresent = packageData.Arrangements.Any(ar => ar.Represent == true);
var invalidRepresent = packageData.Arrangements.Any(arr => arr.Represent && arr.BonusArr);
var hasRepresent = packageData.Arrangements.Any(arr => arr.Represent == true);

if (invalidRepresent && !hasRepresent)
{
var diaMsg = "Invalid Arrangement Default/Bonus/Alternate Conditon ..." + Environment.NewLine + Environment.NewLine +
var diaMsg = "Invalid Arrangement Default/Bonus/Alternate Represent Condition" + Environment.NewLine + Environment.NewLine +
"Reauthor using EOF, or open each arrangement seperately" + Environment.NewLine +
"using toolkit Edit Arrangement and make necessary changes. ";
if (DialogResult.No == BetterDialog2.ShowDialog(diaMsg, "<WARNING> Arrangement Represent", null, "Ignore", "Abort", Bitmap.FromHicon(SystemIcons.Warning.Handle), "Warning", 150, 150))

Some generated files are not rendered by default. Learn more.

@@ -23,7 +23,7 @@
namespace RocksmithToolkitGUI.DLCPackerUnpacker
{
public partial class DLCPackerUnpacker : UserControl
{
{
private const string MESSAGEBOX_CAPTION = "CDLC Packer/Unpacker";
private const string TKI_APPID = "(AppID by Packer/Unpacker)";
private BackgroundWorker bwRepack = new BackgroundWorker();
@@ -682,7 +682,7 @@ public string PackSong(string srcPath, string destPath)
{
Stopwatch sw = new Stopwatch();
sw.Restart();
archivePath = Packer.Pack(srcPath, destPath, updateSng:UpdateSng, updateManifest:UpdateManifest);
archivePath = Packer.Pack(srcPath, destPath, updateSng: UpdateSng, updateManifest: UpdateManifest);
sw.Stop();
GlobalExtension.ShowProgress("Finished packing archive (elapsed time): " + sw.Elapsed, 100);
}
@@ -90,7 +90,7 @@ static void Main(string[] args)
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
{
var exception = e.ExceptionObject as Exception;
GlobalsConfig.Log.Error(" - Unhandled.Exception:\nSource: {0}\nTarget: {1}\n{2}", exception.Source, exception.TargetSite, exception.ToString());
GlobalsConfig.Log.Error(" - Unhandled.Exception:\n\nSource: {0}\nTarget: {1}\n{2}", exception.Source, exception.TargetSite, exception.ToString());

if (MessageBox.Show(String.Format("Unhandled.Exception:\n\n{0}\nPlease send us the {1} file if you need help. Open log file now?", exception.Message.ToString(), Path.GetFileName(logPath)), "Please Read This Important Message Completely ...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
@@ -119,7 +119,7 @@ static void Main(string[] args)
else
{
var exMessage = String.IsNullOrEmpty(packerErrMsg) ? exception.Message : String.Format("{0}\nPacker.ThreadException (Corrupt CDLC):\n{1}\n", exception.Message, packerErrMsg.Trim());
if (MessageBox.Show(String.Format("Application.ThreadException:\n{0}\nPlease send us the {1} file if you need help. Open log file now?", exMessage, Path.GetFileName(logPath)), "Please Read This Important Message Completely ...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
if (MessageBox.Show(String.Format("Application.ThreadException:\n\n{0}\n\nPlease send us the {1} file if you need help. Open log file now?", exMessage, Path.GetFileName(logPath)), "Please Read This Important Message Completely ...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
Process.Start(logPath);
}
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("37451264")]
[assembly: AssemblyConfiguration("2019-11-13T14:49:09")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
@@ -1,5 +1,7 @@
Rocksmith Toolkit Release Notes

- autoconvert old template relative path format to the new format
- added additional exception handling for corrupt '*.dlc.xml' templates
- fixed LoadFromFolder custom font handling
- improved arrangement detection/validation
- improvements to Xbox360 GameVersion detection
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("37451264")]
[assembly: AssemblyConfiguration("2019-11-13T14:49:09")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
@@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("37451264")]
[assembly: AssemblyConfiguration("2019-11-13T14:49:09")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
@@ -1,3 +1,3 @@
2.9.2.1
37451264
2019-11-13T14:49:09
fa63cc4e
2019-11-15T14:17:05

0 comments on commit 9e2420b

Please sign in to comment.
You can’t perform that action at this time.