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

Commit 90e04b7

Browse files
committed
check forward and backslash in project name, fix statuslabel visibility
1 parent e73cb6c commit 90e04b7

File tree

3 files changed

+58
-10
lines changed

3 files changed

+58
-10
lines changed

UnityLauncher/Form1.Designer.cs

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

UnityLauncher/Form1.cs

+30-5
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ void UpdateRecentProjectsList()
248248
var hklm = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
249249
RegistryKey key = hklm.OpenSubKey(@"SOFTWARE\Unity Technologies\Unity Editor 5.x");
250250

251-
//Console.WriteLine(key);
252251
if (key == null)
253252
{
254253
SetStatus("No recent projects list founded");
@@ -261,9 +260,34 @@ void UpdateRecentProjectsList()
261260
{
262261
if (valueName.IndexOf("RecentlyUsedProjectPaths-") == 0)
263262
{
264-
byte[] projectPathBytes = (byte[])key.GetValue(valueName);
265-
string projectPath = Encoding.Default.GetString(projectPathBytes, 0, projectPathBytes.Length - 1);
266-
string projectName = projectPath.Substring(projectPath.LastIndexOf("/") + 1);
263+
string projectPath = "";
264+
// check if binary or not
265+
var valueKind = key.GetValueKind(valueName);
266+
if (valueKind == RegistryValueKind.Binary)
267+
{
268+
byte[] projectPathBytes = (byte[])key.GetValue(valueName);
269+
projectPath = Encoding.Default.GetString(projectPathBytes, 0, projectPathBytes.Length - 1);
270+
}
271+
else // should be string then
272+
{
273+
projectPath = (string)key.GetValue(valueName);
274+
}
275+
276+
string projectName = "";
277+
278+
// get project name from full path
279+
if (projectPath.IndexOf(Path.PathSeparator) > -1)
280+
{
281+
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.PathSeparator) + 1);
282+
}
283+
else if (projectPath.IndexOf(Path.AltDirectorySeparatorChar) > -1)
284+
{
285+
projectName = projectPath.Substring(projectPath.LastIndexOf(Path.AltDirectorySeparatorChar) + 1);
286+
}
287+
else // no path separator founded
288+
{
289+
projectName = projectPath;
290+
}
267291

268292
string csprojFile = Path.Combine(projectPath, projectName + ".csproj");
269293

@@ -314,7 +338,6 @@ void LaunchProject(string projectPath, string version, bool openProject = true)
314338

315339
// check for crashed backup scene first
316340
var cancelLaunch = CheckCrashBackupScene(projectPath);
317-
Console.WriteLine(cancelLaunch);
318341
if (cancelLaunch == true)
319342
{
320343
return;
@@ -1015,5 +1038,7 @@ void DisplayUpgradeDialog(string currentVersion, string projectPath, bool launch
10151038
}
10161039
upgradeDialog.Close();
10171040
}
1041+
1042+
10181043
}
10191044
}

UnityLauncher/Form1.resx

+22-4
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,33 @@
132132
<metadata name="_dateModified.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
133133
<value>True</value>
134134
</metadata>
135+
<metadata name="_project.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
136+
<value>True</value>
137+
</metadata>
138+
<metadata name="_version.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
139+
<value>True</value>
140+
</metadata>
141+
<metadata name="_path.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
142+
<value>True</value>
143+
</metadata>
144+
<metadata name="_dateModified.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
145+
<value>True</value>
146+
</metadata>
135147
<metadata name="_unityVersion.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
136148
<value>True</value>
137149
</metadata>
138150
<metadata name="_unityPath.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
139151
<value>True</value>
140152
</metadata>
153+
<metadata name="_unityVersion.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
154+
<value>True</value>
155+
</metadata>
156+
<metadata name="_unityPath.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
157+
<value>True</value>
158+
</metadata>
159+
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
160+
<value>14, 20</value>
161+
</metadata>
141162
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
142163
<value>111, 20</value>
143164
</metadata>
@@ -1031,10 +1052,7 @@
10311052
</value>
10321053
</data>
10331054
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
1034-
<value>492, 18</value>
1035-
</metadata>
1036-
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
1037-
<value>43</value>
1055+
<value>374, 17</value>
10381056
</metadata>
10391057
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
10401058
<value>

0 commit comments

Comments
 (0)