Skip to content

Commit

Permalink
Updated several packages and fixed some breaking changes:
Browse files Browse the repository at this point in the history
- Sentry class name and minor API changes.
- GitVersion generated class fully name changed.
- SemVer parsing and comparison API changed.
  • Loading branch information
RevZero committed Apr 23, 2024
1 parent 6cf51b6 commit 44c0595
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static class GitVersionInfo

static GitVersionInfo() {
var assembly = Assembly.GetExecutingAssembly();
var fields = assembly.GetType("XCOM2Launcher.GitVersionInformation").GetFields();
var fields = assembly.GetType("GitVersionInformation").GetFields();

int.TryParse(fields.Single(f => f.Name == "Major").GetValue(null).ToString(), out Major);
int.TryParse(fields.Single(f => f.Name == "Minor").GetValue(null).ToString(), out Minor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected override void Append(LoggingEvent loggingEvent)

if (SendIdentity && !string.IsNullOrEmpty(loggingEvent.Identity))
{
evt.User = new User
evt.User = new SentryUser
{
Id = loggingEvent.Identity
};
Expand Down
30 changes: 15 additions & 15 deletions xcom2-launcher/xcom2-launcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ private static void Main()
}

// clean up old files
if (File.Exists(Program.XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak"))
if (File.Exists(XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak"))
{
// Restore backup
File.Copy(Program.XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak", Program.XEnv.DefaultConfigDir + @"\DefaultModOptions.ini", true);
File.Delete(Program.XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak");
File.Copy(XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak", XEnv.DefaultConfigDir + @"\DefaultModOptions.ini", true);
File.Delete(XEnv.DefaultConfigDir + @"\DefaultModOptions.ini.bak");
}

Application.Run(new MainForm(settings));
Expand Down Expand Up @@ -193,16 +193,16 @@ private static IDisposable InitSentry()
o.Debug = false;
o.Environment = environment;
o.MaxBreadcrumbs = 50;
o.BeforeSend = sentryEvent =>
{
sentryEvent.User.Email = null;
return sentryEvent;
};
o.SetBeforeSend(sentryEvent =>
{
sentryEvent.User.Email = null;
return sentryEvent;
});
});

SentrySdk.ConfigureScope(scope =>
{
scope.User = new User
scope.User = new SentryUser
{
Id = GlobalSettings.Instance.Guid,
Username = GlobalSettings.Instance.UserName,
Expand Down Expand Up @@ -341,7 +341,7 @@ public static Settings InitializeSettings()

// Verify Game Path
if (!Directory.Exists(settings.GamePath))
settings.GamePath = Program.XEnv.DetectGameDir();
settings.GamePath = XEnv.DetectGameDir();

if (settings.GamePath == "")
{
Expand Down Expand Up @@ -477,14 +477,14 @@ public static bool CheckForUpdate()
Log.Info("Pre-Release updates enabled");
// fetch all releases including pre-releases and select the first/newest
var jsonAllReleases = client.DownloadString("https://api.github.com/repos/X2CommunityCore/xcom2-launcher/releases");
var allReleases = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GitHub.Release>>(jsonAllReleases);
var allReleases = JsonConvert.DeserializeObject<List<GitHub.Release>>(jsonAllReleases);
release = allReleases.FirstOrDefault();
}
else
{
// fetch latest non-pre-release
var json = client.DownloadString("https://api.github.com/repos/X2CommunityCore/xcom2-launcher/releases/latest");
release = Newtonsoft.Json.JsonConvert.DeserializeObject<GitHub.Release>(json);
release = JsonConvert.DeserializeObject<GitHub.Release>(json);
}

if (release == null)
Expand All @@ -493,16 +493,16 @@ public static bool CheckForUpdate()
return false;
}

bool parsingSucceeded = SemVersion.TryParse(GitVersionInfo.SemVer, out SemVersion currentVersion);
parsingSucceeded &= SemVersion.TryParse(release.tag_name.TrimStart('v'), out SemVersion newVersion);
bool parsingSucceeded = SemVersion.TryParse(GitVersionInfo.SemVer, SemVersionStyles.Any, out SemVersion currentVersion);
parsingSucceeded &= SemVersion.TryParse(release.tag_name.TrimStart('v'), SemVersionStyles.Any ,out SemVersion newVersion);

if (parsingSucceeded)
{
// If not explicitly enabled, we ignore alpha versions.
if (!Settings.Instance.IncludeAlphaVersions && newVersion.Prerelease.Contains("alpha"))
return false;

if (currentVersion < newVersion)
if (currentVersion.CompareSortOrderTo(newVersion) == -1)
{
// New version available
Log.Info("New version available " + newVersion);
Expand Down
22 changes: 21 additions & 1 deletion xcom2-launcher/xcom2-launcher/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,27 @@
<probing privatePath="lib;libs" xmlns="" />
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
28 changes: 14 additions & 14 deletions xcom2-launcher/xcom2-launcher/packages.config
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FCTB" version="2.16.24" targetFramework="net472" />
<package id="GitVersionTask" version="3.6.5" targetFramework="net472" developmentDependency="true" />
<package id="log4net" version="2.0.8" targetFramework="net472" />
<package id="GitVersionTask" version="5.5.1" targetFramework="net472" developmentDependency="true" />
<package id="log4net" version="2.0.17" targetFramework="net472" />
<package id="Markdown" version="2.2.1" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
<package id="Microsoft-WindowsAPICodePack-Core" version="1.1.4" targetFramework="net472" />
<package id="Microsoft-WindowsAPICodePack-Shell" version="1.1.4" targetFramework="net472" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Microsoft-WindowsAPICodePack-Core" version="1.1.5" targetFramework="net472" />
<package id="Microsoft-WindowsAPICodePack-Shell" version="1.1.5" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="ObjectListView.Official" version="2.9.1" targetFramework="net472" />
<package id="Semver" version="2.0.6" targetFramework="net472" />
<package id="Sentry" version="3.2.0" targetFramework="net472" />
<package id="Semver" version="2.3.0" targetFramework="net472" />
<package id="Sentry" version="4.4.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Collections.Immutable" version="5.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.4" targetFramework="net472" />
<package id="System.Collections.Immutable" version="8.0.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Reflection.Metadata" version="5.0.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Reflection.Metadata" version="8.0.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="5.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="5.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>
Loading

0 comments on commit 44c0595

Please sign in to comment.