diff --git a/Ryujinx.Updater/Program.cs b/Ryujinx.Updater/Program.cs index 6e35dffff3..5a9b375ddb 100644 --- a/Ryujinx.Updater/Program.cs +++ b/Ryujinx.Updater/Program.cs @@ -1,8 +1,10 @@ +using ICSharpCode.SharpZipLib.Tar; using System; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Net; +using System.Runtime.InteropServices; namespace Ryujinx.Updater { @@ -28,9 +30,11 @@ namespace Ryujinx.Updater Directory.CreateDirectory(Path.Combine(dest, dirName)); } } - catch + catch (Exception ex) { - + File.Create(Path.Combine(ryuDir, "UpdaterLog.txt")).Close(); + File.WriteAllText(Path.Combine(ryuDir, "UpdaterLog.txt"), ex.Message); + Environment.Exit(0); } MoveAllFilesOver(directory, Path.Combine(dest, dirName)); @@ -42,9 +46,11 @@ namespace Ryujinx.Updater { File.Move(file, Path.Combine(dest, Path.GetFileName(file)), true); } - catch + catch (Exception ex) { - + File.Create(Path.Combine(ryuDir, "UpdaterLog.txt")).Close(); + File.WriteAllText(Path.Combine(ryuDir, "UpdaterLog.txt"), ex.Message); + Environment.Exit(0); } } } @@ -91,7 +97,19 @@ namespace Ryujinx.Updater Console.WriteLine($"Extracting Ryujinx package..."); - ZipFile.ExtractToDirectory(updateSaveLocation, localAppPath, true); + using (FileStream SourceStream = File.Open(updateSaveLocation, FileMode.Open)) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + TarArchive tarArchive = TarArchive.CreateInputTarArchive(SourceStream); + tarArchive.ExtractContents(localAppPath); + } + else + { + ZipArchive zipArchive = new ZipArchive(SourceStream); + zipArchive.ExtractToDirectory(localAppPath); + } + } // Copy new files over to Ryujinx folder diff --git a/Ryujinx.Updater/Ryujinx.Updater.csproj b/Ryujinx.Updater/Ryujinx.Updater.csproj index a2eb568e1a..ed9c66b069 100644 --- a/Ryujinx.Updater/Ryujinx.Updater.csproj +++ b/Ryujinx.Updater/Ryujinx.Updater.csproj @@ -19,5 +19,9 @@ true + + + + \ No newline at end of file diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index be15905627..466409b9de 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -6,6 +6,7 @@ using Ryujinx.Ui; using Ryujinx.Updater.Parser; using OpenTK; using System; +using System.Configuration; using System.IO; namespace Ryujinx @@ -63,17 +64,23 @@ namespace Ryujinx } MainWindow mainWindow = new MainWindow(); + + if (ConfigurationManager.AppSettings["Version"] != "__ver__") + { + mainWindow.Title = "Ryujinx " + ConfigurationManager.AppSettings["Version"]; + } + mainWindow.Show(); - if (args.Length > 1) + if (args.Length >= 1) { - foreach (string arg in args) + if (args[0].ToUpper() == "/U") { - switch (arg.Substring(0, 2).ToUpper()) - { - case "/U": UpdateParser.BeginParse(); break; - default: mainWindow.LoadApplication(args[0]); break; - } + UpdateParser.BeginParse(); + } + else + { + mainWindow.LoadApplication(args[0]); } } diff --git a/Ryujinx/Ryujinx.csproj b/Ryujinx/Ryujinx.csproj index f6737868d7..c29682b85b 100644 --- a/Ryujinx/Ryujinx.csproj +++ b/Ryujinx/Ryujinx.csproj @@ -76,7 +76,8 @@ - + + diff --git a/Ryujinx/Ui/AboutWindow.cs b/Ryujinx/Ui/AboutWindow.cs index bde1593d69..4ceb6f0be0 100644 --- a/Ryujinx/Ui/AboutWindow.cs +++ b/Ryujinx/Ui/AboutWindow.cs @@ -1,6 +1,7 @@ using Gtk; using Newtonsoft.Json.Linq; using System; +using System.Configuration; using System.Diagnostics; using System.IO; using System.Reflection; @@ -44,21 +45,15 @@ namespace Ryujinx.Ui Directory.CreateDirectory(localAppPath); } - try + if (ConfigurationManager.AppSettings["Version"] != "__ver__") { - string currentVersionJson; - string currentVersionBranch; - string currentVersionPr; + string currentVersion = ConfigurationManager.AppSettings["Version"]; + string currentVersionBranch = ConfigurationManager.AppSettings["Branch"]; + string currentVersionPr = ConfigurationManager.AppSettings["PrID"]; - JObject VersionJSON = JObject.Parse(File.ReadAllText(System.IO.Path.Combine(Environment.CurrentDirectory, "Version.json"))); - - currentVersionJson = (string)VersionJSON["BuildVer"]; - currentVersionPr = (string)VersionJSON["BuildPr"]; - currentVersionBranch = (string)VersionJSON["BuildBranch"]; - - _versionText.Text = "Version - " + currentVersionJson + Environment.NewLine + "Branch - " + currentVersionBranch + Environment.NewLine + "PR ID - #" + currentVersionPr; + _versionText.Text = "Version - " + currentVersion + Environment.NewLine + "Branch - " + currentVersionBranch + Environment.NewLine + "PR ID - #" + currentVersionPr; } - catch + else { _versionText.Text = "Unknown Version"; } diff --git a/Ryujinx/Updater/UpdateParser.cs b/Ryujinx/Updater/UpdateParser.cs index b79586724c..e22faf5dad 100644 --- a/Ryujinx/Updater/UpdateParser.cs +++ b/Ryujinx/Updater/UpdateParser.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json.Linq; using Ryujinx.Common.Logging; using Ryujinx.Ui; using System; +using System.Configuration; using System.Diagnostics; using System.IO; using System.Net; @@ -46,6 +47,13 @@ namespace Ryujinx _platformExt = "linux_x64.tar.gz"; } } + else + { + Logger.PrintError(LogClass.Application, $"You are using an operating system architecture ({RuntimeInformation.ProcessArchitecture.ToString()}) not compatible with Ryujinx."); + GtkDialog.CreateErrorDialog($"You are using an operating system architecture ({RuntimeInformation.ProcessArchitecture.ToString()}) not compatible with Ryujinx."); + + return; + } // Begin the Appveyor parsing @@ -64,36 +72,16 @@ namespace Ryujinx Directory.CreateDirectory(localAppPath); } - // Get Version.json to compare versions + // Get Version from app.config to compare versions - if (File.Exists(Path.Combine(Environment.CurrentDirectory, "Version.json"))) + Version newVersion = Version.Parse(_buildVer); + Version currentVersion = Version.Parse(ConfigurationManager.AppSettings["Version"]); + + if (newVersion < currentVersion) { - try - { - string currentVersionJson; - string currentVersionBranch; - string currentVersionPr; + GtkDialog.CreateInfoDialog("Update", "Ryujinx - Updater", "You are already using the most updated version of Ryujinx!", ""); - JObject VersionJSON = JObject.Parse(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Version.json"))); - - currentVersionJson = (string)VersionJSON["BuildVer"]; - currentVersionPr = (string)VersionJSON["BuildPR"]; - currentVersionBranch = (string)VersionJSON["BuildBranch"]; - - Version newVersion = Version.Parse(_buildVer); - Version currentVersion = Version.Parse(currentVersionJson); - - if (newVersion < currentVersion) - { - GtkDialog.CreateInfoDialog("Update", "Ryujinx - Updater", "You are already using the most updated version of Ryujinx!", ""); - - return; - } - } - catch - { - - } + return; } // Show a message asking the user if they want to update diff --git a/appveyor.yml b/appveyor.yml index 50b44742b8..e387f4e532 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,35 +12,29 @@ environment: config_name: '-profiled-' build_script: - ps: >- + (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config).replace('__ver__', $env:APPVEYOR_BUILD_VERSION) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config + + (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config).replace('__branch__', $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config + + (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config).replace('__prid__', $env:APPVEYOR_PULL_REQUEST_NUMBER) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Ryujinx\App.config + dotnet --version dotnet publish -c $env:config -r win-x64 - - dotnet publish -c $env:config -r linux-x64 - - dotnet publish -c $env:config -r osx-x64 - - (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json).replace('_ver', $env:APPVEYOR_BUILD_VERSION) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json - - (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json).replace('_pr', $env:APPVEYOR_PULL_REQUEST_NUMBER) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json - - (Get-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json).replace('_branch', $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) | Set-Content -Path $env:APPVEYOR_BUILD_FOLDER\Version.json - Copy-Item $env:APPVEYOR_BUILD_FOLDER\Version.json -Destination $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\win-x64\publish\ - + dotnet publish -c $env:config -r linux-x64 + + dotnet publish -c $env:config -r osx-x64 + 7z a ryujinx$env:config_name$env:APPVEYOR_BUILD_VERSION-win_x64.zip $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\win-x64\publish\ - Copy-Item $env:APPVEYOR_BUILD_FOLDER\Version.json -Destination $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\linux-x64\publish\ - 7z a ryujinx$env:config_name$env:APPVEYOR_BUILD_VERSION-linux_x64.tar $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\linux-x64\publish\ - + 7z a ryujinx$env:config_name$env:APPVEYOR_BUILD_VERSION-linux_x64.tar.gz ryujinx$env:config_name$env:APPVEYOR_BUILD_VERSION-linux_x64.tar - Copy-Item $env:APPVEYOR_BUILD_FOLDER\Version.json -Destination $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\osx-x64\publish\ - 7z a ryujinx$env:config_name$env:APPVEYOR_BUILD_VERSION-osx_x64.zip $env:APPVEYOR_BUILD_FOLDER\Ryujinx\bin\$env:config\netcoreapp3.0\osx-x64\publish\ artifacts: - path: ryujinx%config_name%%APPVEYOR_BUILD_VERSION%-win_x64.zip - path: ryujinx%config_name%%APPVEYOR_BUILD_VERSION%-linux_x64.tar.gz -- path: ryujinx%config_name%%APPVEYOR_BUILD_VERSION%-osx_x64.zip +- path: ryujinx%config_name%%APPVEYOR_BUILD_VERSION%-osx_x64.zip \ No newline at end of file