Skip to content

Commit

Permalink
- fixed packer/unpacker PromptComplete now comes to front
Browse files Browse the repository at this point in the history
  • Loading branch information
cozy1 committed Dec 1, 2019
1 parent 9e2420b commit e9757e8
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 28 deletions.
22 changes: 12 additions & 10 deletions RocksmithTookitGUI/DLCPackageCreator/DLCPackageCreator.cs
Expand Up @@ -612,9 +612,9 @@ public string SaveTemplateFile(string templateDir = "", bool validate = true)
IsDirty = false;
}
}
catch
catch (Exception ex)
{
// DO NOTHING //
throw new Exception("<ERROR> SaveTemplateFile Failed ..." + Environment.NewLine + ex.Message);
}

// Re-Absolutize the paths
Expand Down Expand Up @@ -2412,11 +2412,9 @@ private void ProcessCompleted(object sender, RunWorkerCompletedEventArgs e)

message += String.Format("{0}Would you like to open the folder where the package was generated?{0}", Environment.NewLine);
if (MessageBox.Show(message, MESSAGEBOX_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
Process.Start(Path.GetDirectoryName(DestPath));
}
break;

break;
case "error":
var message2 = String.Format("Package generation {2} failed. See below: {0}{1}{0}", Environment.NewLine, errorsFound, ToolkitVersion.RSTKGuiVersion);
MessageBox.Show(message2, MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
Expand Down Expand Up @@ -2603,10 +2601,16 @@ private void btnAudio_Click(object sender, EventArgs e)
/// </summary>
private void btnDevUse_Click(object sender, EventArgs e)
{
PackageRating = "4";
return;
//PackageRating = "4";
//return;

//IOExtension.DeleteDirectory(null);

IOExtension.DeleteDirectory(null);
var l = DateTime.Parse("2019/10/22").Ticks;
var dateTime = new DateTime(l);
var degugMe = Application.LocalUserAppDataPath;

This comment has been minimized.

Copy link
@L0FKA

L0FKA Dec 6, 2019

Member

debugging this sill? :)


return;

string srcPath;
string destPath;
Expand Down Expand Up @@ -2638,8 +2642,6 @@ private void btnDevUse_Click(object sender, EventArgs e)

var recycleDir = Packer.RecycleUnpackedDir(unpackedDir);
var recycleFolder = Packer.RecycleUnpackedDir(unpackedFolder);


}

private void btnTemplateSave_Click(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions RocksmithTookitGUI/DLCPackerUnpacker/DLCPackerUnpacker.cs
Expand Up @@ -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();
Expand Down Expand Up @@ -124,7 +124,7 @@ private void PromptComplete(string destDirPath, bool actionPacking = true, strin

errMsg += "Would you like to open the destination path? ";

if (MessageBox.Show(new Form { TopMost = true }, errMsg, MESSAGEBOX_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
if (MessageBox.Show(errMsg, MESSAGEBOX_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
Process.Start(destDirPath);
}

Expand Down
10 changes: 7 additions & 3 deletions RocksmithTookitGUI/Program.cs
Expand Up @@ -92,7 +92,9 @@ static void Main(string[] args)
var exception = e.ExceptionObject as Exception;
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)
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)
{
Process.Start(logPath);
}
Expand All @@ -113,13 +115,15 @@ static void Main(string[] args)
if (exception.Message != null && exception.Message.Contains("expired"))
{
MessageBox.Show(String.Format("Activation.ThreadException:\n\n{0}", exception.Message), "Please Read This Important Message Completely ...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show(String.Format("Activation.ThreadException:\n\n{0}", exception.Message),
"Please Read This Important Message Completely ...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Application.Exit();
}
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\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)
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);
}
Expand Down
4 changes: 2 additions & 2 deletions RocksmithTookitGUI/Properties/AssemblyInfo.cs
Expand Up @@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
[assembly: AssemblyInformationalVersion("9e2420bb")]
[assembly: AssemblyConfiguration("2019-11-30T19:10:24")]
1 change: 1 addition & 0 deletions RocksmithTookitGUI/ReleaseNotes.txt
@@ -1,5 +1,6 @@
Rocksmith Toolkit Release Notes

- fixed packer/unpacker PromptComplete now comes to front
- autoconvert old template relative path format to the new format
- added additional exception handling for corrupt '*.dlc.xml' templates
- fixed LoadFromFolder custom font handling
Expand Down
19 changes: 16 additions & 3 deletions RocksmithToolkitLib/DLCPackage/Packer.cs
Expand Up @@ -186,6 +186,9 @@ public static string Unpack(string srcPath, string destDirPath, Platform overrid

foreach (var sngFile in sngFiles)
{
// prevent ContextSwitchDeadlock exceptions in long processes
Application.DoEvents();

var xmlEofFile = Path.Combine(Path.GetDirectoryName(sngFile), String.Format("{0}.xml", Path.GetFileNameWithoutExtension(sngFile)));
xmlEofFile = xmlEofFile.Replace(String.Format("bin{0}{1}", Path.DirectorySeparatorChar, srcPlatform.GetPathName()[1].ToLower()), "arr");
var xmlSngFile = xmlEofFile.Replace(".xml", ".sng.xml");
Expand Down Expand Up @@ -693,6 +696,9 @@ private static string ExtractPSARC(string srcPath, string destPath, Stream input
// InflateEntries - compatible with RS1 and RS2014 files
foreach (var entry in psarc.TOC)
{
// prevent ContextSwitchDeadlock exceptions in long processes
Application.DoEvents();

// remove invalid characters from entry.Name so CDLC can be unpacked
var validEntryName = entry.Name.Replace("?", "~");
var inputPath = Path.Combine(destPath, validEntryName);
Expand All @@ -706,9 +712,6 @@ private static string ExtractPSARC(string srcPath, string destPath, Stream input
else
{
Directory.CreateDirectory(Path.GetDirectoryName(inputPath));
if (entry.Name.Contains("man_lead.xml"))
Debug.WriteLine("Found it.");

psarc.InflateEntry(entry, inputPath);
// Close
if (entry.Data != null)
Expand Down Expand Up @@ -1184,6 +1187,10 @@ public static string GetUnpackedDir(string srcPath, string destPath, Platform ta
}
}

// system archive file handling
if (fnameWithoutExt.EndsWith(".psarc"))
fnameWithoutExt = fnameWithoutExt.Replace(".psarc", "_psarc");

var unpackedDir = String.Format("{0}_{1}", fnameWithoutExt, targetPlatform);

if (!String.IsNullOrEmpty(destPath))
Expand Down Expand Up @@ -1266,6 +1273,10 @@ public static string RecycleUnpackedDir(string srcPath)
}
}

// special handling of system archive files
if (srcPath.Contains("_psarc"))
fileExtension = ".psarc";

versionPlatformExtension.Add(versionPlatform, fileExtension);
}
}
Expand All @@ -1277,6 +1288,8 @@ public static string RecycleUnpackedDir(string srcPath)
{
var vpIndex = srcPath.LastIndexOf(item.Key, StringComparison.Ordinal);
var pathWoVP = srcPath.Substring(0, vpIndex);
// special handling of system archives
pathWoVP = pathWoVP.Replace("_psarc", "");
destPath = String.Format("{0}{1}", pathWoVP, item.Value);
break;
}
Expand Down
13 changes: 13 additions & 0 deletions RocksmithToolkitLib/Extensions/StringExtensions.cs
Expand Up @@ -729,6 +729,19 @@ public static string SplitString(string inputText, int lineLength, bool splitOnS
return finalString;
}

/// <summary>
/// Split contiguous string on caps and insert spaces
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static string SplitCamelCase(string source)
{
string[] resultArray = Regex.Split(source, @"(?<!^)(?=[A-Z])");
var result = String.Join(" ", resultArray).Trim();

return result;
}

#endregion
}
}
5 changes: 3 additions & 2 deletions RocksmithToolkitLib/Platform.cs
Expand Up @@ -8,7 +8,7 @@ namespace RocksmithToolkitLib
{
public enum GamePlatform { Pc, Mac, XBox360, PS3, None };
public enum GameVersion { RS2012, RS2014, None };

public class Platform
{
public GamePlatform platform { get; set; }
Expand Down Expand Up @@ -40,7 +40,8 @@ public override int GetHashCode()

public EndianBitConverter GetBitConverter
{
get{
get
{
switch (platform)
{
case GamePlatform.Pc:
Expand Down
4 changes: 2 additions & 2 deletions RocksmithToolkitLib/Properties/AssemblyInfo.cs
Expand Up @@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
[assembly: AssemblyInformationalVersion("9e2420bb")]
[assembly: AssemblyConfiguration("2019-11-30T19:10:24")]
4 changes: 2 additions & 2 deletions RocksmithToolkitUpdater/Properties/AssemblyInfo.cs
Expand Up @@ -29,5 +29,5 @@
//
// THESE VALUES ARE PROGRAMMATICALLY GENERATED - DO NOT EDIT
[assembly: AssemblyVersion("2.9.2.1")]
[assembly: AssemblyInformationalVersion("fa63cc4e")]
[assembly: AssemblyConfiguration("2019-11-15T14:17:05")]
[assembly: AssemblyInformationalVersion("9e2420bb")]
[assembly: AssemblyConfiguration("2019-11-30T19:10:24")]
4 changes: 2 additions & 2 deletions VersionInfo.txt
@@ -1,3 +1,3 @@
2.9.2.1
fa63cc4e
2019-11-15T14:17:05
9e2420bb
2019-11-30T19:10:24

0 comments on commit e9757e8

Please sign in to comment.