Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit e31a364

Browse files
"set close after project: false" as default, remove update checker and build powershell script, add 2019 to nearest version search
1 parent 30bd916 commit e31a364

File tree

7 files changed

+16
-91
lines changed

7 files changed

+16
-91
lines changed

‎UnityLauncher/App.config‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<value>True</value>
3232
</setting>
3333
<setting name="closeAfterProject" serializeAs="String">
34-
<value>True</value>
34+
<value>False</value>
3535
</setting>
3636
<setting name="formWidth" serializeAs="String">
3737
<value>600</value>

‎UnityLauncher/Form1.Designer.cs‎

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

‎UnityLauncher/Form1.cs‎

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public partial class Form1 : Form
1919
public static Dictionary<string, string> unityList = new Dictionary<string, string>();
2020
const string contextRegRoot = "Software\\Classes\\Directory\\Background\\shell";
2121
const string launcherArgumentsFile = "LauncherArguments.txt";
22-
const string githubReleaseAPICheckURL = "https://api.github.com/repos/unitycoder/unitylauncher/releases/latest";
2322
const string githubReleasesLinkURL = "https://github.com/unitycoder/UnityLauncher/releases";
2423

2524
bool isDownloadingUnityList = false;
@@ -229,8 +228,9 @@ bool ScanUnityInstallations()
229228
if (File.Exists(uninstallExe) == true)
230229
{
231230
var unityExe = Path.Combine(directories[i], "Editor", "Unity.exe");
232-
if (File.Exists(uninstallExe) == true)
231+
if (File.Exists(unityExe) == true)
233232
{
233+
// get full version number from uninstaller
234234
var unityVersion = Tools.GetFileVersionData(uninstallExe).Replace("Unity", "").Trim();
235235
if (unityList.ContainsKey(unityVersion) == false)
236236
{
@@ -246,7 +246,6 @@ bool ScanUnityInstallations()
246246
} // failed check
247247
} // all root folders
248248

249-
250249
lbl_unityCount.Text = "Found " + unityList.Count.ToString() + " versions";
251250

252251
SetStatus("Finished scanning");
@@ -313,7 +312,7 @@ void UpdateRecentProjectsList()
313312
}
314313
else
315314
{
316-
Console.WriteLine("Null registry key at " + registryPathsToCheck[i]);
315+
//Console.WriteLine("Null registry key at " + registryPathsToCheck[i]);
317316
}
318317

319318
// parse recent project path
@@ -1050,7 +1049,7 @@ private void gridRecent_CellEndEdit(object sender, DataGridViewCellEventArgs e)
10501049

10511050
private void btnCheckUpdates_Click(object sender, EventArgs e)
10521051
{
1053-
CheckUpdates();
1052+
Tools.OpenURL("https://github.com/unitycoder/UnityLauncher/releases");
10541053
}
10551054

10561055
private void btnRefreshProjectList_Click(object sender, EventArgs e)
@@ -1196,26 +1195,6 @@ string GetSelectedRowData(string key)
11961195
return path;
11971196
}
11981197

1199-
void CheckUpdates()
1200-
{
1201-
var result = Tools.CheckUpdates(githubReleaseAPICheckURL, previousGitRelease);
1202-
if (string.IsNullOrEmpty(result) == false)
1203-
{
1204-
SetStatus("Update available: " + result + " - Previous release was:" + previousGitRelease);
1205-
DialogResult dialogResult = MessageBox.Show("Update " + result + " is available, open download page?", "UnityLauncher - Check Update", MessageBoxButtons.YesNo);
1206-
if (dialogResult == DialogResult.Yes) // open download page
1207-
{
1208-
Tools.OpenURL(githubReleasesLinkURL);
1209-
}
1210-
}
1211-
else
1212-
{
1213-
SetStatus("No updates available. Current release is " + (float.Parse(previousGitRelease) + 0.01f));
1214-
}
1215-
}
1216-
1217-
1218-
12191198
void BrowseForExistingProjectFolder()
12201199
{
12211200
folderBrowserDialog1.Description = "Select existing project folder";

‎UnityLauncher/Properties/Settings.Designer.cs‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnityLauncher/Properties/Settings.settings‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Value Profile="(Default)">True</Value>
2020
</Setting>
2121
<Setting Name="closeAfterProject" Type="System.Boolean" Scope="User">
22-
<Value Profile="(Default)">True</Value>
22+
<Value Profile="(Default)">False</Value>
2323
</Setting>
2424
<Setting Name="formWidth" Type="System.Int32" Scope="User">
2525
<Value Profile="(Default)">600</Value>

‎UnityLauncher/Tools.cs‎

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ public static string ReadCustomLaunchArguments(string projectPath, string launch
111111
/// <returns></returns>
112112
public static string FindNearestVersion(string currentVersion, List<string> allAvailable)
113113
{
114+
if (currentVersion.Contains("2019"))
115+
{
116+
return FindNearestVersionFromSimilarVersions(currentVersion, allAvailable.Where(x => x.Contains("2019")));
117+
}
114118
if (currentVersion.Contains("2018"))
115119
{
116120
return FindNearestVersionFromSimilarVersions(currentVersion, allAvailable.Where(x => x.Contains("2018")));
@@ -378,62 +382,5 @@ public static bool LaunchExplorer(string folder)
378382
return result;
379383
}
380384

381-
/// <summary>
382-
///
383-
/// </summary>
384-
/// <param name="githubReleaseURL">api to check releases</param>
385-
/// <param name="previousGitRelease">embedded previous release version</param>
386-
/// <returns>null if no info available, otherwise returns current github release number</returns>
387-
public static string CheckUpdates(string githubReleaseURL, string previousGitRelease)
388-
{
389-
string result = null;
390-
using (WebClient client = new WebClient())
391-
{
392-
// apparently this is now required..otherwise: "The request was aborted: Could not create SSL/TLS secure channel"
393-
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
394-
395-
// fetch current release info
396-
client.Headers.Add("user-agent", "MuskBrowser");
397-
string json = client.DownloadString(githubReleaseURL);
398-
399-
if (json.IndexOf('{') != 0)
400-
{
401-
// invalid json
402-
return result;
403-
}
404-
405-
var arr = json.Split(new string[] { "\"tag_name\":" }, StringSplitOptions.None);
406-
407-
// have tagname
408-
if (arr.Length > 1)
409-
{
410-
var arr2 = arr[1].Trim().Split('"');
411-
// have "
412-
if (arr2.Length > 1)
413-
{
414-
var currentlyAvailableLatestReleaseTag = arr2[1];
415-
416-
// compare online version with build in release version, return github version if different from embedded version
417-
float previous = 0;
418-
float current = 0;
419-
if (float.TryParse(previousGitRelease, out previous) == false) return result;
420-
if (float.TryParse(currentlyAvailableLatestReleaseTag, out current) == false) return result;
421-
422-
if (Math.Abs(previous - current) > 0.1f)
423-
{
424-
result = currentlyAvailableLatestReleaseTag;
425-
Console.WriteLine("update available: [" + currentlyAvailableLatestReleaseTag + "] / [" + previousGitRelease + "]");
426-
}
427-
else
428-
{
429-
Console.WriteLine("no update available: [" + currentlyAvailableLatestReleaseTag + "] / [" + previousGitRelease + "]");
430-
}
431-
}
432-
}
433-
}
434-
return result;
435-
}
436-
437-
438385
}
439386
}

‎UnityLauncher/UnityLauncher.csproj‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
</ItemGroup>
133133
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
134134
<PropertyGroup>
135-
<PreBuildEvent>powershell.exe -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;$web = New-Object System.Net.WebClient;$web.Headers['User-Agent'] = 'DefinitelyBrowser';$results = $web.DownloadString('https://api.github.com/repos/unitycoder/unitylauncher/releases/latest');$results = $results | ConvertFrom-Json;$results = $results | select -expand tag_name;echo $results | Out-File \"$(ProjectDir)PreviousVersion.txt\";"</PreBuildEvent>
135+
<PreBuildEvent>
136+
</PreBuildEvent>
136137
</PropertyGroup>
137138
</Project>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /