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:
49
Core/Csv.cs
Normal file
49
Core/Csv.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReminderOrganizer.Core
|
||||
{
|
||||
/// <summary>Minimal CSV for ';'-separated files with "quoted" fields (quotes doubled, newlines allowed).</summary>
|
||||
public static class Csv
|
||||
{
|
||||
public const char Separator = ';';
|
||||
|
||||
public static string Escape(string? value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return "";
|
||||
if (value.IndexOfAny(new[] { Separator, '"', '\n', '\r' }) >= 0)
|
||||
return "\"" + value.Replace("\"", "\"\"") + "\"";
|
||||
return value;
|
||||
}
|
||||
|
||||
public static List<List<string>> Parse(string text)
|
||||
{
|
||||
var rows = new List<List<string>>();
|
||||
var row = new List<string>();
|
||||
var field = new StringBuilder();
|
||||
bool inQuotes = false;
|
||||
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
char c = text[i];
|
||||
if (inQuotes)
|
||||
{
|
||||
if (c == '"')
|
||||
{
|
||||
if (i + 1 < text.Length && text[i + 1] == '"') { field.Append('"'); i++; }
|
||||
else inQuotes = false;
|
||||
}
|
||||
else field.Append(c);
|
||||
}
|
||||
else if (c == '"') inQuotes = true;
|
||||
else if (c == Separator) { row.Add(field.ToString()); field.Clear(); }
|
||||
else if (c == '\r') { }
|
||||
else if (c == '\n') { row.Add(field.ToString()); field.Clear(); rows.Add(row); row = new List<string>(); }
|
||||
else field.Append(c);
|
||||
}
|
||||
if (field.Length > 0 || row.Count > 0) { row.Add(field.ToString()); rows.Add(row); }
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Core/Theme.cs
Normal file
57
Core/Theme.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
#nullable enable
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ReminderOrganizer.Core
|
||||
{
|
||||
/// <summary>One place for the light/dark palette – used by the main window and all dialogs.</summary>
|
||||
public static class Theme
|
||||
{
|
||||
private static SolidColorBrush B(uint rgb)
|
||||
{
|
||||
var b = new SolidColorBrush(Color.FromRgb((byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb));
|
||||
b.Freeze();
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void Apply(ResourceDictionary res, bool dark)
|
||||
{
|
||||
if (dark)
|
||||
{
|
||||
res["SidebarBrush"] = B(0x1A1A24);
|
||||
res["CardBrush"] = B(0x22222E);
|
||||
res["TextPrimaryBrush"] = B(0xF5F5F5);
|
||||
res["TextSecondaryBrush"] = B(0xA8A8BC);
|
||||
res["BorderBrush"] = B(0x3A3A4A);
|
||||
res["BackgroundBrush"] = B(0x121218);
|
||||
res["HoverBrush"] = B(0x2A2A3A);
|
||||
res["SidebarTextBrush"] = B(0xF5F5F5);
|
||||
res["SidebarSecondaryBrush"] = B(0x9999AA);
|
||||
res["MenuBackgroundBrush"] = B(0x22222E);
|
||||
res["PrimaryLightBrush"] = B(0x37345F);
|
||||
res["HeaderBrush"] = B(0x22222E);
|
||||
res["InputBackgroundBrush"] = B(0x2A2A38);
|
||||
res["BadgeBrush"] = B(0x37345F);
|
||||
res["BadgeTextBrush"] = B(0xC7C8FF);
|
||||
}
|
||||
else
|
||||
{
|
||||
res["SidebarBrush"] = B(0xF8FAFC);
|
||||
res["CardBrush"] = B(0xFFFFFF);
|
||||
res["TextPrimaryBrush"] = B(0x1E293B);
|
||||
res["TextSecondaryBrush"] = B(0x64748B);
|
||||
res["BorderBrush"] = B(0xE2E8F0);
|
||||
res["BackgroundBrush"] = B(0xF1F5F9);
|
||||
res["HoverBrush"] = B(0xE2E8F0);
|
||||
res["SidebarTextBrush"] = B(0x1E293B);
|
||||
res["SidebarSecondaryBrush"] = B(0x64748B);
|
||||
res["MenuBackgroundBrush"] = B(0xFFFFFF);
|
||||
res["PrimaryLightBrush"] = B(0xEEF2FF);
|
||||
res["HeaderBrush"] = B(0xFFFFFF);
|
||||
res["InputBackgroundBrush"] = B(0xF1F5F9);
|
||||
res["BadgeBrush"] = B(0xE0E7FF);
|
||||
res["BadgeTextBrush"] = B(0x4338CA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user