Fixed not clickable notifications
This commit is contained in:
@@ -578,13 +578,13 @@ public sealed class FileCacheManager : IHostedService
|
|||||||
{
|
{
|
||||||
if (!File.Exists(_csvPath))
|
if (!File.Exists(_csvPath))
|
||||||
{
|
{
|
||||||
File.WriteAllLines(_csvPath, new[] { BuildVersionHeader(), entity.CsvEntry });
|
File.WriteAllLines(_csvPath, [BuildVersionHeader(), entity.CsvEntry]);
|
||||||
_csvHeaderEnsured = true;
|
_csvHeaderEnsured = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EnsureCsvHeaderLockedCached();
|
EnsureCsvHeaderLockedCached();
|
||||||
File.AppendAllLines(_csvPath, new[] { entity.CsvEntry });
|
File.AppendAllLines(_csvPath, [entity.CsvEntry]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var result = GetFileCacheByPath(fileInfo.FullName);
|
var result = GetFileCacheByPath(fileInfo.FullName);
|
||||||
@@ -721,7 +721,7 @@ public sealed class FileCacheManager : IHostedService
|
|||||||
BackupUnsupportedCache("invalid-version");
|
BackupUnsupportedCache("invalid-version");
|
||||||
parseEntries = false;
|
parseEntries = false;
|
||||||
rewriteRequired = true;
|
rewriteRequired = true;
|
||||||
entries = Array.Empty<string>();
|
entries = [];
|
||||||
}
|
}
|
||||||
else if (parsedVersion != FileCacheVersion)
|
else if (parsedVersion != FileCacheVersion)
|
||||||
{
|
{
|
||||||
@@ -729,7 +729,7 @@ public sealed class FileCacheManager : IHostedService
|
|||||||
BackupUnsupportedCache($"v{parsedVersion}");
|
BackupUnsupportedCache($"v{parsedVersion}");
|
||||||
parseEntries = false;
|
parseEntries = false;
|
||||||
rewriteRequired = true;
|
rewriteRequired = true;
|
||||||
entries = Array.Empty<string>();
|
entries = [];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class LightlessNotificationUi : WindowMediatorSubscriberBase
|
|||||||
ImGuiWindowFlags.NoNav |
|
ImGuiWindowFlags.NoNav |
|
||||||
ImGuiWindowFlags.NoBackground |
|
ImGuiWindowFlags.NoBackground |
|
||||||
ImGuiWindowFlags.NoCollapse |
|
ImGuiWindowFlags.NoCollapse |
|
||||||
ImGuiWindowFlags.NoInputs |
|
|
||||||
ImGuiWindowFlags.NoTitleBar |
|
ImGuiWindowFlags.NoTitleBar |
|
||||||
ImGuiWindowFlags.NoScrollbar |
|
ImGuiWindowFlags.NoScrollbar |
|
||||||
ImGuiWindowFlags.AlwaysAutoResize;
|
ImGuiWindowFlags.AlwaysAutoResize;
|
||||||
@@ -382,9 +381,13 @@ public class LightlessNotificationUi : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
private void HandleClickToDismiss(LightlessNotification notification)
|
private void HandleClickToDismiss(LightlessNotification notification)
|
||||||
{
|
{
|
||||||
if (ImGui.IsWindowHovered() &&
|
var pos = ImGui.GetWindowPos();
|
||||||
|
var size = ImGui.GetWindowSize();
|
||||||
|
bool hovered = ImGui.IsMouseHoveringRect(pos, new Vector2(pos.X + size.X, pos.Y + size.Y));
|
||||||
|
|
||||||
|
if ((hovered || ImGui.IsWindowHovered()) &&
|
||||||
_configService.Current.DismissNotificationOnClick &&
|
_configService.Current.DismissNotificationOnClick &&
|
||||||
!notification.Actions.Any() &&
|
notification.Actions.Count == 0 &&
|
||||||
ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
ImGui.IsMouseClicked(ImGuiMouseButton.Left))
|
||||||
{
|
{
|
||||||
notification.IsDismissed = true;
|
notification.IsDismissed = true;
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ public static class Crypto
|
|||||||
|
|
||||||
public static string GetFileHash(this string filePath)
|
public static string GetFileHash(this string filePath)
|
||||||
{
|
{
|
||||||
using SHA1 sha1 = SHA1.Create();
|
using var stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
||||||
using FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
using var sha1 = SHA1.Create();
|
||||||
return Convert.ToHexString(sha1.ComputeHash(stream));
|
|
||||||
|
var hash = sha1.ComputeHash(stream);
|
||||||
|
return Convert.ToHexString(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string> GetFileHashAsync(string filePath, CancellationToken cancellationToken = default)
|
public static async Task<string> GetFileHashAsync(string filePath, CancellationToken cancellationToken = default)
|
||||||
@@ -29,7 +31,8 @@ public static class Crypto
|
|||||||
|
|
||||||
var buffer = new byte[8192];
|
var buffer = new byte[8192];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
while ((bytesRead = await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) > 0)
|
|
||||||
|
while ((bytesRead = await stream.ReadAsync(buffer.AsMemory(0, buffer.Length), cancellationToken).ConfigureAwait(false)) > 0)
|
||||||
{
|
{
|
||||||
sha1.TransformBlock(buffer, 0, bytesRead, outputBuffer: null, 0);
|
sha1.TransformBlock(buffer, 0, bytesRead, outputBuffer: null, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user