feat: add timezone check

This commit is contained in:
goaaats 2022-03-31 20:24:23 +02:00
parent 0cd1c1b150
commit a33aef5c45
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
4 changed files with 12 additions and 10 deletions

View file

@ -290,7 +290,7 @@ namespace Dalamud.Configuration.Internal
/// </summary>
public bool ShowTsm { get; set; } = true;
public bool Fools22 { get; set; } = true;
public bool? Fools22New { get; set; } = true;
/// <summary>
/// Load a configuration from the provided path.

View file

@ -275,6 +275,13 @@ namespace Dalamud
try
{
Log.Information("Loading fools22");
var timeZone = TimeZoneInfo.Local;
var offset = timeZone.GetUtcOffset(DateTime.UtcNow);
var config = Service<DalamudConfiguration>.Get();
config.Fools22New = offset.Hours < 1;
config.Save();
this.fools22 = new Fools22();
}
catch (Exception ex)

View file

@ -323,17 +323,12 @@ public class Fools22 : IDisposable
{
var config = Service<DalamudConfiguration>.Get();
if (!config.Fools22)
if (!(config.Fools22New ?? true))
return false;
if (!(DateTime.Now.Month == 4 && DateTime.Now.Day == 1))
return false;
var timeZone = TimeZoneInfo.Local;
var offset = timeZone.GetUtcOffset(DateTime.UtcNow);
Log.Information("Fools22: UTC offset: {0}", offset);
return this.assetsReady;
}

View file

@ -106,8 +106,6 @@ namespace Dalamud.Interface.Internal.Windows
this.doFocus = configuration.IsFocusManagementEnabled;
this.doTsm = configuration.ShowTsm;
this.doFools22 = configuration.Fools22;
this.dtrSpacing = configuration.DtrSpacing;
this.dtrSwapDirection = configuration.DtrSwapDirection;
@ -176,6 +174,8 @@ namespace Dalamud.Interface.Internal.Windows
var configuration = Service<DalamudConfiguration>.Get();
this.dtrOrder = configuration.DtrOrder;
this.dtrIgnore = configuration.DtrIgnore;
this.doFools22 = configuration.Fools22New ?? true;
}
/// <inheritdoc/>
@ -853,7 +853,7 @@ namespace Dalamud.Interface.Internal.Windows
configuration.IsFocusManagementEnabled = this.doFocus;
configuration.ShowTsm = this.doTsm;
configuration.Fools22 = this.doFools22;
configuration.Fools22New = this.doFools22;
configuration.UseAxisFontsFromGame = this.doUseAxisFontsFromGame;
configuration.FontGamma = this.fontGamma;