Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit 5e08a5b

Browse files
committed
add enter and esc keys to upgrade dialog #fixes 80, fix release note urls fixes #73, if no matching upgrade version set first row selected, fix HaveExactVersionInstalled (returned true for null version), download missing version button now shows version number in target url, fix missing statuslabel, add button to launch adb logcat fixes #62, release 28
1 parent 42f645a commit 5e08a5b

File tree

4 files changed

+95
-46
lines changed

4 files changed

+95
-46
lines changed

Diff for: UnityLauncher/Form1.Designer.cs

+31-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: UnityLauncher/Form1.cs

+30-19
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,7 @@ void LoadSettings()
184184
/// <returns></returns>
185185
bool HaveExactVersionInstalled(string version)
186186
{
187-
//Console.WriteLine("checking: '" + version + "'");
188-
var installedExact = unityList.ContainsKey(version);
189-
//Console.WriteLine("have exact:" + installedExact);
190-
return installedExact;
187+
return string.IsNullOrEmpty(version) == false && unityList.ContainsKey(version);
191188
}
192189

193190

@@ -545,7 +542,6 @@ string GetDownloadUrlForUnityVersion(string releaseUrl)
545542
if (match.Success == true)
546543
{
547544
url = match.Groups[0].Captures[0].Value;
548-
// Console.WriteLine(url);
549545
}
550546
else
551547
{
@@ -559,7 +555,7 @@ string GetDownloadUrlForUnityVersion(string releaseUrl)
559555
/// launches browser to download installer
560556
/// </summary>
561557
/// <param name="url">full url to installer</param>
562-
void DownloadInBrowser(string url)
558+
void DownloadInBrowser(string url, string version)
563559
{
564560
string exeURL = GetDownloadUrlForUnityVersion(url);
565561
if (string.IsNullOrEmpty(exeURL) == false)
@@ -571,7 +567,7 @@ void DownloadInBrowser(string url)
571567
{
572568
SetStatus("Error> Cannot find installer executable ... opening website instead");
573569
url = "https://unity3d.com/get-unity/download/archive";
574-
Process.Start(url + "#installer-exe-not-found");
570+
Process.Start(url + "#installer-not-found---version-" + version);
575571
}
576572
}
577573

@@ -584,7 +580,7 @@ string[] GetUnityInstallationsRootFolder()
584580
string[] rootFolders = null;
585581
try
586582
{
587-
// if settings exists, use that
583+
// if settings exists, use that value
588584
rootFolders = new string[Properties.Settings.Default.rootFolders.Count];
589585
Properties.Settings.Default.rootFolders.CopyTo(rootFolders, 0);
590586
}
@@ -622,6 +618,7 @@ void LaunchSelectedProject(bool openProject = true)
622618
{
623619
var projectPath = gridRecent.Rows[(int)selected].Cells["_path"].Value.ToString();
624620
var version = Tools.GetProjectVersion(projectPath);
621+
Console.WriteLine("version: '" + version + "'");
625622
LaunchProject(projectPath, version, openProject);
626623
SetStatus("Ready");
627624
}
@@ -631,7 +628,7 @@ void LaunchSelectedProject(bool openProject = true)
631628

632629
void LaunchSelectedUnity()
633630
{
634-
631+
635632
var selected = gridUnityList?.CurrentCell?.RowIndex;
636633
if (selected.HasValue && selected > -1)
637634
{
@@ -719,7 +716,7 @@ private void btnLaunchUnity_Click(object sender, EventArgs e)
719716

720717
private void btnExploreUnity_Click(object sender, EventArgs e)
721718
{
722-
719+
723720
var selected = gridUnityList?.CurrentCell?.RowIndex;
724721
if (selected.HasValue && selected > -1)
725722
{
@@ -1141,7 +1138,7 @@ void DisplayUpgradeDialog(string currentVersion, string projectPath, bool launch
11411138
string url = Tools.GetUnityReleaseURL(currentVersion);
11421139
if (string.IsNullOrEmpty(url) == false)
11431140
{
1144-
DownloadInBrowser(url);
1141+
DownloadInBrowser(url, currentVersion);
11451142
}
11461143
else
11471144
{
@@ -1218,31 +1215,27 @@ void BrowseForExistingProjectFolder()
12181215
folderBrowserDialog1.Description = "Select existing project folder";
12191216
var d = folderBrowserDialog1.ShowDialog();
12201217
var projectPath = folderBrowserDialog1.SelectedPath;
1218+
1219+
// NOTE: if user didnt click enter or deselect-select newly created folder, this fails as it returns "new folder" instead of actual name
1220+
// https://social.msdn.microsoft.com/Forums/vstudio/en-US/cc7f1d54-c1a0-45de-9611-7f69873f32df/folderbrowserdialog-bug-when-click-ok-while-modify-new-folders-name?forum=netfxbcl
1221+
12211222
if (String.IsNullOrWhiteSpace(projectPath) == false && Directory.Exists(projectPath) == true)
12221223
{
1223-
12241224
// TODO: remove duplicate code (from UpdateRecentList())
1225-
12261225
string projectName = "";
12271226

1228-
Console.WriteLine(Path.DirectorySeparatorChar);
1229-
Console.WriteLine(Path.AltDirectorySeparatorChar);
1230-
12311227
// get project name from full path
12321228
if (projectPath.IndexOf(Path.DirectorySeparatorChar) > -1)
12331229
{
12341230
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.DirectorySeparatorChar) + 1);
1235-
Console.WriteLine("1");
12361231
}
12371232
else if (projectPath.IndexOf(Path.AltDirectorySeparatorChar) > -1)
12381233
{
12391234
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.AltDirectorySeparatorChar) + 1);
1240-
Console.WriteLine("2");
12411235
}
12421236
else // no path separator found
12431237
{
12441238
projectName = projectPath;
1245-
Console.WriteLine("3");
12461239
}
12471240

12481241
string csprojFile = Path.Combine(projectPath, projectName + ".csproj");
@@ -1332,5 +1325,23 @@ void FixSelectedRow()
13321325
}
13331326
}
13341327

1328+
private void btnOpenLogcatCmd_Click(object sender, EventArgs e)
1329+
{
1330+
try
1331+
{
1332+
Process myProcess = new Process();
1333+
var cmd = "cmd.exe";
1334+
myProcess.StartInfo.FileName = cmd;
1335+
// NOTE windows 10 cmd line supports ansi colors, otherwise remove -v color
1336+
var pars = " /c adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG -v color";
1337+
myProcess.StartInfo.Arguments = pars;
1338+
myProcess.Start();
1339+
}
1340+
catch (Exception ex)
1341+
{
1342+
Console.WriteLine(ex);
1343+
}
1344+
}
1345+
13351346
} // class Form
13361347
} // namespace

Diff for: UnityLauncher/Form2.Designer.cs

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)