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

Commit 00050ed

Browse files
committed
fix main release url, add minimize to taskbar option, update recent list at start, button to open release notes page
1 parent 3cad54d commit 00050ed

File tree

6 files changed

+135
-28
lines changed

6 files changed

+135
-28
lines changed

UnityLauncher/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
</ArrayOfString>
2222
</value>
2323
</setting>
24+
<setting name="minimizeToTaskbar" serializeAs="String">
25+
<value>True</value>
26+
</setting>
2427
</UnityLauncher.Properties.Settings>
2528
</userSettings>
2629
</configuration>

UnityLauncher/Form1.Designer.cs

Lines changed: 56 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityLauncher/Form1.cs

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Linq;
88
using System.Net;
99
using System.Text;
10+
using System.Text.RegularExpressions;
1011
using System.Windows.Forms;
1112

1213
// TODO: FindNearestBestVersion(), so that no need to be exact match
@@ -31,23 +32,28 @@ private void Form1_Load(object sender, EventArgs e)
3132
{
3233
SetStatus("Initializing..");
3334

35+
// check installations folder
3436
var root = GetRootFolder();
35-
3637
if (string.IsNullOrEmpty(root) == true)
3738
{
3839
SetStatus("Missing root folder..");
3940
SetRootFolder();
4041
SetStatus("Ready");
4142
}
4243

43-
// update listbox
44+
// update settings window
45+
chkMinimizeToTaskbar.Checked = Properties.Settings.Default.minimizeToTaskbar;
46+
47+
// update installations folder listbox
4448
lstRootFolders.Items.AddRange(Properties.Settings.Default.rootFolders.Cast<string>().ToArray());
4549

4650
// scan installed unitys, TODO: could cache results, at least fileinfo's
4751
bool foundedUnitys = ScanUnityInstallations();
4852
if (foundedUnitys == false)
4953
{
5054
SetStatus("Error> Did not found any Unity installations, try setting correct root folder..");
55+
UpdateRecentProjectsList();
56+
tabControl1.SelectedIndex = 2; // settings tab
5157
return;
5258
}
5359

@@ -73,7 +79,6 @@ private void Form1_Load(object sender, EventArgs e)
7379

7480
}
7581

76-
// this could be delayed, if it affects unity starting?
7782
UpdateRecentProjectsList();
7883
}
7984

@@ -317,20 +322,8 @@ void LaunchProject(string pathArg = null)
317322
else
318323
{
319324
var yesno = MessageBox.Show("Unity version " + version + " is not installed! Yes = Download, No = Open Webpage", "UnityLauncher", MessageBoxButtons.YesNoCancel);
320-
string url = "";
321325

322-
if (version.Contains("f")) // archived
323-
{
324-
url = "https://unity3d.com/unity/whats-new/unity-" + version.Replace("f1", "");
325-
}
326-
if (version.Contains("p")) // patch version
327-
{
328-
url = "https://unity3d.com/unity/qa/patch-releases/" + version;
329-
}
330-
if (version.Contains("b")) // beta version
331-
{
332-
url = "https://unity3d.com/unity/beta/unity" + version;
333-
}
326+
string url = GetUnityReleaseURL(version);
334327

335328
// download file
336329
if (yesno == DialogResult.Yes)
@@ -496,14 +489,17 @@ void SetStatus(string msg)
496489

497490
private void Form1_Resize(object sender, EventArgs e)
498491
{
499-
if (FormWindowState.Minimized == this.WindowState)
500-
{
501-
notifyIcon.Visible = true;
502-
this.Hide();
503-
}
504-
else if (FormWindowState.Normal == this.WindowState)
492+
if (chkMinimizeToTaskbar.Checked == true)
505493
{
506-
notifyIcon.Visible = false;
494+
if (FormWindowState.Minimized == this.WindowState)
495+
{
496+
notifyIcon.Visible = true;
497+
this.Hide();
498+
}
499+
else if (FormWindowState.Normal == this.WindowState)
500+
{
501+
notifyIcon.Visible = false;
502+
}
507503
}
508504
}
509505

@@ -656,5 +652,44 @@ private void btnExploreUnity_Click(object sender, EventArgs e)
656652
LaunchExplorer(unityPath);
657653
}
658654
}
655+
656+
string GetUnityReleaseURL(string version)
657+
{
658+
string url = "";
659+
if (version.Contains("f")) // archived
660+
{
661+
version = Regex.Replace(version, @"f.", "", RegexOptions.IgnoreCase);
662+
url = "https://unity3d.com/unity/whats-new/unity-" + version;
663+
}
664+
if (version.Contains("p")) // patch version
665+
{
666+
url = "https://unity3d.com/unity/qa/patch-releases/" + version;
667+
}
668+
if (version.Contains("b")) // beta version
669+
{
670+
url = "https://unity3d.com/unity/beta/unity" + version;
671+
}
672+
return url;
673+
}
674+
675+
private void btnOpenReleasePage_Click(object sender, EventArgs e)
676+
{
677+
var selected = gridUnityList.CurrentCell.RowIndex;
678+
if (selected > -1)
679+
{
680+
var version = gridUnityList.Rows[selected].Cells["_unityVersion"].Value.ToString();
681+
var url = GetUnityReleaseURL(version);
682+
if (string.IsNullOrEmpty(url) == false)
683+
{
684+
Process.Start(url);
685+
}
686+
}
687+
}
688+
689+
private void chkMinimizeToTaskbar_CheckedChanged(object sender, EventArgs e)
690+
{
691+
Properties.Settings.Default.minimizeToTaskbar = chkMinimizeToTaskbar.Checked;
692+
Properties.Settings.Default.Save();
693+
}
659694
}
660695
}

UnityLauncher/Form1.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@
123123
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124124
<value>14, 20</value>
125125
</metadata>
126-
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127-
<value>14, 20</value>
128-
</metadata>
129126
<metadata name="_project.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
130127
<value>True</value>
131128
</metadata>
@@ -162,6 +159,9 @@
162159
<metadata name="_unityPath.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
163160
<value>True</value>
164161
</metadata>
162+
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
163+
<value>14, 20</value>
164+
</metadata>
165165
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
166166
<value>111, 20</value>
167167
</metadata>

UnityLauncher/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityLauncher/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
&lt;string&gt;C:\Program Files\&lt;/string&gt;
1212
&lt;/ArrayOfString&gt;</Value>
1313
</Setting>
14+
<Setting Name="minimizeToTaskbar" Type="System.Boolean" Scope="User">
15+
<Value Profile="(Default)">True</Value>
16+
</Setting>
1417
</Settings>
1518
</SettingsFile>

0 commit comments

Comments
 (0)