Skip to content

Commit 30872fa

Browse files
committed
Merge branch 'master' into dev
* master: (54 commits) add default unity hub editors installation folder, fixes #112 now can use custom icon (place icon.ico into same folder as exe) fixes #127 Use IPC pipe messages to restore existing tray minimized instance, fixes #67 cancel edit cell if exit unity, fixes #176 update release cache json, #GITBUILD add statusbar messagetypes & colors, show error message if new project root folder is missing (on new project creation) #175 Update README.md #GITBUILD display error message if install APK fails, add option to capture output from LaunchExe handle missing releases, comparing batches to all cached versions (since releases api is not in order) alpha release notes for 2023.3 and later fixes #31 add full installer exe download option to DownloadInBrowser(), add await for extract urls (got stuck otherwise), fix converter issue (in design time), test build without nugets (system.text.json and others) ref #170 Update main.yml test5 #GITBUILD Update main.yml test4 #GITBUILD Update main.yml test3 #GITBUILD Update README.md test2 #GITBUILD Update main.yml test #GITBUILD Update README.md #GITBUILD ...
2 parents d2226d7 + 5a1d062 commit 30872fa

29 files changed

+1527
-524
lines changed

.github/workflows/main.yml

+32-7
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ jobs:
2121
steps:
2222
- name: Check Commit and Install 7Zip PowerShell Module
2323
shell: powershell
24-
2524
run: |
2625
# cancel early, if not build commit
2726
$strVal ='${{ github.event.commits[0].message }}'
28-
if($strVal -clike '*#GITBUILD*')
27+
# Convert commit message to a single line if multiline
28+
$singleLineStrVal = $strVal -replace "`r`n", " " -replace "`n", " "
29+
if($singleLineStrVal -match '#GITBUILD')
2930
{
3031
Write-Host 'True'
3132
} else {
3233
Write-Host 'False'
3334
exit(1)
3435
}
3536
Install-Module 7Zip4PowerShell -Force -Verbose
37+
3638
- uses: actions/checkout@v2
37-
39+
3840
- name: Restore NuGet packages
3941
run: nuget restore UnityLauncherPro.sln
4042

@@ -48,18 +50,42 @@ jobs:
4850

4951
- name: Get current date and time
5052
id: datetime
51-
run: echo "::set-output name=current_datetime::$(date +'%d/%m/%Y %H:%M')"
52-
53+
run: |
54+
echo "current_datetime=$(date +'%d/%m/%Y %H:%M')" >> $GITHUB_ENV
55+
56+
# Step to get previous tag and commits
57+
- name: Get commits since last release
58+
id: get_commits
59+
shell: bash
60+
run: |
61+
# Get the most recent tag
62+
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
63+
if [ "$PREV_TAG" = "none" ]; then
64+
echo "No previous tag found, listing all commits"
65+
COMMITS=$(git log --pretty=format:"* %s" --no-merges)
66+
else
67+
echo "Previous tag: $PREV_TAG"
68+
# List commits since last tag
69+
COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"* %s" --no-merges)
70+
fi
71+
echo "Commits since last release: $COMMITS"
72+
73+
# Save commits to environment file for later use
74+
echo "commits=$COMMITS" >> $GITHUB_ENV
75+
5376
- name: Create Release
5477
id: create_release
5578
uses: actions/create-release@latest
5679
env:
5780
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5881
with:
5982
tag_name: ${{github.run_number}}
60-
release_name: ${{ steps.datetime.outputs.current_datetime }} (${{ github.run_number }})
83+
release_name: ${{ env.current_datetime }} (${{ github.run_number }})
6184
body: |
6285
Automated Release by GitHub Action CI
86+
87+
### Commits in this release:
88+
${{ env.commits }}
6389
draft: false
6490
prerelease: false
6591

@@ -73,4 +99,3 @@ jobs:
7399
asset_path: ./UnityLauncherPro.zip
74100
asset_name: UnityLauncherPro.zip
75101
asset_content_type: application/zip
76-

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,4 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
/Paths.cmd

Build.cmd

+50-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,59 @@
11
@echo off
2+
3+
REM Default VS paths to check if no Paths.cmd file exists
4+
set VISUAL_STUDIO_PATH_0="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
5+
set VISUAL_STUDIO_PATH_1="%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe"
6+
set VISUAL_STUDIO_PATH_2="%programfiles(x86)%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe"
7+
set VISUAL_STUDIO_PATH_3="%programfiles(x86)%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe"
8+
29
pushd "%~dp0"
310
if exist Debug rd /s /q Debug
411
if exist Release rd /s /q Release
512
if exist x64 rd /s /q x64
613

7-
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release
14+
if exist "Paths.cmd" (
15+
REM Prefer Paths.cmd as Visual Studio path source if it exists.
16+
call Paths.cmd
17+
goto build
18+
) else (
19+
REM Otherwise try to auto-detect the Visual Studio path.
20+
if exist %VISUAL_STUDIO_PATH_0% (
21+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_0%
22+
goto build
23+
)
24+
25+
if exist %VISUAL_STUDIO_PATH_1% (
26+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_1%
27+
goto build
28+
)
29+
30+
if exist %VISUAL_STUDIO_PATH_2% (
31+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_2%
32+
goto build
33+
)
34+
35+
if exist %VISUAL_STUDIO_PATH_3% (
36+
set VISUAL_STUDIO_PATH=%VISUAL_STUDIO_PATH_3%
37+
goto build
38+
)
39+
40+
REM No default path found. Let the user know what to do.
41+
echo No Visual Studio installation found. Please configure it manually.
42+
echo 1. Copy 'Paths.cmd.template'.
43+
echo 2. Rename it to 'Paths.cmd'.
44+
echo 3. Enter your Visual Studio path in there.
45+
echo 4. Restart the build.
46+
REM Allow disabling pause to support non-interacting build chains.
47+
if NOT "%~1"=="-no-pause" pause
48+
goto end
49+
)
50+
51+
:build
52+
REM Log the used Vistual Studio version.
53+
@echo on
54+
%VISUAL_STUDIO_PATH% /p:Configuration=Release
55+
@echo off
856

9-
:exit
57+
:end
1058
popd
1159
@echo on

Paths.cmd.template

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
REM Set your Visual Studio path here.
3+
SET VISUAL_STUDIO_PATH="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe"
4+
@echo on

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# UnityLauncherPro
2-
[![Build Status](https://ci.appveyor.com/api/projects/status/hajcaavcsg7904rx?svg=true)](https://github.com/unitycoder/UnityLauncherPro/releases/latest/download/UnityLauncherPro.zip) [![Downloads](https://img.shields.io/github/downloads/unitycoder/unitylauncherpro/total)](https://github.com/unitycoder/UnityLauncherPro/releases/latest/download/UnityLauncherPro.zip) [![GitHub license](https://img.shields.io/github/license/unitycoder/UnityLauncherPro)](https://github.com/unitycoder/UnityLauncherPro/blob/master/LICENSE) [](https://discord.gg/cXT97hU)<a href="https://discord.gg/cXT97hU"><img src="https://img.shields.io/discord/337579253866692608.svg"></a> [![VirusTotal scan now](https://img.shields.io/static/v1?label=VirusTotal&message=Scan)](https://www.virustotal.com/gui/url/e123b616cf4cbe3d3f7ba13b0d88cf5fff4638f72d5b9461088d0b11e9a41de3?nocache=1) [![CodeQL](https://github.com/unitycoder/UnityLauncherPro/actions/workflows/codeql.yml/badge.svg)](https://github.com/unitycoder/UnityLauncherPro/actions/workflows/codeql.yml)
2+
[![Build Status](https://github.com/unitycoder/UnityLauncherPro/actions/workflows/main.yml/badge.svg)](https://github.com/unitycoder/UnityLauncherPro/releases/latest/download/UnityLauncherPro.zip) [![Downloads](https://img.shields.io/github/downloads/unitycoder/unitylauncherpro/total)](https://github.com/unitycoder/UnityLauncherPro/releases/latest/download/UnityLauncherPro.zip) [![GitHub license](https://img.shields.io/github/license/unitycoder/UnityLauncherPro)](https://github.com/unitycoder/UnityLauncherPro/blob/master/LICENSE) [](https://discord.gg/cXT97hU)<a href="https://discord.gg/cXT97hU"><img src="https://img.shields.io/discord/337579253866692608.svg"></a> [![VirusTotal scan now](https://img.shields.io/static/v1?label=VirusTotal&message=Scan)](https://www.virustotal.com/gui/url/e123b616cf4cbe3d3f7ba13b0d88cf5fff4638f72d5b9461088d0b11e9a41de3?nocache=1) [![CodeQL](https://github.com/unitycoder/UnityLauncherPro/actions/workflows/codeql.yml/badge.svg)](https://github.com/unitycoder/UnityLauncherPro/actions/workflows/codeql.yml)
33

44

55
Handle all your Unity versions and Projects easily!

UnityLauncherPro/App.config

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<runtime>
4-
<AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false"/>
4+
<AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false" />
55
</runtime>
66
<configSections>
77
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
8-
<section name="UnityLauncherPro.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
8+
<section name="UnityLauncherPro.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
99
</sectionGroup>
1010
</configSections>
1111
<startup>
12-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
12+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
1313
</startup>
1414
<userSettings>
1515
<UnityLauncherPro.Properties.Settings>
@@ -44,10 +44,10 @@
4444
<value>False</value>
4545
</setting>
4646
<setting name="preferredVersion" serializeAs="String">
47-
<value/>
47+
<value />
4848
</setting>
4949
<setting name="newProjectsRoot" serializeAs="String">
50-
<value/>
50+
<value />
5151
</setting>
5252
<setting name="askNameForQuickProject" serializeAs="String">
5353
<value>True</value>
@@ -62,7 +62,7 @@
6262
<value>False</value>
6363
</setting>
6464
<setting name="webglBuildPath" serializeAs="String">
65-
<value/>
65+
<value />
6666
</setting>
6767
<setting name="useCustomTheme" serializeAs="String">
6868
<value>False</value>
@@ -95,10 +95,10 @@
9595
<value>0</value>
9696
</setting>
9797
<setting name="templatePackagesFolder" serializeAs="String">
98-
<value/>
98+
<value />
9999
</setting>
100100
<setting name="newProjectPlatform" serializeAs="String">
101-
<value/>
101+
<value />
102102
</setting>
103103
<setting name="searchProjectPathAlso" serializeAs="String">
104104
<value>False</value>
@@ -107,7 +107,7 @@
107107
<value>False</value>
108108
</setting>
109109
<setting name="shortcutBatchFileFolder" serializeAs="String">
110-
<value/>
110+
<value />
111111
</setting>
112112
<setting name="rootFolders" serializeAs="Xml">
113113
<value>
@@ -127,7 +127,7 @@
127127
</setting>
128128
<setting name="projectPaths" serializeAs="Xml">
129129
<value>
130-
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
130+
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
131131
</value>
132132
</setting>
133133
<setting name="override40ProjectCount" serializeAs="String">
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
using System;
22
using System.Globalization;
3+
using System.Windows;
34
using System.Windows.Data;
45

56
namespace UnityLauncherPro.Converters
67
{
7-
[ValueConversion(typeof(DateTime), typeof(String))]
8+
[ValueConversion(typeof(DateTime), typeof(string))]
89
public class ReleaseDateConverter : IValueConverter
910
{
1011
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1112
{
12-
if (value == null) return null;
13-
DateTime date = (DateTime)value;
13+
if (value == null || !(value is DateTime date))
14+
{
15+
return DependencyProperty.UnsetValue;
16+
}
1417

15-
// get first part of string until space character (updates only contain mm/dd/yyyy)
16-
string dateStrTrimmed = MainWindow.currentDateFormat;
17-
if (dateStrTrimmed.IndexOf(' ') > -1) dateStrTrimmed = dateStrTrimmed.Split(' ')[0];
18+
// Use a default date format if currentDateFormat is null or empty
19+
string dateStrTrimmed = MainWindow.currentDateFormat ?? "MM/dd/yyyy";
1820

19-
return MainWindow.useHumanFriendlyDateFormat ? Tools.GetElapsedTime(date) : date.ToString(dateStrTrimmed);
21+
// If the format includes time, use only the date portion
22+
if (dateStrTrimmed.Contains(" "))
23+
{
24+
dateStrTrimmed = dateStrTrimmed.Split(' ')[0];
25+
}
26+
27+
// Return a human-friendly format if enabled; otherwise, format based on dateStrTrimmed
28+
return MainWindow.useHumanFriendlyDateFormat
29+
? Tools.GetElapsedTime(date)
30+
: date.ToString(dateStrTrimmed, culture);
2031
}
2132

2233
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
2334
{
24-
// not used ?
25-
return DateTime.ParseExact((string)value, MainWindow.currentDateFormat, culture);
26-
}
35+
if (value == null || string.IsNullOrWhiteSpace(value.ToString()))
36+
{
37+
return DependencyProperty.UnsetValue;
38+
}
2739

40+
// Attempt to parse back to DateTime using the specified format
41+
if (DateTime.TryParseExact((string)value, MainWindow.currentDateFormat ?? "MM/dd/yyyy", culture, DateTimeStyles.None, out DateTime parsedDate))
42+
{
43+
return parsedDate;
44+
}
45+
46+
return DependencyProperty.UnsetValue;
47+
}
2848
}
2949
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace UnityLauncherPro
2+
{
3+
public readonly struct DownloadProgress
4+
{
5+
public long TotalRead { get; }
6+
public long TotalBytes { get; }
7+
8+
public DownloadProgress(long totalRead, long totalBytes)
9+
{
10+
TotalRead = totalRead;
11+
TotalBytes = totalBytes;
12+
}
13+
}
14+
}

UnityLauncherPro/Data/MessageType.cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace UnityLauncherPro.Data
2+
{
3+
public enum MessageType
4+
{
5+
Info,
6+
Warning,
7+
Error
8+
}
9+
}

UnityLauncherPro/Data/UnityVersion.cs

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace UnityLauncherPro
5+
{
6+
public class UnityVersion
7+
{
8+
public string Version { get; set; }
9+
public UnityVersionStream Stream { get; set; }
10+
public DateTime ReleaseDate { get; set; }
11+
12+
public static UnityVersion FromJson(string json)
13+
{
14+
var values = ParseJsonToDictionary(json);
15+
16+
return new UnityVersion
17+
{
18+
Version = values.ContainsKey("version") ? values["version"] : null,
19+
Stream = ParseStream(values.ContainsKey("stream") ? values["stream"] : null),
20+
ReleaseDate = DateTime.TryParse(values.ContainsKey("releaseDate") ? values["releaseDate"] : null, out var date)
21+
? date
22+
: default
23+
};
24+
}
25+
26+
public string ToJson()
27+
{
28+
return $"{{ \"version\": \"{Version}\", \"stream\": \"{Stream}\", \"releaseDate\": \"{ReleaseDate:yyyy-MM-ddTHH:mm:ss}\" }}";
29+
}
30+
31+
private static Dictionary<string, string> ParseJsonToDictionary(string json)
32+
{
33+
var result = new Dictionary<string, string>();
34+
json = json.Trim(new char[] { '{', '}', ' ' });
35+
var keyValuePairs = json.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
36+
37+
foreach (var pair in keyValuePairs)
38+
{
39+
var keyValue = pair.Split(new[] { ':' }, 2);
40+
if (keyValue.Length == 2)
41+
{
42+
var key = keyValue[0].Trim(new char[] { ' ', '"' });
43+
var value = keyValue[1].Trim(new char[] { ' ', '"' });
44+
result[key] = value;
45+
}
46+
}
47+
48+
return result;
49+
}
50+
51+
private static UnityVersionStream ParseStream(string stream)
52+
{
53+
return Enum.TryParse(stream, true, out UnityVersionStream result) ? result : UnityVersionStream.Tech;
54+
}
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
3+
namespace UnityLauncherPro
4+
{
5+
public class UnityVersionResponse
6+
{
7+
public int Offset { get; set; }
8+
public int Limit { get; set; }
9+
public int Total { get; set; }
10+
public List<UnityVersion> Results { get; set; }
11+
}
12+
}

0 commit comments

Comments
 (0)