Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
427f16cde0 | ||
|
|
fe8abb589f | ||
|
|
ae787373dc | ||
|
|
4f2fe7b292 | ||
|
|
635a489cc1 | ||
|
|
5b82edb9ee |
@@ -1,5 +1,4 @@
|
||||
name: .NET Core Desktop
|
||||
permissions: write-all
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -44,7 +43,7 @@ jobs:
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
@@ -55,7 +54,7 @@ jobs:
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: /app/MonsterMonitor.zip
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.0.5
|
||||
1.0.11
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<RootNamespace>MonsterMonitor</RootNamespace>
|
||||
<AssemblyName>MonsterMonitor</AssemblyName>
|
||||
<AssemblyVersion>1.0.5</AssemblyVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<FileVersion>1.0.5</FileVersion>
|
||||
<InformationalVersion>1.0.5</InformationalVersion>
|
||||
<AssemblyVersion>1.0.11</AssemblyVersion>
|
||||
<Version>1.0.11</Version>
|
||||
<FileVersion>1.0.11</FileVersion>
|
||||
<InformationalVersion>1.0.11</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace MonsterMonitor.Services
|
||||
|
||||
var config = "users admin:CL:" + password + "\r\n" +
|
||||
"auth strong\r\n" +
|
||||
"maxconn 2000\r\n" +
|
||||
$"socks -i127.0.0.1 -p{port}";
|
||||
|
||||
var configPath = GetConfigPath();
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace MonsterMonitor.UI
|
||||
private readonly Button _btnSettings = new Button();
|
||||
private readonly Button _btnExit = new Button();
|
||||
private readonly NotifyIcon _notifyIcon = new NotifyIcon();
|
||||
private readonly Timer _updateTimer = new Timer();
|
||||
private readonly Icon _trayIcon;
|
||||
private readonly LogService _log = new LogService();
|
||||
private readonly PowerManagementService _power = new PowerManagementService();
|
||||
@@ -20,6 +21,7 @@ namespace MonsterMonitor.UI
|
||||
private AppController _controller;
|
||||
private AppSettings _settings;
|
||||
private bool _allowClose;
|
||||
private bool _isUpdateCheckRunning;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -43,7 +45,8 @@ namespace MonsterMonitor.UI
|
||||
_controller = new AppController(_log, _power);
|
||||
_updateService = new GitHubUpdateService(_log);
|
||||
RestartServices();
|
||||
_ = RunUpdateCheckAsync();
|
||||
ConfigureUpdateTimer();
|
||||
_ = RunUpdateCheckAsync(true);
|
||||
}
|
||||
|
||||
private void BuildUi()
|
||||
@@ -148,6 +151,8 @@ namespace MonsterMonitor.UI
|
||||
}
|
||||
|
||||
_notifyIcon.Visible = false;
|
||||
_updateTimer.Stop();
|
||||
_updateTimer.Dispose();
|
||||
_controller?.Dispose();
|
||||
_trayIcon?.Dispose();
|
||||
}
|
||||
@@ -168,12 +173,41 @@ namespace MonsterMonitor.UI
|
||||
_console.ScrollToCaret();
|
||||
}
|
||||
|
||||
private async Task RunUpdateCheckAsync()
|
||||
private void ConfigureUpdateTimer()
|
||||
{
|
||||
_updateTimer.Interval = (int)TimeSpan.FromHours(1).TotalMilliseconds;
|
||||
_updateTimer.Tick += async (_, __) => await RunUpdateCheckAsync(false);
|
||||
_updateTimer.Start();
|
||||
_log.Info("Автопроверка обновлений включена (раз в 1 час).");
|
||||
}
|
||||
|
||||
private async Task RunUpdateCheckAsync(bool isInitialCheck)
|
||||
{
|
||||
if (_isUpdateCheckRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdateCheckRunning = true;
|
||||
if (isInitialCheck)
|
||||
{
|
||||
// Небольшая задержка, чтобы окно и лог уже успели инициализироваться.
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Info("Плановая проверка обновлений...");
|
||||
}
|
||||
|
||||
await _updateService.CheckAndPrepareUpdateAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdateCheckRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static Color GetColor(LogLevel level)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user