Files
Shigure/Infrastructure/AppInfo.cs
liantian-cn c1ec9a9ff3 feat: 模块目录迁移至用户配置目录
模块存储位置从 exe 旁 baseDirectory/module 迁移到 {UserProfile}/.config/{AppName}/module
(AppName 动态取程序集名,Windows 下为 C:\Users\<用户名>\.config\Shigure\module)。

- ModuleStore.ResolveModuleDirectory 改为无参静态方法,删除 Shigure.csproj 检测死代码
- AppInfo 新增 AppName(程序集名单一来源,与 Version 惯例一致)
- Program.cs 新增启动迁移提示:旧目录有内容且新目录无模块文件时弹纯文案提示
- StatusForm 关于页在路径位于 exe 目录外时显示完整路径;编辑器打开文件夹跟随新路径
- csproj 删除 module 复制项;仓库根 module/ 示例目录保留
- 文档同步更新(README/CLAUDE/打包说明/Obsidian 01/11/00/10)
- 旧模块不自动迁移,由提示引导用户手动移动
2026-08-15 11:21:10 +08:00

33 lines
1.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Reflection;
namespace Shigure;
/// <summary>
/// 应用名称与版本信息的单一来源AppName 取自程序集名,
/// Version 优先取 csproj 的 &lt;Version&gt;(AssemblyInformationalVersion),退化到 AssemblyVersion。
/// </summary>
internal static class AppInfo
{
// 取自程序集名(重命名程序集时自动跟随),与 Version 从程序集读取的惯例一致。
public static string AppName { get; } = Assembly.GetExecutingAssembly().GetName().Name ?? "Shigure";
public static string Version { get; } = ResolveVersion();
private static string ResolveVersion()
{
var assembly = Assembly.GetExecutingAssembly();
var informational = assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion;
if (!string.IsNullOrWhiteSpace(informational))
{
// 去掉构建元数据后缀(如 "1.1.0+abc123")。
var plus = informational.IndexOf('+');
return plus >= 0 ? informational[..plus] : informational;
}
return assembly.GetName().Version?.ToString() ?? "未知";
}
}