diff --git a/UnityLauncher/App.config b/UnityLauncher/App.config index d120241..498e2cf 100644 --- a/UnityLauncher/App.config +++ b/UnityLauncher/App.config @@ -31,7 +31,7 @@ True - True + False 600 diff --git a/UnityLauncher/Form1.Designer.cs b/UnityLauncher/Form1.Designer.cs index 4249c40..81c3ce7 100644 --- a/UnityLauncher/Form1.Designer.cs +++ b/UnityLauncher/Form1.Designer.cs @@ -649,11 +649,11 @@ private void InitializeComponent() // btnCheckUpdates // this.btnCheckUpdates.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCheckUpdates.Location = new System.Drawing.Point(434, 495); + this.btnCheckUpdates.Location = new System.Drawing.Point(415, 495); this.btnCheckUpdates.Name = "btnCheckUpdates"; - this.btnCheckUpdates.Size = new System.Drawing.Size(138, 23); + this.btnCheckUpdates.Size = new System.Drawing.Size(157, 23); this.btnCheckUpdates.TabIndex = 40; - this.btnCheckUpdates.Text = "Check for Updates"; + this.btnCheckUpdates.Text = "Open Github Releases Page"; this.btnCheckUpdates.UseVisualStyleBackColor = true; this.btnCheckUpdates.Click += new System.EventHandler(this.btnCheckUpdates_Click); // @@ -904,8 +904,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.statusStrip1.AutoSize = false; this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None; - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1}); this.statusStrip1.Location = new System.Drawing.Point(0, 590); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(579, 22); diff --git a/UnityLauncher/Form1.cs b/UnityLauncher/Form1.cs index b84489a..c211b89 100644 --- a/UnityLauncher/Form1.cs +++ b/UnityLauncher/Form1.cs @@ -19,7 +19,6 @@ public partial class Form1 : Form public static Dictionary unityList = new Dictionary(); const string contextRegRoot = "Software\\Classes\\Directory\\Background\\shell"; const string launcherArgumentsFile = "LauncherArguments.txt"; - const string githubReleaseAPICheckURL = "https://api.github.com/repos/unitycoder/unitylauncher/releases/latest"; const string githubReleasesLinkURL = "https://github.com/unitycoder/UnityLauncher/releases"; bool isDownloadingUnityList = false; @@ -229,8 +228,9 @@ bool ScanUnityInstallations() if (File.Exists(uninstallExe) == true) { var unityExe = Path.Combine(directories[i], "Editor", "Unity.exe"); - if (File.Exists(uninstallExe) == true) + if (File.Exists(unityExe) == true) { + // get full version number from uninstaller var unityVersion = Tools.GetFileVersionData(uninstallExe).Replace("Unity", "").Trim(); if (unityList.ContainsKey(unityVersion) == false) { @@ -246,7 +246,6 @@ bool ScanUnityInstallations() } // failed check } // all root folders - lbl_unityCount.Text = "Found " + unityList.Count.ToString() + " versions"; SetStatus("Finished scanning"); @@ -313,7 +312,7 @@ void UpdateRecentProjectsList() } else { - Console.WriteLine("Null registry key at " + registryPathsToCheck[i]); + //Console.WriteLine("Null registry key at " + registryPathsToCheck[i]); } // parse recent project path @@ -1050,7 +1049,7 @@ private void gridRecent_CellEndEdit(object sender, DataGridViewCellEventArgs e) private void btnCheckUpdates_Click(object sender, EventArgs e) { - CheckUpdates(); + Tools.OpenURL("https://github.com/unitycoder/UnityLauncher/releases"); } private void btnRefreshProjectList_Click(object sender, EventArgs e) @@ -1196,26 +1195,6 @@ string GetSelectedRowData(string key) return path; } - void CheckUpdates() - { - var result = Tools.CheckUpdates(githubReleaseAPICheckURL, previousGitRelease); - if (string.IsNullOrEmpty(result) == false) - { - SetStatus("Update available: " + result + " - Previous release was:" + previousGitRelease); - DialogResult dialogResult = MessageBox.Show("Update " + result + " is available, open download page?", "UnityLauncher - Check Update", MessageBoxButtons.YesNo); - if (dialogResult == DialogResult.Yes) // open download page - { - Tools.OpenURL(githubReleasesLinkURL); - } - } - else - { - SetStatus("No updates available. Current release is " + (float.Parse(previousGitRelease) + 0.01f)); - } - } - - - void BrowseForExistingProjectFolder() { folderBrowserDialog1.Description = "Select existing project folder"; diff --git a/UnityLauncher/Properties/Settings.Designer.cs b/UnityLauncher/Properties/Settings.Designer.cs index bfbc853..89b70cd 100644 --- a/UnityLauncher/Properties/Settings.Designer.cs +++ b/UnityLauncher/Properties/Settings.Designer.cs @@ -76,7 +76,7 @@ public bool closeAfterExplorer { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] + [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool closeAfterProject { get { return ((bool)(this["closeAfterProject"])); diff --git a/UnityLauncher/Properties/Settings.settings b/UnityLauncher/Properties/Settings.settings index ebe4f8c..b18b7e0 100644 --- a/UnityLauncher/Properties/Settings.settings +++ b/UnityLauncher/Properties/Settings.settings @@ -19,7 +19,7 @@ True - True + False 600 diff --git a/UnityLauncher/Tools.cs b/UnityLauncher/Tools.cs index 4205ed1..ee80320 100644 --- a/UnityLauncher/Tools.cs +++ b/UnityLauncher/Tools.cs @@ -111,6 +111,10 @@ public static string ReadCustomLaunchArguments(string projectPath, string launch /// public static string FindNearestVersion(string currentVersion, List allAvailable) { + if (currentVersion.Contains("2019")) + { + return FindNearestVersionFromSimilarVersions(currentVersion, allAvailable.Where(x => x.Contains("2019"))); + } if (currentVersion.Contains("2018")) { return FindNearestVersionFromSimilarVersions(currentVersion, allAvailable.Where(x => x.Contains("2018"))); @@ -378,62 +382,5 @@ public static bool LaunchExplorer(string folder) return result; } - /// - /// - /// - /// api to check releases - /// embedded previous release version - /// null if no info available, otherwise returns current github release number - public static string CheckUpdates(string githubReleaseURL, string previousGitRelease) - { - string result = null; - using (WebClient client = new WebClient()) - { - // apparently this is now required..otherwise: "The request was aborted: Could not create SSL/TLS secure channel" - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - - // fetch current release info - client.Headers.Add("user-agent", "MuskBrowser"); - string json = client.DownloadString(githubReleaseURL); - - if (json.IndexOf('{') != 0) - { - // invalid json - return result; - } - - var arr = json.Split(new string[] { "\"tag_name\":" }, StringSplitOptions.None); - - // have tagname - if (arr.Length > 1) - { - var arr2 = arr[1].Trim().Split('"'); - // have " - if (arr2.Length > 1) - { - var currentlyAvailableLatestReleaseTag = arr2[1]; - - // compare online version with build in release version, return github version if different from embedded version - float previous = 0; - float current = 0; - if (float.TryParse(previousGitRelease, out previous) == false) return result; - if (float.TryParse(currentlyAvailableLatestReleaseTag, out current) == false) return result; - - if (Math.Abs(previous - current) > 0.1f) - { - result = currentlyAvailableLatestReleaseTag; - Console.WriteLine("update available: [" + currentlyAvailableLatestReleaseTag + "] / [" + previousGitRelease + "]"); - } - else - { - Console.WriteLine("no update available: [" + currentlyAvailableLatestReleaseTag + "] / [" + previousGitRelease + "]"); - } - } - } - } - return result; - } - - } } diff --git a/UnityLauncher/UnityLauncher.csproj b/UnityLauncher/UnityLauncher.csproj index bbd86b4..8bd73a9 100644 --- a/UnityLauncher/UnityLauncher.csproj +++ b/UnityLauncher/UnityLauncher.csproj @@ -132,6 +132,7 @@ - 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\";" + + \ No newline at end of file