Skip to content

Commit

Permalink
some misc bug fixed with a few improved.
Browse files Browse the repository at this point in the history
1.bug fix: 'PrepareTemporaryDirectory' and 'PrepareOutputDirectory' try to  change UI elements' properties directly in build thread.
2.bug fix: a key name error in Simplified Chinese translation file.
3.bug fix: multi-line text translation was broken.
4.add a message to build output when caught a exception in build thread.
  • Loading branch information
robin committed May 4, 2020
1 parent 4175621 commit a60b98f
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 193 deletions.
6 changes: 4 additions & 2 deletions LanguageFiles/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,7 @@ String142=ʧ
String143=��ɡ�
String144=���ڼ����ʱĿ¼���趨
String145=���ڼ��ʣ����̿ռ�
String147=���ڼ�����Ŀ¼���趨
String146=���ڼ������ļ���������
String146=���ڼ�����Ŀ¼���趨
String147=���ڼ������ļ���������
String148=ʱ������ֹ��
String149=��
32 changes: 16 additions & 16 deletions TeconMoon's WiiVC Injector/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ private void CancelBuild()

private bool PrepareTemporaryDirectory()
{
TemporaryDirectory.Text = TemporaryDirectory.Text.Trim();
Invoke(new Action(() => { TemporaryDirectory.Text = TemporaryDirectory.Text.Trim(); }));

string tempDir = TemporaryDirectory.Text;

Expand Down Expand Up @@ -2382,7 +2382,7 @@ private bool PrepareTemporaryDirectory()
//
// Restore the default temp dir location on failed.
//
TemporaryDirectory.Text = Path.GetTempPath();
Invoke(new Action(() => { TemporaryDirectory.Text = Path.GetTempPath(); }));
Registry.CurrentUser.CreateSubKey("WiiVCInjector")
.DeleteValue("TemporaryDirectory");

Expand Down Expand Up @@ -2420,8 +2420,9 @@ private bool CheckFreeDiskSpaceForPack()

private bool PrepareOutputDirectory()
{
// Specify Path Variables to be called later
OutputDirectory.Text = OutputDirectory.Text.Trim();
// Specify Path Variables to be called later
Invoke(new Action(() => { OutputDirectory.Text = OutputDirectory.Text.Trim(); }));

if (String.IsNullOrEmpty(OutputDirectory.Text))
{
FolderBrowserDialog OutputFolderSelect = new FolderBrowserDialog();
Expand Down Expand Up @@ -3210,7 +3211,7 @@ private bool BuildPack()
{
BuildStep[] buildSteps = new BuildStep[]
{
new BuildStep
new BuildStep
{
buildAction = PrepareTemporaryDirectory,
description = tr.Tr("Checking temporary directory"),
Expand Down Expand Up @@ -3280,12 +3281,6 @@ private bool BuildPack()

ThrowProcessException = true;
int succeed = 0;
int totalProgress = 0;

foreach (BuildStep buildStep in buildSteps)
{
totalProgress += buildStep.progressWeight;
}

Stopwatch stepStopwatch = new Stopwatch();

Expand Down Expand Up @@ -3320,7 +3315,7 @@ private bool BuildPack()
{
BeginInvoke(ActBuildOutput, new BuildOutputItem()
{
s = buildStatus + tr.Tr("failed.") + "\r\n\r\n",
s = buildStep.description + tr.Tr("failed.") + "\r\n\r\n",
buildOutputType = BuildOutputType.botError,
});
break;
Expand All @@ -3341,6 +3336,12 @@ private bool BuildPack()
catch (Exception ex)
{
Console.Write("buildStep throws an exception: " + ex.Message);
BeginInvoke(ActBuildOutput, new BuildOutputItem()
{
s = buildStep.description + tr.Tr(" terminated unexpectedly: ") + ex.Message + tr.Tr(".") + "\r\n\r\n",
buildOutputType = BuildOutputType.botError,
});

break;
}
}
Expand Down Expand Up @@ -3501,12 +3502,11 @@ private void AutoBuildDragDrop(DragEventArgs e)
String[] files = (String[])e.Data.GetData(DataFormats.FileDrop);
foreach (String s in files)
{
FileAttributes attr = File.GetAttributes(s);

//detect whether its a directory or file
if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
if (Directory.Exists(s))
{
foreach (string file in "*.iso|*.wbfs".Split(',', ';', '|').SelectMany(_ => Directory.EnumerateFiles(s, "*" + _, System.IO.SearchOption.AllDirectories)))
foreach (string file in "*.iso|*.wbfs".Split('|').SelectMany(
pattern => Directory.EnumerateFiles(s, pattern, System.IO.SearchOption.AllDirectories)))
{
Program.AppendAutoBuildList(file);
}
Expand Down
Loading

0 comments on commit a60b98f

Please sign in to comment.