Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d4c83a

Browse files
committed
display error message if install APK fails, add option to capture output from LaunchExe
1 parenta15f48f commit3d4c83a

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ private void ChkGetGitBranchRecursively_CheckedChanged(object sender, RoutedEven
15891589
return;// dont run code on window init
15901590

15911591
Settings.Default.searchGitFolderRecursivly=(bool)chkGetGitBranchRecursively.IsChecked;
1592-
Settings.Default.Save();
1592+
Settings.Default.Save();
15931593
RefreshRecentProjects();
15941594
}
15951595

@@ -3460,12 +3460,25 @@ private void menuInstallLastAPK_Click(object sender, RoutedEventArgs e)
34603460
pars+=$" && adb shell monkey -p{packageName} 1";
34613461
}
34623462

3463-
// TODO start cmd minimized
3464-
Tools.LaunchExe(cmd,pars);
3465-
// get apk name from path
3466-
varapkName=Path.GetFileName(playerPath);
3467-
if(chkStreamerMode.IsChecked==true)apkName=" (hidden in streamermode)";
3468-
SetStatus("Installed APK:"+apkName);
3463+
//Tools.LaunchExe(cmd, pars);
3464+
varprocess=Tools.LaunchExe(cmd,pars,captureOutput:true);
3465+
varoutput=process.StandardOutput.ReadToEnd();
3466+
varerrorOutput=process.StandardError.ReadToEnd().Replace("\r","").Replace("\n","");
3467+
3468+
process.WaitForExit();
3469+
3470+
// Console.WriteLine(output);
3471+
if(!string.IsNullOrEmpty(errorOutput))
3472+
{
3473+
SetStatus("Error installing APK: "+errorOutput);
3474+
}
3475+
else
3476+
{
3477+
// get apk name from path
3478+
varapkName=Path.GetFileName(playerPath);
3479+
if(chkStreamerMode.IsChecked==true)apkName=" (hidden in streamermode)";
3480+
SetStatus("Installed APK:"+apkName);
3481+
}
34693482
}
34703483

34713484
privatevoidtxtWebglPort_TextChanged(objectsender,TextChangedEventArgse)

‎UnityLauncherPro/Tools.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ public static bool LaunchExplorerSelectFile(string fileName)
488488
}
489489

490490
// run any exe, return process
491-
publicstaticProcessLaunchExe(stringpath,stringparam=null)
491+
publicstaticProcessLaunchExe(stringpath,stringparam=null,boolcaptureOutput=false)
492492
{
493493
if(string.IsNullOrEmpty(path))returnnull;
494494

@@ -510,6 +510,12 @@ public static Process LaunchExe(string path, string param = null)
510510
newProcess=newProcess();
511511
newProcess.StartInfo.FileName="\""+path+"\"";
512512
newProcess.StartInfo.Arguments=param;
513+
if(captureOutput)
514+
{
515+
newProcess.StartInfo.RedirectStandardError=true;
516+
newProcess.StartInfo.RedirectStandardOutput=true;
517+
newProcess.StartInfo.UseShellExecute=false;
518+
}
513519
newProcess.EnableRaisingEvents=true;// needed to get Exited event
514520
newProcess.Start();
515521
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp