forked from exCore2/PluginUpdater
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginUpdaterSettings.cs
More file actions
41 lines (33 loc) · 1.14 KB
/
PluginUpdaterSettings.cs
File metadata and controls
41 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using ExileCore2;
using ExileCore2.Shared.Interfaces;
using ExileCore2.Shared.Nodes;
using Newtonsoft.Json;
namespace PluginUpdater;
public class PluginUpdaterSettings : ISettings
{
public PluginUpdaterSettings()
{
PluginConfig = new PluginRenderer(this);
}
public ToggleNode Enable { get; set; } = new ToggleNode(true);
public bool CheckUpdatesOnStartup { get; set; }
public bool AutoCheckUpdates { get; set; }
public bool WrapLogMessages { get; set; } = true;
public int UpdateCheckIntervalMinutes { get; set; } = 60;
[JsonIgnore]
public DateTime LastUpdateCheck { get; set; } = DateTime.Now;
[JsonIgnore]
public bool HasCheckedUpdates { get; set; } = false;
[JsonIgnore]
public PluginRenderer PluginConfig { get; set; }
[JsonIgnore]
public GameController GameController { get; set; } // this is very lazy
public bool ShouldPerformPeriodicCheck()
{
if (!AutoCheckUpdates)
return false;
var timeSinceLastCheck = DateTime.Now - LastUpdateCheck;
return timeSinceLastCheck.TotalMinutes >= UpdateCheckIntervalMinutes;
}
}