Fix data loss risk, reminder bugs; theme, credits, tests
- Store tasks in %APPDATA% (single-file extract dir lost data on update), atomic serialized saves, corrupt-file backup, migration of old tasks.json - Reminders without description never showed (empty balloon text threw) - Catch up missed reminders on start; monthly recurrence no longer drifts - Task dialog: date pick kept 00:00, cancel leaked recurrence changes - CSV import understands quoted fields written by export - Confirm before deleting; name folders on create; tasks sorted by date - Single instance, autostart starts hidden in tray, tray icon disposed - Theme helper for all dialogs, MDL2/Path icons instead of emojis, fixed folder selection/badge, localized counts and messages - Credits (c) Michael Media + Discord link, exe Company/Copyright - Locales embedded; xUnit tests (24); README, CLAUDE.md, sprite-generator Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,26 @@ namespace ReminderOrganizer.Services
|
||||
private const string RegistryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
|
||||
private const string AppName = "ReminderOrganizer";
|
||||
|
||||
/// <summary>Registry value: quoted exe path + --minimized (start in tray).</summary>
|
||||
public static string BuildCommand(string exePath) => $"\"{exePath}\" --minimized";
|
||||
|
||||
/// <summary>True if the stored command points at this exe (old entries without quotes count too).</summary>
|
||||
public static bool PointsTo(string? stored, string? exePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stored) || string.IsNullOrEmpty(exePath)) return false;
|
||||
var s = stored.Trim();
|
||||
if (s.StartsWith("\""))
|
||||
{
|
||||
var end = s.IndexOf('"', 1);
|
||||
s = end > 0 ? s.Substring(1, end - 1) : s.Trim('"');
|
||||
}
|
||||
else if (s.EndsWith(" --minimized"))
|
||||
{
|
||||
s = s[..^" --minimized".Length];
|
||||
}
|
||||
return string.Equals(s, exePath, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsAutostartEnabled
|
||||
{
|
||||
get
|
||||
@@ -16,8 +36,7 @@ namespace ReminderOrganizer.Services
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(RegistryKey, false);
|
||||
var path = key?.GetValue(AppName) as string;
|
||||
return path == Environment.ProcessPath;
|
||||
return PointsTo(key?.GetValue(AppName) as string, Environment.ProcessPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -42,7 +61,7 @@ namespace ReminderOrganizer.Services
|
||||
var path = Environment.ProcessPath;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
key.SetValue(AppName, path);
|
||||
key.SetValue(AppName, BuildCommand(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user