Skip to content

Commit 479548b

Browse files
Add option to toggle updates off
Users can now disable the automatic update check. Fixed a minor bug in the Inno Setup script.
1 parent 7deeaba commit 479548b

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed

CUERipper.Avalonia/Configuration/Abstractions/ICUEConfigFacade.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public interface ICUEConfigFacade
7373

7474
// Various options
7575
string FreedbSiteAddress { get; set; }
76+
bool CheckForUpdates { get; set; }
7677

7778
// UI
7879
int CUEStyleIndex { get; set; }

CUERipper.Avalonia/Configuration/CUEConfigFacade.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class CUEConfigFacade : ICUEConfigFacade
8484

8585
// Various options
8686
public string FreedbSiteAddress { get => _cueConfig.advanced.FreedbSiteAddress; set => _cueConfig.advanced.FreedbSiteAddress = value; }
87+
public bool CheckForUpdates { get => _cueConfig.advanced.CheckForUpdates; set => _cueConfig.advanced.CheckForUpdates = value; }
8788

8889
// UI
8990
public int CUEStyleIndex { get; set; } = 0;

CUERipper.Avalonia/Services/UpdateService.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using CUERipper.Avalonia.Events;
1+
using CUERipper.Avalonia.Configuration.Abstractions;
2+
using CUERipper.Avalonia.Events;
23
using CUERipper.Avalonia.Models;
34
using CUERipper.Avalonia.Models.Github;
45
using CUERipper.Avalonia.Services.Abstractions;
@@ -22,14 +23,17 @@ public class UpdateService : IUpdateService
2223
private const string UpdateCheckFilePath = "CT_LAST_UPDATE_CHECK";
2324

2425
private readonly HttpClient _httpClient;
26+
private readonly ICUEConfigFacade _config;
2527
private readonly ILogger _logger;
2628

2729
public UpdateMetadata? UpdateMetadata { get; private set; }
2830

2931
public UpdateService(HttpClient httpClient
32+
, ICUEConfigFacade config
3033
, ILogger<UpdateService> logger)
3134
{
3235
_httpClient = httpClient;
36+
_config = config;
3337
_logger = logger;
3438
}
3539

@@ -42,9 +46,14 @@ public async Task<bool> FetchAsync()
4246
return false;
4347
}
4448
#endif
45-
4649
if (UpdateMetadata != null) return true;
4750

51+
if (!_config.CheckForUpdates)
52+
{
53+
_logger.LogWarning("Skip checking for updates.");
54+
return false;
55+
}
56+
4857
var latestRelease = await GetLatestReleaseAsync();
4958
if (latestRelease.Content == null)
5059
{

CUERipper.Avalonia/Views/OptionsDialog.axaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ private void OnDataContextChanged(object? sender, EventArgs e)
106106
new ObservableCollection<IOptionProxy> {
107107
new StringOptionProxy("Freedb site address", "gnudb.gnudb.org"
108108
, new(() => Config.FreedbSiteAddress))
109+
, new BoolOptionProxy("Check for updates", true
110+
, new(() => Config.CheckForUpdates))
109111
}.MoveAll(ViewModel.VariousOptions);
110112
}
111113

CUETools.Processor/CUEConfigAdvanced.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,11 @@ public void Init()
122122

123123
[DefaultValue(true), Category("Tagging"), DisplayName("Write CDTOC tag")]
124124
public bool WriteCDTOCTag { get; set; }
125+
126+
/// <summary>
127+
/// Check GitHub for newer releases. (CUERipper new)
128+
/// </summary>
129+
[DefaultValue(true), DisplayName("Check for updates")]
130+
public bool CheckForUpdates { get; set; }
125131
}
126132
}

CUETools.Processor/CUESheet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class CUESheet
2828
{
2929
#region Fields
3030

31-
public const string CUEToolsVersion = "2.2.6a";
31+
public const string CUEToolsVersion = "2.2.6b";
3232

3333
private bool _stop, _pause;
3434
private List<CUELine> _attributes;

installer.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LicenseFile=License.txt
2121
PrivilegesRequiredOverridesAllowed=dialog
2222

2323
[Files]
24-
Source: "bin\Release\CUETools_{#CUETOOLS_VERSION}\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
24+
Source: "bin\Release\CUETools_{#CUETOOLS_VERSION}\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs replacesameversion
2525
Source: "License.txt"; DestDir: "{app}"; Flags: onlyifdoesntexist
2626

2727
[Icons]

0 commit comments

Comments
 (0)