添加部分功能,以及等高线模型

This commit is contained in:
2509_92447106 committed 2026-11-14 12:42:19 +08:00
1 parent 663efa5c75
commit 512b1814e1
108 files changed
+239 -240

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
<Project> <Project>
<!-- <!--
多目录结构公共属性: 多目录结构公共属性:
src/main/dotnet/<module> 生产代码 GC-BOOT 启动器生产代码
src/test/dotnet/<module> 测试 / 离屏渲染校验 GC/src/test/dotnet/<module> 测试 / 离屏渲染校验
TargetFramework 可由命令行覆盖:dotnet build -p:TargetFramework=net10.0 TargetFramework 可由命令行覆盖:dotnet build -p:TargetFramework=net10.0
--> -->
<PropertyGroup Condition="'$(TargetFramework)' == ''"> <PropertyGroup Condition="'$(TargetFramework)' == ''">
@@ -23,7 +23,7 @@
<MvvmVersion>8.2.2</MvvmVersion> <MvvmVersion>8.2.2</MvvmVersion>
<Version>1.0.7</Version> <Version>1.0.7</Version>
<Company>NeoRF</Company> <Company>NeoRF</Company>
<Product>Earth Model Studio</Product> <Product>GC</Product>
<NeutralLanguage>zh-Hans</NeutralLanguage> <NeutralLanguage>zh-Hans</NeutralLanguage>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -1,8 +1,8 @@
<Application xmlns="https://github.com/avaloniaui" <Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:EarthModelStudio.ViewModels" xmlns:vm="using:GC.ViewModels"
xmlns:views="using:EarthModelStudio.Views" xmlns:views="using:GC.Views"
x:Class="EarthModelStudio.App" x:Class="GC.App"
RequestedThemeVariant="Light"> RequestedThemeVariant="Light">
<Application.DataTemplates> <Application.DataTemplates>
@@ -43,6 +43,6 @@
<Application.Styles> <Application.Styles>
<FluentTheme /> <FluentTheme />
<StyleInclude Source="avares://EarthModelStudio/Styles/AppTheme.axaml" /> <StyleInclude Source="avares://GC/Styles/AppTheme.axaml" />
</Application.Styles> </Application.Styles>
</Application> </Application>
@@ -4,11 +4,11 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using EarthModelStudio.Services; using GC.Services;
using EarthModelStudio.ViewModels; using GC.ViewModels;
using EarthModelStudio.Views; using GC.Views;
namespace EarthModelStudio; namespace GC;
public partial class App : Application public partial class App : Application
{ {
@@ -56,7 +56,7 @@ public partial class App : Application
try try
{ {
using var iconStream = Avalonia.Platform.AssetLoader.Open( using var iconStream = Avalonia.Platform.AssetLoader.Open(
new Uri("avares://EarthModelStudio/Assets/icon.png")); new Uri("avares://GC/Assets/icon.png"));
window.Icon = new Avalonia.Controls.WindowIcon(iconStream); window.Icon = new Avalonia.Controls.WindowIcon(iconStream);
} }
catch { /* 图标缺失不影响启动 */ } catch { /* 图标缺失不影响启动 */ }
File renamed without changes.
File renamed without changes.
@@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>EarthModelStudio</RootNamespace> <RootNamespace>GC</RootNamespace>
<AssemblyName>EarthModelStudio</AssemblyName> <AssemblyName>GC</AssemblyName>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<!-- 应用图标(Windows exe / 任务栏) --> <!-- 应用图标(Windows exe / 任务栏) -->
<ApplicationIcon>Assets\icon.ico</ApplicationIcon> <ApplicationIcon>Assets\icon.ico</ApplicationIcon>
@@ -16,6 +16,7 @@
<ItemGroup> <ItemGroup>
<AvaloniaResource Include="Assets\**" /> <AvaloniaResource Include="Assets\**" />
<Compile Include="..\GC-DRAW\PlayerWindow.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -27,7 +28,7 @@
<!-- 模型契约:启动器与模型唯一的共享代码(不含任何渲染/业务) --> <!-- 模型契约:启动器与模型唯一的共享代码(不含任何渲染/业务) -->
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\model\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj" /> <ProjectReference Include="..\model\_sdk\GC.ModelSdk\GC.ModelSdk.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EarthModelStudio.Models; namespace GC.Models;
/// <summary>应用设置,持久化到 data/settings.json。</summary> /// <summary>应用设置,持久化到 data/settings.json。</summary>
public sealed class AppSettings public sealed class AppSettings
@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EarthModelStudio.Models; namespace GC.Models;
/// <summary>model/&lt;id&gt;/&lt;id&gt;.json 的内容。</summary> /// <summary>model/&lt;id&gt;/&lt;id&gt;.json 的内容。</summary>
public sealed class ModelManifest public sealed class ModelManifest
@@ -1,8 +1,8 @@
using System; using System;
using Avalonia; using Avalonia;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio; namespace GC;
internal static class Program internal static class Program
{ {
@@ -2,13 +2,13 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.IO; using System.IO;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 运行目录约定(可执行文件旁边,不内置任何模型): /// 运行目录约定(可执行文件旁边,不内置任何模型):
/// <code> /// <code>
/// &lt;安装目录&gt;/ /// &lt;安装目录&gt;/
/// EarthModelStudio(.exe | .app/...) /// GC(.exe | .app/...)
/// .GC/ /// .GC/
/// settings.json 设置与已安装版本记录 /// settings.json 设置与已安装版本记录
/// model/ 模型(启动时下载;model 目录也在 .GC 里) /// model/ 模型(启动时下载;model 目录也在 .GC 里)
@@ -20,6 +20,8 @@ namespace EarthModelStudio.Services;
/// </summary> /// </summary>
public sealed class AppPaths public sealed class AppPaths
{ {
private Task _developmentModelsSync = Task.CompletedTask;
/// <summary>安装目录(开发态为仓库根)。</summary> /// <summary>安装目录(开发态为仓库根)。</summary>
public string AppRoot { get; private init; } = ""; public string AppRoot { get; private init; } = "";
@@ -48,7 +50,7 @@ public sealed class AppPaths
// 判定「当前目录」:程序实际所在的位置。 // 判定「当前目录」:程序实际所在的位置。
// · 发布版:可执行文件所在目录(单文件时为 exe 旁,否则为 apphost 目录) // · 发布版:可执行文件所在目录(单文件时为 exe 旁,否则为 apphost 目录)
// · 源码版:仓库根(含 EarthModelStudio.sln 的目录) // · 源码版:仓库根(含 GC.sln 的目录)
// //
// 重要:源码版由 `dotnet run` 启动时 Environment.ProcessPath 指向 dotnet 宿主, // 重要:源码版由 `dotnet run` 启动时 Environment.ProcessPath 指向 dotnet 宿主,
// 直接用它会把 .GC 与更新包写到 dotnet 安装目录去,所以必须先识别源码版。 // 直接用它会把 .GC 与更新包写到 dotnet 安装目录去,所以必须先识别源码版。
@@ -56,7 +58,7 @@ public sealed class AppPaths
if (string.IsNullOrWhiteSpace(repoRoot) || !Directory.Exists(repoRoot)) if (string.IsNullOrWhiteSpace(repoRoot) || !Directory.Exists(repoRoot))
repoRoot = FindRepoRoot(baseDir); repoRoot = FindRepoRoot(baseDir);
var isDev = !string.IsNullOrEmpty(repoRoot) && var isDev = !string.IsNullOrEmpty(repoRoot) &&
File.Exists(Path.Combine(repoRoot!, "EarthModelStudio.sln")); File.Exists(Path.Combine(repoRoot!, "GC.sln"));
string installDir; string installDir;
if (isDev) if (isDev)
@@ -112,7 +114,7 @@ public sealed class AppPaths
home = CanWrite(portableHome) home = CanWrite(portableHome)
? portableHome ? portableHome
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"EarthModelStudio", ".GC"); "GC", ".GC");
} }
var envModels = Environment.GetEnvironmentVariable("EMS_MODELS"); var envModels = Environment.GetEnvironmentVariable("EMS_MODELS");
@@ -148,7 +150,7 @@ public sealed class AppPaths
} }
/// <summary> /// <summary>
/// 从程序所在位置向上找仓库根(含 EarthModelStudio.sln 的目录)。 /// 从程序所在位置向上找仓库根(含 GC.sln 的目录)。
/// ///
/// 关键:程序若位于 .app 包内(或 dist/ 等发布产物目录),**不算开发态**。 /// 关键:程序若位于 .app 包内(或 dist/ 等发布产物目录),**不算开发态**。
/// 否则把 .app 放在仓库的 dist/ 下运行时,会一路向上命中仓库根的 .sln, /// 否则把 .app 放在仓库的 dist/ 下运行时,会一路向上命中仓库根的 .sln,
@@ -166,7 +168,7 @@ public sealed class AppPaths
var name = dir.Name; var name = dir.Name;
if (string.Equals(name, "dist", StringComparison.OrdinalIgnoreCase)) return null; if (string.Equals(name, "dist", StringComparison.OrdinalIgnoreCase)) return null;
if (File.Exists(Path.Combine(dir.FullName, "EarthModelStudio.sln"))) if (File.Exists(Path.Combine(dir.FullName, "GC.sln")))
{ {
// 再确认不是从「发布输出目录」里往上找来的 // 再确认不是从「发布输出目录」里往上找来的
if (IsUnderPublishOutput(start, dir.FullName)) return null; if (IsUnderPublishOutput(start, dir.FullName)) return null;
@@ -249,13 +251,15 @@ public sealed class AppPaths
// 放到后台线程:这一步要复制 coastline.json 等大文件,同步做会拖慢启动。 // 放到后台线程:这一步要复制 coastline.json 等大文件,同步做会拖慢启动。
if (IsDevelopment && string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("EMS_MODELS"))) if (IsDevelopment && string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("EMS_MODELS")))
{ {
var root = HomeRoot; var modelRoot = ModelRoot;
var source = Path.Combine(AppRoot, "model"); var source = Path.Combine(AppRoot, "model");
if (Directory.Exists(source)) if (Directory.Exists(source))
Task.Run(() => SyncDevelopmentModels(root, source)); _developmentModelsSync = Task.Run(() => SyncDevelopmentModels(modelRoot, source));
} }
} }
public void WaitForDevelopmentModels() => _developmentModelsSync.GetAwaiter().GetResult();
private static void SyncDevelopmentModels(string modelRoot, string source) private static void SyncDevelopmentModels(string modelRoot, string source)
{ {
try try
@@ -1,6 +1,6 @@
using System; using System;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary>组合根:一处初始化所有服务。</summary> /// <summary>组合根:一处初始化所有服务。</summary>
public sealed class AppServices public sealed class AppServices
@@ -5,7 +5,7 @@ using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary>GitCode 仓库的一位贡献者。</summary> /// <summary>GitCode 仓库的一位贡献者。</summary>
public sealed class Contributor public sealed class Contributor
@@ -54,7 +54,7 @@ public static class ContributorsService
private static HttpClient CreateHttp() private static HttpClient CreateHttp()
{ {
var c = new HttpClient { Timeout = TimeSpan.FromSeconds(10) }; var c = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
c.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio/1.0"); c.DefaultRequestHeaders.UserAgent.ParseAdd("GC/1.0");
c.DefaultRequestHeaders.Accept.ParseAdd("application/json"); c.DefaultRequestHeaders.Accept.ParseAdd("application/json");
return c; return c;
} }
@@ -5,7 +5,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 本地目录源:用于离线教学(U 盘 / 共享盘里的仓库副本)与自动化测试。 /// 本地目录源:用于离线教学(U 盘 / 共享盘里的仓库副本)与自动化测试。
@@ -5,9 +5,9 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
public enum DownloadState public enum DownloadState
{ {
@@ -5,7 +5,7 @@ using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 启动器更新走 GitCode Release,模型仍走仓库 contents API 的远端源。 /// 启动器更新走 GitCode Release,模型仍走仓库 contents API 的远端源。
@@ -32,7 +32,7 @@ public sealed class GitCodeReleaseRemote : IModelRemote
private static HttpClient CreateHttp() private static HttpClient CreateHttp()
{ {
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(15) }; var client = new HttpClient { Timeout = TimeSpan.FromSeconds(15) };
client.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Updater/1.0"); client.DefaultRequestHeaders.UserAgent.ParseAdd("GC-Updater/1.0");
client.DefaultRequestHeaders.Accept.ParseAdd("application/json"); client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
return client; return client;
} }
@@ -7,7 +7,7 @@ using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// gitcode 仓库源。默认地址来自 AppSettings.UpdateRepository /// gitcode 仓库源。默认地址来自 AppSettings.UpdateRepository
@@ -39,7 +39,7 @@ public sealed class GitCodeRemote : IModelRemote
? DefaultRepository : repository!.TrimEnd('/'); ? DefaultRepository : repository!.TrimEnd('/');
_http = new HttpClient { Timeout = TimeSpan.FromMinutes(2) }; _http = new HttpClient { Timeout = TimeSpan.FromMinutes(2) };
_http.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Updater/1.0"); _http.DefaultRequestHeaders.UserAgent.ParseAdd("GC-Updater/1.0");
_http.DefaultRequestHeaders.Accept.ParseAdd("application/json"); _http.DefaultRequestHeaders.Accept.ParseAdd("application/json");
if (string.IsNullOrWhiteSpace(manifestUrl)) if (string.IsNullOrWhiteSpace(manifestUrl))
@@ -108,7 +108,7 @@ public sealed class GitCodeRemote : IModelRemote
} }
if (!payload.TrimStart().StartsWith("{", StringComparison.Ordinal)) return null; if (!payload.TrimStart().StartsWith("{", StringComparison.Ordinal)) return null;
var version = System.Text.Json.JsonSerializer.Deserialize<RepoVersion>( var version = System.Text.Json.JsonSerializer.Deserialize<RepoVersion>(
payload, EarthModelStudio.Services.Json.Options); payload, GC.Services.Json.Options);
// 404 / 错误页也可能返回一个 JSON 对象,用 generated 确认这确实是版本清单 // 404 / 错误页也可能返回一个 JSON 对象,用 generated 确认这确实是版本清单
return version != null && !string.IsNullOrWhiteSpace(version.Generated) ? version : null; return version != null && !string.IsNullOrWhiteSpace(version.Generated) ? version : null;
} }
@@ -6,7 +6,7 @@ using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// Gitea / Forgejo 后端(Xhmcl 用的就是这个)。 /// Gitea / Forgejo 后端(Xhmcl 用的就是这个)。
@@ -27,7 +27,7 @@ public sealed class GiteaRemote : IModelRemote
private static HttpClient CreateHttp() private static HttpClient CreateHttp()
{ {
var c = new HttpClient { Timeout = TimeSpan.FromSeconds(20) }; var c = new HttpClient { Timeout = TimeSpan.FromSeconds(20) };
c.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Updater/1.0"); c.DefaultRequestHeaders.UserAgent.ParseAdd("GC-Updater/1.0");
c.DefaultRequestHeaders.Accept.ParseAdd("application/json"); c.DefaultRequestHeaders.Accept.ParseAdd("application/json");
return c; return c;
} }
@@ -2,7 +2,7 @@ using System.Text.Encodings.Web;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EarthModelStudio.Services; namespace GC.Services;
public static class Json public static class Json
{ {
@@ -6,9 +6,9 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading; using Avalonia.Threading;
using EarthModelStudio.Views; using GC.Views;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 启动器更新的完整交互流程(「检查更新」与「重新下载启动器」共用): /// 启动器更新的完整交互流程(「检查更新」与「重新下载启动器」共用):
@@ -7,7 +7,7 @@ using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
// =========================================================================== // ===========================================================================
// 启动器更新模块(唯一实现) // 启动器更新模块(唯一实现)
@@ -211,14 +211,14 @@ public static class LauncherUpdater
{ {
using var ms = new MemoryStream(zip); using var ms = new MemoryStream(zip);
using var archive = new System.IO.Compression.ZipArchive(ms, System.IO.Compression.ZipArchiveMode.Read); using var archive = new System.IO.Compression.ZipArchive(ms, System.IO.Compression.ZipArchiveMode.Read);
// 找主程序:app 内的可执行文件 / EarthModelStudio.dll / 单文件 exe // 找主程序:app 内的可执行文件 / GC.dll / 单文件 exe
var entry = archive.Entries.FirstOrDefault(e => var entry = archive.Entries.FirstOrDefault(e =>
e.Name.Equals("EarthModelStudio.dll", StringComparison.OrdinalIgnoreCase)) e.Name.Equals("GC.dll", StringComparison.OrdinalIgnoreCase))
?? archive.Entries.FirstOrDefault(e => ?? archive.Entries.FirstOrDefault(e =>
e.Name.Equals("EarthModelStudio", StringComparison.OrdinalIgnoreCase)) e.Name.Equals("GC", StringComparison.OrdinalIgnoreCase))
?? archive.Entries.FirstOrDefault(e => ?? archive.Entries.FirstOrDefault(e =>
e.Name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && e.Name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) &&
e.Name.StartsWith("EarthModelStudio", StringComparison.OrdinalIgnoreCase)); e.Name.StartsWith("GC", StringComparison.OrdinalIgnoreCase));
if (entry == null) return null; if (entry == null) return null;
await using var es = entry.Open(); await using var es = entry.Open();
@@ -395,7 +395,7 @@ public static class LauncherUpdater
if (!File.Exists(marker)) return false; if (!File.Exists(marker)) return false;
// 安全阀:绝不在源码目录执行替换(防止误删源码) // 安全阀:绝不在源码目录执行替换(防止误删源码)
if (File.Exists(Path.Combine(paths.InstallDirectory, "EarthModelStudio.sln"))) if (File.Exists(Path.Combine(paths.InstallDirectory, "GC.sln")))
{ {
Console.Error.WriteLine("源码版:新版已下载,但拒绝在源码目录执行替换"); Console.Error.WriteLine("源码版:新版已下载,但拒绝在源码目录执行替换");
return false; return false;
@@ -8,7 +8,7 @@ using Avalonia.Markup.Xaml;
using Avalonia.Data; using Avalonia.Data;
using Avalonia.Platform; using Avalonia.Platform;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary>轻量 i18n:键值表 + 运行时切换(所有绑定自动刷新)。</summary> /// <summary>轻量 i18n:键值表 + 运行时切换(所有绑定自动刷新)。</summary>
public sealed class L : INotifyPropertyChanged public sealed class L : INotifyPropertyChanged
@@ -75,7 +75,7 @@ public sealed class L : INotifyPropertyChanged
{ {
try try
{ {
var uri = new Uri($"avares://EarthModelStudio/Assets/i18n/{code}.json"); var uri = new Uri($"avares://GC/Assets/i18n/{code}.json");
using var stream = AssetLoader.Open(uri); using var stream = AssetLoader.Open(uri);
using var reader = new StreamReader(stream); using var reader = new StreamReader(stream);
return JsonSerializer.Deserialize<Dictionary<string, string>>(reader.ReadToEnd(), return JsonSerializer.Deserialize<Dictionary<string, string>>(reader.ReadToEnd(),
@@ -1,6 +1,6 @@
using System; using System;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 启动时运行内存分配(类似启动器的 -Xmx)。 /// 启动时运行内存分配(类似启动器的 -Xmx)。
@@ -11,7 +11,7 @@ public sealed class MemoryBudget
{ {
public int BudgetMb { get; private set; } = 2048; public int BudgetMb { get; private set; } = 2048;
public long BudgetBytes => (long)BudgetMb * 1024L * 1024L; public long BudgetBytes => (long)BudgetMb * 1024L * 1024L;
public long ManagedBytes => GC.GetTotalMemory(false); public long ManagedBytes => System.GC.GetTotalMemory(false);
public event Action? Changed; public event Action? Changed;
@@ -29,7 +29,7 @@ public sealed class MemoryBudget
{ {
try try
{ {
var info = GC.GetGCMemoryInfo(); var info = System.GC.GetGCMemoryInfo();
var totalMb = info.TotalAvailableMemoryBytes / (1024.0 * 1024.0); var totalMb = info.TotalAvailableMemoryBytes / (1024.0 * 1024.0);
if (totalMb > 0) if (totalMb > 0)
return (int)Math.Clamp(Math.Round(totalMb / 4.0 / 256.0) * 256, 512, 8192); return (int)Math.Clamp(Math.Round(totalMb / 4.0 / 256.0) * 256, 512, 8192);
@@ -5,10 +5,10 @@ using System.Reflection;
using System.Runtime.Loader; using System.Runtime.Loader;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 模型宿主:按清单加载模型自己的程序集,拿到模型自带的界面。 /// 模型宿主:按清单加载模型自己的程序集,拿到模型自带的界面。
@@ -176,7 +176,7 @@ public sealed class ModelLoadContext : AssemblyLoadContext
{ {
private static readonly HashSet<string> Shared = new(StringComparer.OrdinalIgnoreCase) private static readonly HashSet<string> Shared = new(StringComparer.OrdinalIgnoreCase)
{ {
"EarthModelStudio.ModelSdk", "GC.ModelSdk",
"Avalonia", "Avalonia",
"Avalonia.Base", "Avalonia.Base",
"Avalonia.Controls", "Avalonia.Controls",
@@ -2,9 +2,9 @@ using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
public static class ModelInstaller public static class ModelInstaller
{ {
@@ -2,9 +2,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 本地模型库。启动器只**扫描 / 删除**模型包,不再解析或缓存任何场景数据 —— /// 本地模型库。启动器只**扫描 / 删除**模型包,不再解析或缓存任何场景数据 ——
@@ -20,6 +20,7 @@ public sealed class ModelRepository
public IReadOnlyList<ModelPackage> Scan() public IReadOnlyList<ModelPackage> Scan()
{ {
_paths.WaitForDevelopmentModels();
var result = new List<ModelPackage>(); var result = new List<ModelPackage>();
foreach (var (manifest, dir) in ModelScanner.Scan(_paths.ModelRoot)) foreach (var (manifest, dir) in ModelScanner.Scan(_paths.ModelRoot))
{ {
@@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
public static class ModelScanner public static class ModelScanner
{ {
@@ -7,9 +7,9 @@ using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 从链接导入模型源。 /// 从链接导入模型源。
@@ -26,7 +26,7 @@ public sealed class ModelSourceClient
private static HttpClient CreateHttp() private static HttpClient CreateHttp()
{ {
var client = new HttpClient { Timeout = TimeSpan.FromMinutes(5) }; var client = new HttpClient { Timeout = TimeSpan.FromMinutes(5) };
client.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio/1.0 (+model-source)"); client.DefaultRequestHeaders.UserAgent.ParseAdd("GC/1.0 (+model-source)");
return client; return client;
} }
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// GitCode/Gitee v5 releases API 的一条 Release(字段做宽松解析,兼容多种返回格式)。 /// GitCode/Gitee v5 releases API 的一条 Release(字段做宽松解析,兼容多种返回格式)。
@@ -2,9 +2,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
public sealed class SettingsService public sealed class SettingsService
{ {
@@ -2,7 +2,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
namespace EarthModelStudio.Services; namespace GC.Services;
public static class Shell public static class Shell
{ {
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 内置下载源。只允许这两个,不再支持用户自定义源。 /// 内置下载源。只允许这两个,不再支持用户自定义源。
@@ -6,7 +6,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 双源选择:Xhmcl 与 GitCode 是同一份仓库的两个镜像。 /// 双源选择:Xhmcl 与 GitCode 是同一份仓库的两个镜像。
@@ -22,7 +22,7 @@ public sealed class SourceSelector
private static HttpClient CreateHttp() private static HttpClient CreateHttp()
{ {
var c = new HttpClient { Timeout = TimeSpan.FromSeconds(6) }; var c = new HttpClient { Timeout = TimeSpan.FromSeconds(6) };
c.DefaultRequestHeaders.UserAgent.ParseAdd("EarthModelStudio-Probe/1.0"); c.DefaultRequestHeaders.UserAgent.ParseAdd("GC-Probe/1.0");
return c; return c;
} }
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary>仓库根 version.json:由构建脚本 VersionStamp 自动生成,模型一改版本就变。</summary> /// <summary>仓库根 version.json:由构建脚本 VersionStamp 自动生成,模型一改版本就变。</summary>
public sealed class RepoVersion public sealed class RepoVersion
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using EarthModelStudio.Models; using GC.Models;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 模型自动更新:读远端版本清单,把缺失/过期的模型下载到 cache 后原子替换 /// 模型自动更新:读远端版本清单,把缺失/过期的模型下载到 cache 后原子替换
@@ -1,7 +1,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 版本号工具:Release tag 有 v1.0.6 / GC-1.0.6 / 1.0.6 等写法, /// 版本号工具:Release tag 有 v1.0.6 / GC-1.0.6 / 1.0.6 等写法,
@@ -2,7 +2,7 @@ using System;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
namespace EarthModelStudio.Services; namespace GC.Services;
/// <summary> /// <summary>
/// 安全解压:拒绝 zip slip(条目名含 ../、绝对路径、盘符), /// 安全解压:拒绝 zip slip(条目名含 ../、绝对路径、盘符),
@@ -4,9 +4,9 @@ using System.Collections.ObjectModel;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.ViewModels; namespace GC.ViewModels;
/// <summary>「关于」页面:版本号 + 开发者(读取仓库 contributors)。</summary> /// <summary>「关于」页面:版本号 + 开发者(读取仓库 contributors)。</summary>
public partial class AboutViewModel : ObservableObject public partial class AboutViewModel : ObservableObject
@@ -9,10 +9,10 @@ using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.ViewModels; namespace GC.ViewModels;
public partial class DownloadViewModel : ObservableObject public partial class DownloadViewModel : ObservableObject
{ {
@@ -6,11 +6,11 @@ using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using EarthModelStudio.Models; using GC.Models;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.ViewModels; namespace GC.ViewModels;
public partial class HomeViewModel : ObservableObject public partial class HomeViewModel : ObservableObject
{ {
@@ -3,10 +3,10 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.ViewModels; namespace GC.ViewModels;
public partial class MainViewModel : ObservableObject public partial class MainViewModel : ObservableObject
{ {
@@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
using System.Windows.Input; using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.ViewModels; namespace GC.ViewModels;
public sealed class LanguageOption public sealed class LanguageOption
{ {
@@ -156,8 +156,8 @@ public partial class SettingsViewModel : ObservableObject
private void ClearCache() private void ClearCache()
{ {
// 模型数据由模型自己管理;这里只回收启动器侧托管内存 // 模型数据由模型自己管理;这里只回收启动器侧托管内存
GC.Collect(); System.GC.Collect();
GC.WaitForPendingFinalizers(); System.GC.WaitForPendingFinalizers();
_services.Memory.Refresh(); _services.Memory.Refresh();
StatusMessage = L.I["set.cacheCleared"]; StatusMessage = L.I["set.cacheCleared"];
OnPropertyChanged(nameof(UsageText)); OnPropertyChanged(nameof(UsageText));
@@ -1,8 +1,8 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
xmlns:vm="using:EarthModelStudio.ViewModels" xmlns:vm="using:GC.ViewModels"
x:Class="EarthModelStudio.Views.AboutView" x:Class="GC.Views.AboutView"
x:DataType="vm:AboutViewModel"> x:DataType="vm:AboutViewModel">
<ScrollViewer> <ScrollViewer>
@@ -1,7 +1,7 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class AboutView : UserControl public partial class AboutView : UserControl
{ {
@@ -1,7 +1,7 @@
<Window xmlns="https://github.com/avaloniaui" <Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
x:Class="EarthModelStudio.Views.ConfirmWindow" x:Class="GC.Views.ConfirmWindow"
Title="{loc:Loc app.name}" Title="{loc:Loc app.name}"
Width="440" SizeToContent="Height" Width="440" SizeToContent="Height"
CanResize="False" ShowInTaskbar="False" CanResize="False" ShowInTaskbar="False"
@@ -4,7 +4,7 @@ using Avalonia.Interactivity;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.Media; using Avalonia.Media;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class ConfirmWindow : Window public partial class ConfirmWindow : Window
{ {
@@ -1,7 +1,7 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
x:Class="EarthModelStudio.Views.DownloadView"> x:Class="GC.Views.DownloadView">
<Grid ColumnDefinitions="316,*" Margin="24,22,24,24"> <Grid ColumnDefinitions="316,*" Margin="24,22,24,24">
@@ -1,7 +1,7 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class DownloadView : UserControl public partial class DownloadView : UserControl
{ {
@@ -1,8 +1,8 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
xmlns:controls="using:EarthModelStudio.Controls" xmlns:controls="using:GC.Controls"
x:Class="EarthModelStudio.Views.HomeView"> x:Class="GC.Views.HomeView">
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="26,24,26,28" Spacing="18"> <StackPanel Margin="26,24,26,28" Spacing="18">
@@ -1,7 +1,7 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class HomeView : UserControl public partial class HomeView : UserControl
{ {
@@ -8,7 +8,7 @@ using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Threading; using Avalonia.Threading;
namespace EarthModelStudio.Views; namespace GC.Views;
/// <summary> /// <summary>
/// 模型启动进度窗:加载模型程序集、生成地表纹理、构建界面的真实进度。 /// 模型启动进度窗:加载模型程序集、生成地表纹理、构建界面的真实进度。
@@ -1,7 +1,7 @@
<Window xmlns="https://github.com/avaloniaui" <Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
x:Class="EarthModelStudio.Views.MainWindow" x:Class="GC.Views.MainWindow"
Title="{loc:Loc app.name}" Title="{loc:Loc app.name}"
Width="1220" Height="800" Width="1220" Height="800"
MinWidth="1040" MinHeight="700" MinWidth="1040" MinHeight="700"
@@ -10,11 +10,11 @@ using System.Linq;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.Services; using GC.Services;
using EarthModelStudio.ViewModels; using GC.ViewModels;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
@@ -1,7 +1,7 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:EarthModelStudio.Services" xmlns:loc="using:GC.Services"
x:Class="EarthModelStudio.Views.SettingsView"> x:Class="GC.Views.SettingsView">
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="26,24,26,32" Spacing="16" MaxWidth="880" HorizontalAlignment="Left"> <StackPanel Margin="26,24,26,32" Spacing="16" MaxWidth="880" HorizontalAlignment="Left">
@@ -1,7 +1,7 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
namespace EarthModelStudio.Views; namespace GC.Views;
public partial class SettingsView : UserControl public partial class SettingsView : UserControl
{ {
@@ -4,9 +4,9 @@ using Avalonia.Controls;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Threading; using Avalonia.Threading;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.Views; namespace GC.Views;
/// <summary> /// <summary>
/// 启动器更新进度窗:更新期间主窗口已关闭,由这个独立小窗展示下载进度。 /// 启动器更新进度窗:更新期间主窗口已关闭,由这个独立小窗展示下载进度。
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="EarthModelStudio.Desktop" /> <assemblyIdentity version="1.0.0.0" name="GC.Desktop" />
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings> <windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
@@ -13,10 +13,10 @@ using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using Shapes = Avalonia.Controls.Shapes; using Shapes = Avalonia.Controls.Shapes;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using EarthModelStudio.Models; using GC.Models;
using EarthModelStudio.Services; using GC.Services;
namespace EarthModelStudio.Views; namespace GC.Views;
/// <summary> /// <summary>
/// 模型窗口:**只做窗口宿主**。 /// 模型窗口:**只做窗口宿主**。
+7 -14
View File
@@ -3,23 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GC-BOOT", "GC-BOOT", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "main", "main", "{ABAA6554-252E-13CE-1B40-0464A7DBA771}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GC", "GC-BOOT\GC.csproj", "{2E3BE2DB-1C4B-4EA0-9523-43EE910BD54C}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{F2BBD9FE-F148-5687-ED21-3ABA515A9B22}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GC", "GC", "{3E72BF5C-0B5E-D5BD-DCAE-6B991004B4A5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EarthModelStudio", "src\main\dotnet\EarthModelStudio\EarthModelStudio.csproj", "{2E3BE2DB-1C4B-4EA0-9523-43EE910BD54C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{09578AA7-0862-3E52-D2AA-D8F7E863B74B}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3E72BF5C-0B5E-D5BD-DCAE-6B991004B4A5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GC.Tests", "GC\src\test\dotnet\GC.Tests\GC.Tests.csproj", "{D15CB92F-5E5C-4516-8D07-C244FC0CD113}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{09578AA7-0862-3E52-D2AA-D8F7E863B74B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EarthModelStudio.Tests", "src\test\dotnet\EarthModelStudio.Tests\EarthModelStudio.Tests.csproj", "{D15CB92F-5E5C-4516-8D07-C244FC0CD113}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_sdk", "_sdk", "{26AABC0C-8B8D-F9B8-86B4-01B1A96D59F4}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_sdk", "_sdk", "{26AABC0C-8B8D-F9B8-86B4-01B1A96D59F4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EarthModelStudio.ModelSdk", "model\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj", "{C8FAB8D5-CAB7-42D7-8A1F-4B79771A2CE0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GC.ModelSdk", "model\_sdk\GC.ModelSdk\GC.ModelSdk.csproj", "{C8FAB8D5-CAB7-42D7-8A1F-4B79771A2CE0}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "model", "model", "{62B8A37E-7066-D91A-6443-87D4E6CE63FE}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "model", "model", "{62B8A37E-7066-D91A-6443-87D4E6CE63FE}"
EndProject EndProject
@@ -110,10 +106,7 @@ Global
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{ABAA6554-252E-13CE-1B40-0464A7DBA771} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} {2E3BE2DB-1C4B-4EA0-9523-43EE910BD54C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{F2BBD9FE-F148-5687-ED21-3ABA515A9B22} = {ABAA6554-252E-13CE-1B40-0464A7DBA771}
{2E3BE2DB-1C4B-4EA0-9523-43EE910BD54C} = {F2BBD9FE-F148-5687-ED21-3ABA515A9B22}
{3E72BF5C-0B5E-D5BD-DCAE-6B991004B4A5} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{09578AA7-0862-3E52-D2AA-D8F7E863B74B} = {3E72BF5C-0B5E-D5BD-DCAE-6B991004B4A5} {09578AA7-0862-3E52-D2AA-D8F7E863B74B} = {3E72BF5C-0B5E-D5BD-DCAE-6B991004B4A5}
{D15CB92F-5E5C-4516-8D07-C244FC0CD113} = {09578AA7-0862-3E52-D2AA-D8F7E863B74B} {D15CB92F-5E5C-4516-8D07-C244FC0CD113} = {09578AA7-0862-3E52-D2AA-D8F7E863B74B}
{C8FAB8D5-CAB7-42D7-8A1F-4B79771A2CE0} = {26AABC0C-8B8D-F9B8-86B4-01B1A96D59F4} {C8FAB8D5-CAB7-42D7-8A1F-4B79771A2CE0} = {26AABC0C-8B8D-F9B8-86B4-01B1A96D59F4}
@@ -4,8 +4,8 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>EarthModelStudio.Tests</RootNamespace> <RootNamespace>GC.Tests</RootNamespace>
<AssemblyName>EarthModelStudio.Tests</AssemblyName> <AssemblyName>GC.Tests</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -14,7 +14,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../../../main/dotnet/EarthModelStudio/EarthModelStudio.csproj" /> <ProjectReference Include="../../../../../GC-BOOT/GC.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -5,22 +5,22 @@ using System.Threading;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using EarthModelStudio.Models; using GC.Models;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Headless; using Avalonia.Headless;
using Avalonia.Threading; using Avalonia.Threading;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using EarthModelStudio; using GC;
using EarthModelStudio.Services; using GC.Services;
using EarthModelStudio.ViewModels; using GC.ViewModels;
using EarthModelStudio.Views; using GC.Views;
namespace EarthModelStudio.Tests; namespace GC.Tests;
/// <summary> /// <summary>
/// 离屏校验工具:把启动器页面和模型窗口渲染成 PNG。 /// 离屏校验工具:把启动器页面和模型窗口渲染成 PNG。
/// 用法:dotnet run --project src/test/dotnet/EarthModelStudio.Tests -- build/screenshots /// 用法:dotnet run --project GC/src/test/dotnet/GC.Tests -- build/screenshots
/// </summary> /// </summary>
internal static class Program internal static class Program
{ {
@@ -221,7 +221,7 @@ internal static class Program
var dir = new DirectoryInfo(AppContext.BaseDirectory); var dir = new DirectoryInfo(AppContext.BaseDirectory);
for (var i = 0; i < 10 && dir != null; i++, dir = dir.Parent) for (var i = 0; i < 10 && dir != null; i++, dir = dir.Parent)
{ {
if (File.Exists(Path.Combine(dir.FullName, "EarthModelStudio.sln"))) return dir.FullName; if (File.Exists(Path.Combine(dir.FullName, "GC.sln"))) return dir.FullName;
} }
return Directory.GetCurrentDirectory(); return Directory.GetCurrentDirectory();
} }
+16 -16
View File
@@ -1,4 +1,4 @@
# Earth Model Studio # GC
天文教学模型**启动器**:管理/启动模型、启动时自动检查并下载最新版模型与启动器、设置语言与内存。 天文教学模型**启动器**:管理/启动模型、启动时自动检查并下载最新版模型与启动器、设置语言与内存。
@@ -17,7 +17,7 @@
``` ```
<安装目录>/ <安装目录>/
EarthModelStudio.exe | EarthModelStudio.app/ GC.exe | GC.app/
.GC/ .GC/
settings.json 设置 + 已安装版本记录 settings.json 设置 + 已安装版本记录
model/ 启动时下载的模型 model/ 启动时下载的模型
@@ -51,23 +51,23 @@
## 目录结构 ## 目录结构
``` ```
EarthModelStudio/ Repository/
├── EarthModelStudio.sln ├── GC.sln
├── Directory.Build.props # 公共构建属性 ├── Directory.Build.props # 公共构建属性
├── version.json # ★ 自动生成的版本清单(推送到仓库后才生效) ├── version.json # ★ 自动生成的版本清单(推送到仓库后才生效)
├── build.sh / build.ps1 # 构建脚本 ├── build.sh / build.ps1 # 构建脚本
├── src/ # ★ 启动器(没有渲染逻辑) ├── GC/ # 原 src 内容
│ └── main/dotnet/EarthModelStudio/ │ └── src/test/dotnet/GC.Tests/ # 离屏校验 + --update-test 离线更新链路验证
│ ├── Models/ Services/ # 清单/设置/目录探测/i18n/模型库/下载/自动更新 ├── GC-BOOT/ # 启动器(不实现模型绘制)
│ │ # UpdateService · GitCodeRemote · DirectoryRemote · LauncherUpdate │ ├── Models/ Services/ # 清单/设置/目录探测/i18n/模型库/下载/自动更新
│ ├── ViewModels/ Views/ # 主页、下载、设置、模型窗口壳、启动更新状态条 │ ├── ViewModels/ Views/ # 主页、下载、设置和启动更新状态
│ └── Assets/i18n/ # 启动器界面语言包 │ └── Assets/i18n/ # 启动器界面语言包
├── src/test/dotnet/…Tests/ # 离屏校验 + --update-test 离线更新链路验证 ├── GC-DRAW/PlayerWindow.cs # 通用模型窗口宿主;实际绘制由模型提供
├── model/ # ★ 模型的一切 ├── model/ # ★ 模型的一切
│ ├── version.json # 与根 version.json 相同(便于按 model/ 地址读取) │ ├── version.json # 与根 version.json 相同(便于按 model/ 地址读取)
│ ├── _sdk/EarthModelStudio.ModelSdk/ │ ├── _sdk/GC.ModelSdk/
│ ├── _engine/ │ ├── _engine/
│ │ ├── src/ # CelestialView / PlanetTexture / EarthModelView … │ │ ├── src/ # 模型专用引擎与渲染,留在 model 内
│ │ ├── PreviewGen/ # 用模型渲染器生成封面 │ │ ├── PreviewGen/ # 用模型渲染器生成封面
│ │ └── VersionStamp/ # 按内容指纹自动打版本、生成 version.json │ │ └── VersionStamp/ # 按内容指纹自动打版本、生成 version.json
│ ├── earth-rotation/ │ ├── earth-rotation/
@@ -99,9 +99,9 @@ Windows 用 `.\build.ps1`(参数相同)。
| 产物 | 平台 | | 产物 | 平台 |
| --- | --- | | --- | --- |
| `dist/mac-arm64/EarthModelStudio.app` | macOS Apple Silicon | | `dist/mac-arm64/GC.app` | macOS Apple Silicon |
| `dist/win-x64/EarthModelStudio.exe` | Windows x64 | | `dist/win-x64/GC.exe` | Windows x64 |
| `dist/win-arm64/EarthModelStudio.exe` | Windows on ARM | | `dist/win-arm64/GC.exe` | Windows on ARM |
均为自包含单文件启动器,**发布包内不含模型**。改完模型: 均为自包含单文件启动器,**发布包内不含模型**。改完模型:
`./build.sh models` → 把 `version.json` 和 `model/` 推送到 gitcode → 客户端下次启动自动更新。 `./build.sh models` → 把 `version.json` 和 `model/` 推送到 gitcode → 客户端下次启动自动更新。
+4 -4
View File
@@ -1,5 +1,5 @@
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Earth Model Studio 构建入口(Windows PowerShell,薄封装) # GC 构建入口(Windows PowerShell,薄封装)
# 实际代码在 buildsh/ 里。Windows 上若无 sh,则走内置的最小实现。 # 实际代码在 buildsh/ 里。Windows 上若无 sh,则走内置的最小实现。
# .\build.ps1 build | check | models | stamp | run | test | clean | doctor # .\build.ps1 build | check | models | stamp | run | test | clean | doctor
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -15,10 +15,10 @@ $Root = $PSScriptRoot
Set-Location $Root Set-Location $Root
$env:AVALONIA_TELEMETRY_OPTOUT = '1' $env:AVALONIA_TELEMETRY_OPTOUT = '1'
$AppProj = 'src/main/dotnet/EarthModelStudio/EarthModelStudio.csproj' $AppProj = 'GC-BOOT/GC.csproj'
$TestProj = 'src/test/dotnet/EarthModelStudio.Tests/EarthModelStudio.Tests.csproj' $TestProj = 'GC/src/test/dotnet/GC.Tests/GC.Tests.csproj'
$StampProj= 'model/_engine/VersionStamp/VersionStamp.csproj' $StampProj= 'model/_engine/VersionStamp/VersionStamp.csproj'
$Sln = 'EarthModelStudio.sln' $Sln = 'GC.sln'
$Version = ([regex]::Match((Get-Content Directory.Build.props -Raw), '<Version>(.*?)</Version>')).Groups[1].Value $Version = ([regex]::Match((Get-Content Directory.Build.props -Raw), '<Version>(.*?)</Version>')).Groups[1].Value
if (-not $Version) { $Version = '1.0.0' } if (-not $Version) { $Version = '1.0.0' }
New-Item -ItemType Directory -Force -Path "$Root/build/logs" | Out-Null New-Item -ItemType Directory -Force -Path "$Root/build/logs" | Out-Null
+4 -4
View File
@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Earth Model Studio 构建入口(薄封装) # GC 构建入口(薄封装)
# #
# ./build.sh build 完整发布(原 publish),带 apt 风格进度条 # ./build.sh build 完整发布(原 publish),带 apt 风格进度条
# ./build.sh check 验证:编译 + 自检 + 离屏渲染 + 产物 # ./build.sh check 验证:编译 + 自检 + 离屏渲染 + 产物
@@ -21,11 +21,11 @@ export AVALONIA_TELEMETRY_OPTOUT=1
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd "$ROOT_DIR" cd "$ROOT_DIR"
APP_PROJ="src/main/dotnet/EarthModelStudio/EarthModelStudio.csproj" APP_PROJ="GC-BOOT/GC.csproj"
PREVIEW_PROJ="model/_engine/PreviewGen/PreviewGen.csproj" PREVIEW_PROJ="model/_engine/PreviewGen/PreviewGen.csproj"
STAMP_PROJ="model/_engine/VersionStamp/VersionStamp.csproj" STAMP_PROJ="model/_engine/VersionStamp/VersionStamp.csproj"
TEST_PROJ="src/test/dotnet/EarthModelStudio.Tests/EarthModelStudio.Tests.csproj" TEST_PROJ="GC/src/test/dotnet/GC.Tests/GC.Tests.csproj"
SLN="EarthModelStudio.sln" SLN="GC.sln"
VERSION=$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' Directory.Build.props | head -1) VERSION=$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' Directory.Build.props | head -1)
[ -n "$VERSION" ] || VERSION="1.0.0" [ -n "$VERSION" ] || VERSION="1.0.0"
+1 -1
View File
@@ -45,7 +45,7 @@ bs_build() {
package_mac_app package_mac_app
prepare_runtime_layout "dist/win-x64" prepare_runtime_layout "dist/win-x64"
prepare_runtime_layout "dist/win-arm64" prepare_runtime_layout "dist/win-arm64"
prepare_runtime_layout "dist/mac-arm64/EarthModelStudio.app/Contents/MacOS" prepare_runtime_layout "dist/mac-arm64/GC.app/Contents/MacOS"
progress_step "打包 zip"; progress_tick 100 progress_step "打包 zip"; progress_tick 100
pack_launcher pack_launcher
+11 -11
View File
@@ -24,7 +24,7 @@ build_models() {
for DLL in "$DIR"src/bin/Release/net8.0/*.dll; do for DLL in "$DIR"src/bin/Release/net8.0/*.dll; do
[ -f "$DLL" ] || continue [ -f "$DLL" ] || continue
NAME=$(basename "$DLL") NAME=$(basename "$DLL")
[ "$NAME" = "EarthModelStudio.ModelSdk.dll" ] && continue [ "$NAME" = "GC.ModelSdk.dll" ] && continue
cp "$DLL" "$DIR$ID.model/" cp "$DLL" "$DIR$ID.model/"
echo " -> model/$ID/$ID.model/$NAME" echo " -> model/$ID/$ID.model/$NAME"
done done
@@ -131,12 +131,12 @@ pack_launcher() {
done done
# --- macOS:先得到真实 .app 目录(改名 + 同步 Info.plist)--- # --- macOS:先得到真实 .app 目录(改名 + 同步 Info.plist)---
MACAPP="$ROOT_DIR/dist/mac-arm64/EarthModelStudio.app" MACAPP="$ROOT_DIR/dist/mac-arm64/GC.app"
if [ -d "$MACAPP" ]; then if [ -d "$MACAPP" ]; then
FINAL="$ROOT_DIR/dist/GC-${VERSION}-mac-arm64.app" FINAL="$ROOT_DIR/dist/GC-${VERSION}-mac-arm64.app"
rm -rf "$FINAL" rm -rf "$FINAL"
mv "$MACAPP" "$FINAL" mv "$MACAPP" "$FINAL"
chmod +x "$FINAL/Contents/MacOS/EarthModelStudio" 2>/dev/null || true chmod +x "$FINAL/Contents/MacOS/GC" 2>/dev/null || true
PLIST="$FINAL/Contents/Info.plist" PLIST="$FINAL/Contents/Info.plist"
if [ -f "$PLIST" ]; then if [ -f "$PLIST" ]; then
/usr/libexec/PlistBuddy -c "Set :CFBundleName Morris GC" "$PLIST" 2>/dev/null || true /usr/libexec/PlistBuddy -c "Set :CFBundleName Morris GC" "$PLIST" 2>/dev/null || true
@@ -192,7 +192,7 @@ strip_intermediate_dirs() {
package_mac_app() { package_mac_app() {
DIST="$ROOT_DIR/dist/mac-arm64" DIST="$ROOT_DIR/dist/mac-arm64"
APP="$DIST/EarthModelStudio.app" APP="$DIST/GC.app"
rm -rf "$APP" rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cat > "$APP/Contents/Info.plist" <<PLIST cat > "$APP/Contents/Info.plist" <<PLIST
@@ -200,13 +200,13 @@ package_mac_app() {
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleName</key><string>Earth Model Studio</string> <key>CFBundleName</key><string>GC</string>
<key>CFBundleDisplayName</key><string>Earth Model Studio</string> <key>CFBundleDisplayName</key><string>GC</string>
<key>CFBundleIdentifier</key><string>cn.neorf.earthmodelstudio</string> <key>CFBundleIdentifier</key><string>cn.neorf.GC</string>
<key>CFBundleVersion</key><string>${VERSION}</string> <key>CFBundleVersion</key><string>${VERSION}</string>
<key>CFBundleShortVersionString</key><string>${VERSION}</string> <key>CFBundleShortVersionString</key><string>${VERSION}</string>
<key>CFBundlePackageType</key><string>APPL</string> <key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleExecutable</key><string>EarthModelStudio</string> <key>CFBundleExecutable</key><string>GC</string>
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string> <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>LSMinimumSystemVersion</key><string>11.0</string> <key>LSMinimumSystemVersion</key><string>11.0</string>
<key>NSHighResolutionCapable</key><true/> <key>NSHighResolutionCapable</key><true/>
@@ -215,12 +215,12 @@ package_mac_app() {
PLIST PLIST
for f in "$DIST"/*; do for f in "$DIST"/*; do
base=$(basename "$f") base=$(basename "$f")
[ "$base" = "EarthModelStudio.app" ] && continue [ "$base" = "GC.app" ] && continue
[ "$base" = ".DS_Store" ] && continue [ "$base" = ".DS_Store" ] && continue
mv "$f" "$APP/Contents/MacOS/" mv "$f" "$APP/Contents/MacOS/"
done done
# 应用图标:由 Assets/icon-1024.png 生成 .icns # 应用图标:由 Assets/icon-1024.png 生成 .icns
ICONSRC="$ROOT_DIR/src/main/dotnet/EarthModelStudio/Assets/icon-1024.png" ICONSRC="$ROOT_DIR/GC-BOOT/Assets/icon-1024.png"
if [ -f "$ICONSRC" ] && command -v iconutil >/dev/null 2>&1; then if [ -f "$ICONSRC" ] && command -v iconutil >/dev/null 2>&1; then
ICONSET="$DIST/AppIcon.iconset" ICONSET="$DIST/AppIcon.iconset"
rm -rf "$ICONSET"; mkdir -p "$ICONSET" rm -rf "$ICONSET"; mkdir -p "$ICONSET"
@@ -241,7 +241,7 @@ PLIST
# 发布包不带 .GC 运行骨架(用户首次启动自行创建),避免覆盖用户数据 # 发布包不带 .GC 运行骨架(用户首次启动自行创建),避免覆盖用户数据
rm -rf "$APP/Contents/MacOS/.GC" rm -rf "$APP/Contents/MacOS/.GC"
chmod +x "$APP/Contents/MacOS/EarthModelStudio" chmod +x "$APP/Contents/MacOS/GC"
echo "==> 已打包 $APP" echo "==> 已打包 $APP"
} }
+2 -2
View File
@@ -17,7 +17,7 @@
``` ```
model/ model/
version.json # 版本清单(与仓库根 version.json 相同,自动生成) version.json # 版本清单(与仓库根 version.json 相同,自动生成)
_sdk/EarthModelStudio.ModelSdk/ # 模型契约(启动器与模型唯一的共享代码) _sdk/GC.ModelSdk/ # 模型契约(启动器与模型唯一的共享代码)
_engine/ # 共享引擎源码 _engine/ # 共享引擎源码
src/ # CelestialView / PlanetTexture / EarthModelView / SphereRaster… src/ # CelestialView / PlanetTexture / EarthModelView / SphereRaster…
PreviewGen/ # 用模型渲染器生成封面的小工具 PreviewGen/ # 用模型渲染器生成封面的小工具
@@ -81,7 +81,7 @@ model/
## 模型契约(model/_sdk) ## 模型契约(model/_sdk)
模型只依赖一个极小的契约程序集 `EarthModelStudio.ModelSdk`(源码在 `model/_sdk/`): 模型只依赖一个极小的契约程序集 `GC.ModelSdk`(源码在 `model/_sdk/`):
```csharp ```csharp
public interface IModelFactory public interface IModelFactory
+1 -1
View File
@@ -23,7 +23,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj" /> <ProjectReference Include="..\..\_sdk\GC.ModelSdk\GC.ModelSdk.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+2 -2
View File
@@ -9,7 +9,7 @@ using Avalonia.Controls;
using Avalonia.Headless; using Avalonia.Headless;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
using NeoRF.EarthModels; using NeoRF.EarthModels;
namespace NeoRF.EarthModels.Preview; namespace NeoRF.EarthModels.Preview;
@@ -210,7 +210,7 @@ internal static class Program
// 契约与 Avalonia 一律回到默认上下文,与启动器 ModelLoadContext 一致 // 契约与 Avalonia 一律回到默认上下文,与启动器 ModelLoadContext 一致
if (name.Name is null) return null; if (name.Name is null) return null;
if (name.Name.StartsWith("System", StringComparison.OrdinalIgnoreCase)) return null; if (name.Name.StartsWith("System", StringComparison.OrdinalIgnoreCase)) return null;
var shared = new[] { "EarthModelStudio.ModelSdk", "Avalonia", "Avalonia.Base", var shared = new[] { "GC.ModelSdk", "Avalonia", "Avalonia.Base",
"Avalonia.Controls", "Avalonia.Skia", "Avalonia.Themes.Fluent", "SkiaSharp", "HarfBuzzSharp" }; "Avalonia.Controls", "Avalonia.Skia", "Avalonia.Themes.Fluent", "SkiaSharp", "HarfBuzzSharp" };
if (shared.Contains(name.Name, StringComparer.OrdinalIgnoreCase)) return null; if (shared.Contains(name.Name, StringComparer.OrdinalIgnoreCase)) return null;
var candidate = Path.Combine(dataDir, name.Name + ".dll"); var candidate = Path.Combine(dataDir, name.Name + ".dll");
+1 -1
View File
@@ -403,7 +403,7 @@ public class CelestialView : Control, IDisposable
_sphere?.Dispose(); _sphere?.Dispose();
_sphere = null; _sphere = null;
_sphereSize = 0; _sphereSize = 0;
GC.SuppressFinalize(this); System.GC.SuppressFinalize(this);
} }
private void OnTick(object? sender, EventArgs e) private void OnTick(object? sender, EventArgs e)
+2 -2
View File
@@ -9,7 +9,7 @@ using Avalonia.Input;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Threading; using Avalonia.Threading;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
@@ -187,7 +187,7 @@ public sealed class EarthModelView : UserControl, IDisposable
} }
_canvas.Dispose(); _canvas.Dispose();
_closeup.Dispose(); _closeup.Dispose();
GC.SuppressFinalize(this); System.GC.SuppressFinalize(this);
} }
private string CurrentView { get; set; } = "rotation"; private string CurrentView { get; set; } = "rotation";
+2 -2
View File
@@ -1,6 +1,6 @@
using System; using System;
using Avalonia.Controls; using Avalonia.Controls;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
@@ -40,6 +40,6 @@ public sealed class EarthModelRuntime : IModelRuntime
public void Dispose() public void Dispose()
{ {
_scene = null; _scene = null;
GC.SuppressFinalize(this); System.GC.SuppressFinalize(this);
} }
} }
@@ -4,8 +4,8 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<RootNamespace>EarthModelStudio.ModelSdk</RootNamespace> <RootNamespace>GC.ModelSdk</RootNamespace>
<AssemblyName>EarthModelStudio.ModelSdk</AssemblyName> <AssemblyName>GC.ModelSdk</AssemblyName>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Description>Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。</Description> <Description>Earth Model 模型契约:启动器与模型之间唯一的编译期依赖。</Description>
</PropertyGroup> </PropertyGroup>
@@ -1,7 +1,7 @@
using System; using System;
using Avalonia.Controls; using Avalonia.Controls;
namespace EarthModelStudio.ModelSdk; namespace GC.ModelSdk;
/// <summary> /// <summary>
/// 模型入口契约。模型程序集里必须有一个公开、无参构造的 <see cref="IModelFactory"/> 实现, /// 模型入口契约。模型程序集里必须有一个公开、无参构造的 <see cref="IModelFactory"/> 实现,
+2 -2
View File
@@ -25,6 +25,6 @@
"button": "#9FB4D4", "button": "#9FB4D4",
"frame": "#0A1524" "frame": "#0A1524"
}, },
"updatedAt": "2026-11-14T02:48:20Z", "updatedAt": "2026-11-14T04:41:38Z",
"build": "4d5485eed8" "build": "e4299c5c99"
} }
+1 -1
View File
@@ -15,7 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj"> <ProjectReference Include="..\..\_sdk\GC.ModelSdk\GC.ModelSdk.csproj">
<Private>false</Private> <Private>false</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
+2 -2
View File
@@ -4,7 +4,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.ContourMap; namespace NeoRF.ContourMap;
@@ -49,7 +49,7 @@ public sealed class ContourMapRuntime : IModelRuntime
{ {
_field = null; _field = null;
_texts = null; _texts = null;
GC.SuppressFinalize(this); System.GC.SuppressFinalize(this);
} }
private static Dictionary<string, string> LoadTexts(string dataDir, string language) private static Dictionary<string, string> LoadTexts(string dataDir, string language)
+2 -2
View File
@@ -18,7 +18,7 @@
], ],
"dataDir": "earth-geography.model", "dataDir": "earth-geography.model",
"version": "1.8", "version": "1.8",
"updatedAt": "2026-11-14T02:48:20Z", "updatedAt": "2026-11-14T04:41:38Z",
"chrome": { "chrome": {
"titleBar": "#0C1828", "titleBar": "#0C1828",
"titleBorder": "#1B2740", "titleBorder": "#1B2740",
@@ -26,5 +26,5 @@
"button": "#9FB4D4", "button": "#9FB4D4",
"frame": "#0A1524" "frame": "#0A1524"
}, },
"build": "ede9f2fdd0" "build": "64b985e484"
} }
@@ -21,7 +21,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj"> <ProjectReference Include="..\..\_sdk\GC.ModelSdk\GC.ModelSdk.csproj">
<Private>false</Private> <Private>false</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
@@ -5,7 +5,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Media; using Avalonia.Media;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
@@ -258,7 +258,7 @@ public sealed class GeographyRuntime : IModelRuntime
_disposables.Clear(); _disposables.Clear();
_view?.StopAnimation(); _view?.StopAnimation();
_view = null; _view = null;
GC.SuppressFinalize(this); System.GC.SuppressFinalize(this);
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Media; using Avalonia.Media;
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
+2 -2
View File
@@ -24,7 +24,7 @@
"preview": "preview.png", "preview": "preview.png",
"apiVersion": 1, "apiVersion": 1,
"version": "1.6", "version": "1.6",
"updatedAt": "2026-11-14T02:48:20Z", "updatedAt": "2026-11-14T04:41:38Z",
"chrome": { "chrome": {
"titleBar": "#0C1828", "titleBar": "#0C1828",
"titleBorder": "#1B2740", "titleBorder": "#1B2740",
@@ -32,5 +32,5 @@
"button": "#9FB4D4", "button": "#9FB4D4",
"frame": "#0A1524" "frame": "#0A1524"
}, },
"build": "bbd2908c17" "build": "7fda246d48"
} }
@@ -20,7 +20,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj"> <ProjectReference Include="..\..\_sdk\GC.ModelSdk\GC.ModelSdk.csproj">
<Private>false</Private> <Private>false</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
@@ -1,4 +1,4 @@
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
+2 -2
View File
@@ -24,7 +24,7 @@
"preview": "preview.png", "preview": "preview.png",
"apiVersion": 1, "apiVersion": 1,
"version": "1.6", "version": "1.6",
"updatedAt": "2026-11-14T02:48:20Z", "updatedAt": "2026-11-14T04:41:38Z",
"chrome": { "chrome": {
"titleBar": "#0C1828", "titleBar": "#0C1828",
"titleBorder": "#1B2740", "titleBorder": "#1B2740",
@@ -32,5 +32,5 @@
"button": "#9FB4D4", "button": "#9FB4D4",
"frame": "#0A1524" "frame": "#0A1524"
}, },
"build": "b54f691efe" "build": "446633f2b9"
} }
@@ -20,7 +20,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\_sdk\EarthModelStudio.ModelSdk\EarthModelStudio.ModelSdk.csproj"> <ProjectReference Include="..\..\_sdk\GC.ModelSdk\GC.ModelSdk.csproj">
<Private>false</Private> <Private>false</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
@@ -1,4 +1,4 @@
using EarthModelStudio.ModelSdk; using GC.ModelSdk;
namespace NeoRF.EarthModels; namespace NeoRF.EarthModels;
+2 -2
View File
@@ -25,7 +25,7 @@
"preview": "preview.png", "preview": "preview.png",
"apiVersion": 1, "apiVersion": 1,
"version": "1.5", "version": "1.5",
"updatedAt": "2026-11-14T02:48:20Z", "updatedAt": "2026-11-14T04:41:38Z",
"chrome": { "chrome": {
"titleBar": "#FFFFFF", "titleBar": "#FFFFFF",
"titleBorder": "#E3E8F3", "titleBorder": "#E3E8F3",
@@ -33,5 +33,5 @@
"button": "#5B6A86", "button": "#5B6A86",
"frame": "#F4F6FB" "frame": "#F4F6FB"
}, },
"build": "f95a08e72a" "build": "f7913ac484"
} }
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff. Show more