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

Commit

Permalink
add enter and esc keys to upgrade dialog #fixes 80, fix release note …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
unitycoder committed Apr 26, 2019
1 parent 42f645a commit 5e08a5b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 46 deletions.
48 changes: 31 additions & 17 deletions UnityLauncher/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 30 additions & 19 deletions UnityLauncher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ void LoadSettings()
/// <returns></returns>
bool HaveExactVersionInstalled(string version)
{
//Console.WriteLine("checking: '" + version + "'");
var installedExact = unityList.ContainsKey(version);
//Console.WriteLine("have exact:" + installedExact);
return installedExact;
return string.IsNullOrEmpty(version) == false && unityList.ContainsKey(version);
}


Expand Down Expand Up @@ -545,7 +542,6 @@ string GetDownloadUrlForUnityVersion(string releaseUrl)
if (match.Success == true)
{
url = match.Groups[0].Captures[0].Value;
// Console.WriteLine(url);
}
else
{
Expand All @@ -559,7 +555,7 @@ string GetDownloadUrlForUnityVersion(string releaseUrl)
/// launches browser to download installer
/// </summary>
/// <param name="url">full url to installer</param>
void DownloadInBrowser(string url)
void DownloadInBrowser(string url, string version)
{
string exeURL = GetDownloadUrlForUnityVersion(url);
if (string.IsNullOrEmpty(exeURL) == false)
Expand All @@ -571,7 +567,7 @@ void DownloadInBrowser(string url)
{
SetStatus("Error> Cannot find installer executable ... opening website instead");
url = "https://unity3d.com/get-unity/download/archive";
Process.Start(url + "#installer-exe-not-found");
Process.Start(url + "#installer-not-found---version-" + version);
}
}

Expand All @@ -584,7 +580,7 @@ string[] GetUnityInstallationsRootFolder()
string[] rootFolders = null;
try
{
// if settings exists, use that
// if settings exists, use that value
rootFolders = new string[Properties.Settings.Default.rootFolders.Count];
Properties.Settings.Default.rootFolders.CopyTo(rootFolders, 0);
}
Expand Down Expand Up @@ -622,6 +618,7 @@ void LaunchSelectedProject(bool openProject = true)
{
var projectPath = gridRecent.Rows[(int)selected].Cells["_path"].Value.ToString();
var version = Tools.GetProjectVersion(projectPath);
Console.WriteLine("version: '" + version + "'");
LaunchProject(projectPath, version, openProject);
SetStatus("Ready");
}
Expand All @@ -631,7 +628,7 @@ void LaunchSelectedProject(bool openProject = true)

void LaunchSelectedUnity()
{

var selected = gridUnityList?.CurrentCell?.RowIndex;
if (selected.HasValue && selected > -1)
{
Expand Down Expand Up @@ -719,7 +716,7 @@ private void btnLaunchUnity_Click(object sender, EventArgs e)

private void btnExploreUnity_Click(object sender, EventArgs e)
{

var selected = gridUnityList?.CurrentCell?.RowIndex;
if (selected.HasValue && selected > -1)
{
Expand Down Expand Up @@ -1141,7 +1138,7 @@ void DisplayUpgradeDialog(string currentVersion, string projectPath, bool launch
string url = Tools.GetUnityReleaseURL(currentVersion);
if (string.IsNullOrEmpty(url) == false)
{
DownloadInBrowser(url);
DownloadInBrowser(url, currentVersion);
}
else
{
Expand Down Expand Up @@ -1218,31 +1215,27 @@ void BrowseForExistingProjectFolder()
folderBrowserDialog1.Description = "Select existing project folder";
var d = folderBrowserDialog1.ShowDialog();
var projectPath = folderBrowserDialog1.SelectedPath;

// NOTE: if user didnt click enter or deselect-select newly created folder, this fails as it returns "new folder" instead of actual name
// 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

if (String.IsNullOrWhiteSpace(projectPath) == false && Directory.Exists(projectPath) == true)
{

// TODO: remove duplicate code (from UpdateRecentList())

string projectName = "";

Console.WriteLine(Path.DirectorySeparatorChar);
Console.WriteLine(Path.AltDirectorySeparatorChar);

// get project name from full path
if (projectPath.IndexOf(Path.DirectorySeparatorChar) > -1)
{
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.DirectorySeparatorChar) + 1);
Console.WriteLine("1");
}
else if (projectPath.IndexOf(Path.AltDirectorySeparatorChar) > -1)
{
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.AltDirectorySeparatorChar) + 1);
Console.WriteLine("2");
}
else // no path separator found
{
projectName = projectPath;
Console.WriteLine("3");
}

string csprojFile = Path.Combine(projectPath, projectName + ".csproj");
Expand Down Expand Up @@ -1332,5 +1325,23 @@ void FixSelectedRow()
}
}

private void btnOpenLogcatCmd_Click(object sender, EventArgs e)
{
try
{
Process myProcess = new Process();
var cmd = "cmd.exe";
myProcess.StartInfo.FileName = cmd;
// NOTE windows 10 cmd line supports ansi colors, otherwise remove -v color
var pars = " /c adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG -v color";
myProcess.StartInfo.Arguments = pars;
myProcess.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

} // class Form
} // namespace
1 change: 1 addition & 0 deletions UnityLauncher/Form2.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5e08a5b

Please sign in to comment.