本次发布聚焦降低误报风险、规范发布产物和重构仓库文档。 主要变更: - 删除开机自启功能,移除 Windows 启动项注册表写入逻辑。 - 新增标准应用清单,声明应用以普通用户权限运行。 - 新增 framework-dependent 发布脚本,保持发布包不内置 .NET 运行时。 - 禁用单文件、自解压、裁剪和 ReadyToRun 发布方式,保持产物结构透明。 - 将发布资产命名规范化为 omni-notify-v0.2.0-win-x64.zip。 - 重写文档结构:README.md 面向用户,docs/development.md 面向开发者。 - 删除过时且内容重复的 PRD.md 与 docs/usage.md。 验证: - dotnet build .\OmniNotify.csproj -c Release 构建通过。 - 发布脚本成功生成 v0.2.0 win-x64 压缩包。 - 发布目录未包含 coreclr.dll、hostfxr.dll、hostpolicy.dll 等 .NET 运行时文件。
119 lines
3.3 KiB
C#
119 lines
3.3 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace OmniNotify;
|
|
|
|
public enum NotificationStatus
|
|
{
|
|
Displayed,
|
|
DndMuted,
|
|
IllegalChannel,
|
|
System
|
|
}
|
|
|
|
public enum ScreenAnchor
|
|
{
|
|
TopLeft,
|
|
TopCenter,
|
|
TopRight,
|
|
MiddleLeft,
|
|
Center,
|
|
MiddleRight,
|
|
BottomLeft,
|
|
BottomCenter,
|
|
BottomRight
|
|
}
|
|
|
|
public enum StackMode
|
|
{
|
|
Queue,
|
|
Push,
|
|
Replace
|
|
}
|
|
|
|
public enum OverflowMode
|
|
{
|
|
Truncate,
|
|
VerticalScroll,
|
|
Split
|
|
}
|
|
|
|
public enum PopupAnimation
|
|
{
|
|
Fade,
|
|
Slide,
|
|
Zoom
|
|
}
|
|
|
|
public sealed class AppState
|
|
{
|
|
public GlobalSettings Settings { get; set; } = new();
|
|
public ObservableCollection<Channel> Channels { get; set; } = [];
|
|
public ObservableCollection<HistoryItem> History { get; set; } = [];
|
|
}
|
|
|
|
public sealed class GlobalSettings
|
|
{
|
|
public bool DndEnabled { get; set; }
|
|
public bool CircuitBreakerOpen { get; set; }
|
|
public int MaxMessagesPerSecond { get; set; } = 8;
|
|
public int RetainDays { get; set; } = 30;
|
|
public int RetainCount { get; set; } = 1000;
|
|
public int LocalPort { get; set; } = 19845;
|
|
}
|
|
|
|
public sealed class Channel
|
|
{
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
public string Name { get; set; } = "default";
|
|
public NotificationProfile Profile { get; set; } = NotificationProfile.CreateDefault();
|
|
}
|
|
|
|
public sealed class NotificationProfile
|
|
{
|
|
public int ScreenIndex { get; set; }
|
|
public ScreenAnchor Anchor { get; set; } = ScreenAnchor.TopRight;
|
|
public double MarginX { get; set; } = 24;
|
|
public double MarginY { get; set; } = 24;
|
|
public double Width { get; set; } = 360;
|
|
public double MaxHeight { get; set; } = 220;
|
|
public double Padding { get; set; } = 18;
|
|
public string FontFamily { get; set; } = "Microsoft YaHei UI";
|
|
public double TitleFontSize { get; set; } = 16;
|
|
public double BodyFontSize { get; set; } = 13;
|
|
public string TextColor { get; set; } = "#F8FAFC";
|
|
public string BackgroundColor { get; set; } = "#242934";
|
|
public double BackgroundOpacity { get; set; } = 0.94;
|
|
public string BorderColor { get; set; } = "#5B6B84";
|
|
public double BorderOpacity { get; set; } = 0.65;
|
|
public double OverallOpacity { get; set; } = 1;
|
|
public double LifetimeSeconds { get; set; } = 4.5;
|
|
public PopupAnimation EnterAnimation { get; set; } = PopupAnimation.Slide;
|
|
public PopupAnimation ExitAnimation { get; set; } = PopupAnimation.Fade;
|
|
public StackMode StackMode { get; set; } = StackMode.Queue;
|
|
public OverflowMode OverflowMode { get; set; } = OverflowMode.Truncate;
|
|
public double SplitIntervalSeconds { get; set; } = 0.6;
|
|
[JsonPropertyName("MarqueeHoldSeconds")]
|
|
public double VerticalScrollHoldSeconds { get; set; } = 1;
|
|
public double VerticalScrollSpeed { get; set; } = 30;
|
|
|
|
public static NotificationProfile CreateDefault() => new();
|
|
}
|
|
|
|
public sealed class HistoryItem
|
|
{
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
public DateTime ReceivedAt { get; set; } = DateTime.Now;
|
|
public string Channel { get; set; } = "";
|
|
public string Title { get; set; } = "";
|
|
public string Body { get; set; } = "";
|
|
public NotificationStatus Status { get; set; }
|
|
}
|
|
|
|
public sealed class IncomingMessage
|
|
{
|
|
public string Channel { get; set; } = "";
|
|
public string Title { get; set; } = "";
|
|
public string Body { get; set; } = "";
|
|
}
|