diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index e1d9092..4168b9b 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -22,12 +22,7 @@ env: # Configuring Dotnet Build Commands PUBLISH_OUTPUT_FOLDER: Publish - PUBLISH_SELF_CONTAINED: true - PUBLISH_SINGLE_FILE: true - PUBLISH_READY_TO_RUN: false PUBLISH_AOT: false # currently only Console App Supported - PUBLISH_TRIMMED: true - PUBLISH_TRIM_MODE: partial # or full # Configuring GitHub Release IS_PRE_RELEASE: false @@ -45,6 +40,7 @@ jobs: strategy: matrix: platform: [x64, x86, arm64] + publish_flavor: [Portable, Slim] steps: - uses: actions/checkout@v4 @@ -81,20 +77,20 @@ jobs: # Building with configured commands - run: | $runtimeIdentifier = "${{ matrix.platform }}" - dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-$($runtimeIdentifier.ToLower()) /p:GITHUB_ACTIONS=true -p:Platform=${{ matrix.platform }} --self-contained ${{ env.PUBLISH_SELF_CONTAINED }} -p:PublishSingleFile=${{ env.PUBLISH_SINGLE_FILE }} -p:PublishReadyToRun=${{ env.PUBLISH_READY_TO_RUN }} -p:PublishTrimmed=${{ env.PUBLISH_TRIMMED }} -p:TrimMode=${{ env.PUBLISH_TRIM_MODE }} -p:PublishAot=${{ env.PUBLISH_AOT }} --output ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }} + dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-$($runtimeIdentifier.ToLower()) /p:GITHUB_ACTIONS=true -p:Platform=${{ matrix.platform }} -p:PublishFlavor=${{ matrix.publish_flavor }} -p:PublishAot=${{ env.PUBLISH_AOT }} --output ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }}/${{ matrix.publish_flavor }} # Zipping folder and all files - uses: vimtor/action-zip@v1.2 with: - files: ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }} + files: ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }}/${{ matrix.publish_flavor }} recursive: true - dest: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.assembly-version }}-${{ matrix.platform }}.zip + dest: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.assembly-version }}-${{ matrix.platform }}-${{ matrix.publish_flavor }}.zip # Uploading all zip files to access them in the 'release' job - uses: actions/upload-artifact@v4 with: - name: artifacts-${{ matrix.platform }} - path: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.assembly-version }}-${{ matrix.platform }}.zip + name: artifacts-${{ matrix.platform }}-${{ matrix.publish_flavor }} + path: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.assembly-version }}-${{ matrix.platform }}-${{ matrix.publish_flavor }}.zip # Checking version suffix for words like [alpha, beta, preview, and experiment]. Marking the release as a pre-release if any exists. - run: | @@ -154,12 +150,33 @@ jobs: # Installing a package for generating a changelog file - run: npm install -g auto-changelog - run: auto-changelog --tag-pattern .+ --commit-limit false --starting-version v${{ env.APP_VERSION }} --ending-version v${{ env.APP_VERSION }} --hide-credit + + # Compose bilingual release notes with flavor explanation + changelog + - run: | + cat > RELEASE_BODY.md <<'EOF' + ## Package Flavors / 安装包版本说明 + + - **Portable**: Self-contained package. No preinstalled .NET runtime required. Larger size. + - **Slim**: Framework-dependent package. Smaller size, but requires runtime dependencies on target machine. + + - **Portable(便携版)**:自包含版本,通常不需要预装 .NET 运行时,体积较大。 + - **Slim(轻量版)**:依赖运行时版本,体积更小,但目标机器需满足运行时依赖。 + + ### Artifact Naming / 产物命名 + + - `SimpleList-vVERSION-PLATFORM-Portable.zip` + - `SimpleList-vVERSION-PLATFORM-Slim.zip` + + --- + + EOF + cat CHANGELOG.md >> RELEASE_BODY.md # Creating a Release in GitHub - uses: ncipollo/release-action@v1 with: artifacts: "${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-*.zip" - bodyFile: "CHANGELOG.md" + bodyFile: "RELEASE_BODY.md" name: v${{ env.APP_VERSION }} tag: v${{ env.APP_VERSION }} prerelease: ${{ env.IS_PRE_RELEASE }} diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml index 2b2821e..08cb4fa 100644 --- a/.github/workflows/dotnet-release.yml +++ b/.github/workflows/dotnet-release.yml @@ -21,12 +21,7 @@ env: # Configuring Dotnet Build Commands PUBLISH_OUTPUT_FOLDER: Publish - PUBLISH_SELF_CONTAINED: false - PUBLISH_SINGLE_FILE: false - PUBLISH_READY_TO_RUN: false PUBLISH_AOT: false # currently only Console App Supported - PUBLISH_TRIMMED: false - PUBLISH_TRIM_MODE: partial # or full # Configuring GitHub Release IS_PRE_RELEASE: false @@ -44,6 +39,7 @@ jobs: strategy: matrix: platform: [x64, x86, arm64] # Change platform if you want to build only a specific platform + publish_flavor: [Portable, Slim] steps: - uses: actions/checkout@v4 @@ -80,20 +76,20 @@ jobs: # Building with configured commands - run: | $runtimeIdentifier = "${{ matrix.platform }}" - dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-$($runtimeIdentifier.ToLower()) /p:GITHUB_ACTIONS=true -p:Platform=${{ matrix.platform }} --self-contained ${{ env.PUBLISH_SELF_CONTAINED }} -p:PublishSingleFile=${{ env.PUBLISH_SINGLE_FILE }} -p:PublishReadyToRun=${{ env.PUBLISH_READY_TO_RUN }} -p:PublishTrimmed=${{ env.PUBLISH_TRIMMED }} -p:TrimMode=${{ env.PUBLISH_TRIM_MODE }} -p:PublishAot=${{ env.PUBLISH_AOT }} --output ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }} + dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-$($runtimeIdentifier.ToLower()) /p:GITHUB_ACTIONS=true -p:Platform=${{ matrix.platform }} -p:PublishFlavor=${{ matrix.publish_flavor }} -p:PublishAot=${{ env.PUBLISH_AOT }} --output ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }}/${{ matrix.publish_flavor }} # Zipping folder and all files - uses: vimtor/action-zip@v1.2 with: - files: ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }} + files: ${{ env.PUBLISH_OUTPUT_FOLDER }}/${{ matrix.platform }}/${{ matrix.publish_flavor }} recursive: true - dest: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.version }}-${{ matrix.platform }}.zip + dest: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.version }}-${{ matrix.platform }}-${{ matrix.publish_flavor }}.zip # Uploading all zip files to access them in the 'release' job - uses: actions/upload-artifact@v4 with: - name: artifacts-${{ matrix.platform }} - path: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.version }}-${{ matrix.platform }}.zip + name: artifacts-${{ matrix.platform }}-${{ matrix.publish_flavor }} + path: ${{ env.APP_NAME }}-v${{ steps.get-version.outputs.version }}-${{ matrix.platform }}-${{ matrix.publish_flavor }}.zip # Checking version suffix for words like [alpha, beta, preview, and experiment]. Marking the release as a pre-release if any exists. - run: | @@ -153,12 +149,33 @@ jobs: # Installing a package for generating a changelog file - run: npm install -g auto-changelog - run: auto-changelog --tag-pattern .+ --commit-limit false --starting-version v${{ env.APP_VERSION }} --ending-version v${{ env.APP_VERSION }} --hide-credit + + # Compose bilingual release notes with flavor explanation + changelog + - run: | + cat > RELEASE_BODY.md <<'EOF' + ## Package Flavors / 安装包版本说明 + + - **Portable**: Self-contained package. No preinstalled .NET runtime required. Larger size. + - **Slim**: Framework-dependent package. Smaller size, but requires runtime dependencies on target machine. + + - **Portable(便携版)**:自包含版本,通常不需要预装 .NET 运行时,体积较大。 + - **Slim(轻量版)**:依赖运行时版本,体积更小,但目标机器需满足运行时依赖。 + + ### Artifact Naming / 产物命名 + + - `YOUR_APP_NAME-vVERSION-PLATFORM-Portable.zip` + - `YOUR_APP_NAME-vVERSION-PLATFORM-Slim.zip` + + --- + + EOF + cat CHANGELOG.md >> RELEASE_BODY.md # Creating a Release in GitHub - uses: ncipollo/release-action@v1 with: artifacts: "${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-*.zip" - bodyFile: "CHANGELOG.md" + bodyFile: "RELEASE_BODY.md" name: v${{ env.APP_VERSION }} tag: v${{ env.APP_VERSION }} prerelease: ${{ env.IS_PRE_RELEASE }} diff --git a/.vscode/launch.json b/.vscode/launch.json index 0fabd3d..89a54f9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "preLaunchTask": "build", // if target frameworks was changed, update program path. "program": - "${workspaceFolder}/SimpleList/bin/x64/Debug/net9.0-windows10.0.19041.0/win-x64/SimpleList.exe", + "${workspaceFolder}/SimpleList/bin/x64/Debug/net10.0-windows10.0.19041.0/win-x64/SimpleList.exe", "args": [], "cwd": "${workspaceFolder}/SimpleList", // 'console' field https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/README.md b/README.md index c0b8933..e6c5e5c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,66 @@ SimpleList is a OneDrive files index application developed using WinUI3. Unzip and then double click +# Release Flavors + +Two package flavors are provided in GitHub Releases. + +| Flavor | Description | Typical size | Best for | +| --- | --- | --- | --- | +| Portable | Self-contained package. No preinstalled .NET runtime required. | Larger | End users who want zero setup | +| Slim | Framework-dependent package. Requires matching .NET runtime/Windows App SDK runtime on target machine. | Smaller | Users who care about download size | + +GitHub Releases now publish both flavors for each platform: + +- `SimpleList-vVERSION-x64-Portable.zip` +- `SimpleList-vVERSION-x64-Slim.zip` + +For Chinese documentation, see [README_zh_CN.md](./README_zh_CN.md). + +## Local Publish Examples + +Portable (self-contained): + +```powershell +dotnet publish .\SimpleList\SimpleList.csproj -c Release -r win-x64 -p:PublishFlavor=Portable +``` + +Slim (framework-dependent): + +```powershell +dotnet publish .\SimpleList\SimpleList.csproj -c Release -r win-x64 -p:PublishFlavor=Slim +``` + +## Validate CI Locally (Without Running on GitHub) + +You can validate workflow logic locally before pushing. + +### 1) Validate workflow YAML and action usage + +Use [actionlint](https://github.com/rhysd/actionlint): + +```powershell +docker run --rm -v "${PWD}:/repo" -w /repo rhysd/actionlint:latest +``` + +### 2) Simulate the publish matrix locally + +Run all flavors and platforms with a local script: + +```powershell +$platforms = @("x64", "x86", "arm64") +$flavors = @("Portable", "Slim") +foreach ($p in $platforms) { + foreach ($f in $flavors) { + dotnet publish .\SimpleList\SimpleList.csproj -c Release -r "win-$($p.ToLower())" -p:Platform=$p -p:PublishFlavor=$f + } +} +``` + +### 3) Verify release notes content generation locally + +The workflow generates `RELEASE_BODY.md` and appends `CHANGELOG.md`. You can execute the same shell snippet locally (Git Bash/WSL) and inspect the output file before pushing. + # Settings Modify `SimpleList/appsettings.json` to customize the configuration. diff --git a/README_zh_CN.md b/README_zh_CN.md index e3693ec..3947964 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -1,44 +1,96 @@ # SimpleList -[English](./README.md) | +[English](./README.md) | 简体中文 ![simplelist](https://socialify.git.ci/aiguoli/simplelist/image?description=1&font=Raleway&language=1&name=1&stargazers=1&theme=Light) -OneDriveбʹWinUI3 +SimpleList 是一个使用 WinUI3 开发的 OneDrive 文件索引应用。 -# ʹ÷ +# 使用 -ѹ˫ +解压后双击运行。 -# +# 发布版本说明 -޸`SimpleList/appsettings.json`ԶClientIDá +GitHub Release 提供两种安装包: -# +| 版本 | 说明 | 典型体积 | 适用场景 | +| --- | --- | --- | --- | +| Portable | 自包含版本(self-contained),目标机器通常不需要预装 .NET 运行时。 | 较大 | 希望开箱即用的用户 | +| Slim | 依赖运行时版本(framework-dependent),目标机器需要满足 .NET/Windows App SDK 运行时依赖。 | 较小 | 更在意下载体积的用户 | -- [x] б -- [x] -- [x] -- [x] Ԥ -- [x] ؽ -- [x] ϴ -- [ ] Զͬ -- [x] -- [x] ɾ -- [x] -- [x] -- [x] תΪPDFļ -- [ ] tab -- [ ] Զ -- [x] ˻ -- [x] -- [x] ҳ +每个平台都会产出两类压缩包: -# ѡ +- `SimpleList-vVERSION-x64-Portable.zip` +- `SimpleList-vVERSION-x64-Slim.zip` -WinFormsWPF̫ˣAvalonia̫òףHTML+CSS+JSĿ̫IcedSlint̬֪֣ѡWinUI3дˬĵҲȽһд˺WinUI3ȨĿˡ +## 本地发布命令示例 -# ͼܲ°汾 +Portable(自包含): + +```powershell +dotnet publish .\SimpleList\SimpleList.csproj -c Release -r win-x64 -p:PublishFlavor=Portable +``` + +Slim(轻量): + +```powershell +dotnet publish .\SimpleList\SimpleList.csproj -c Release -r win-x64 -p:PublishFlavor=Slim +``` + +# 不上线验证 CI 的方法 + +你可以在本地先验证 workflow,再决定是否推送。 + +## 1) 校验 workflow 语法与 Action 用法 + +使用 actionlint: + +```powershell +docker run --rm -v "${PWD}:/repo" -w /repo rhysd/actionlint:latest +``` + +## 2) 本地模拟 CI 的发布矩阵 + +```powershell +$platforms = @("x64", "x86", "arm64") +$flavors = @("Portable", "Slim") +foreach ($p in $platforms) { + foreach ($f in $flavors) { + dotnet publish .\SimpleList\SimpleList.csproj -c Release -r "win-$($p.ToLower())" -p:Platform=$p -p:PublishFlavor=$f + } +} +``` + +## 3) 本地检查 Release 描述文件 + +workflow 会生成 `RELEASE_BODY.md` 并追加 `CHANGELOG.md`。可在本地执行同样的脚本片段(Git Bash/WSL)并检查该文件内容,确认中英说明与变更日志符合预期。 + +# 设置 + +修改 `SimpleList/appsettings.json` 可自定义配置。 + +# 功能 + +- [x] 列表 +- [x] 下载 +- [x] 分享 +- [x] 预览 +- [x] 下载进度 +- [x] 上传 +- [ ] 自动同步 +- [x] 重命名 +- [x] 删除 +- [x] 属性 +- [x] 总容量信息 +- [x] 转换为 PDF +- [ ] 新标签页打开 +- [ ] 自定义主题 +- [x] 多账号 +- [x] 国际化 +- [x] 工具页 + +# 截图(可能不是最新版本) ![HomePage](./ScreenShots/HomePage.png) ![CloudPage](./ScreenShots/CloudPage.png) diff --git a/SimpleList.sln b/SimpleList.sln index 8ebec5b..a6ac485 100644 --- a/SimpleList.sln +++ b/SimpleList.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33712.159 +# Visual Studio Version 18 +VisualStudioVersion = 18.2.11415.280 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleList", "SimpleList\SimpleList.csproj", "{88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}" EndProject @@ -14,14 +14,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决 EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|Any CPU.ActiveCfg = Debug|x64 + {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|Any CPU.Build.0 = Debug|x64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|ARM64.ActiveCfg = Debug|ARM64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|ARM64.Build.0 = Debug|ARM64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|ARM64.Deploy.0 = Debug|ARM64 @@ -31,6 +35,8 @@ Global {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|x86.ActiveCfg = Debug|x86 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|x86.Build.0 = Debug|x86 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Debug|x86.Deploy.0 = Debug|x86 + {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Release|Any CPU.ActiveCfg = Release|x64 + {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Release|Any CPU.Build.0 = Release|x64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Release|ARM64.ActiveCfg = Release|ARM64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Release|ARM64.Build.0 = Release|ARM64 {88F4E1E7-EE5D-44D1-AC7C-4986DF8725DA}.Release|ARM64.Deploy.0 = Release|ARM64 diff --git a/SimpleList/App.xaml.cs b/SimpleList/App.xaml.cs index 2b555eb..d12dafc 100644 --- a/SimpleList/App.xaml.cs +++ b/SimpleList/App.xaml.cs @@ -50,7 +50,6 @@ public App() LogError("UI Thread Exception", sender, args.Exception); args.Handled = true; }; - LogError("UI Thread Exception", new object { }, new Exception()); } public static void LogError(string title, object sender, Exception exception) @@ -71,8 +70,24 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) Title = Assembly.GetEntryAssembly().GetName().Name, }; - GetThemeService?.Initialize(m_window, true, "theme.json"); m_window.Activate(); + m_window.DispatcherQueue.TryEnqueue(() => + { + var themeService = GetThemeService; + if (themeService != null) + { + themeService.Initialize(m_window, true, "theme.json"); + + string cfgMaterial = Configuration.GetSection("Material").Value; + string cfgTheme = Configuration.GetSection("Theme").Value; + + var backdropType = Enum.TryParse(cfgMaterial, out BackdropType parsedBackdrop) ? parsedBackdrop : BackdropType.Mica; + var elementTheme = Enum.TryParse(cfgTheme, out ElementTheme parsedTheme) ? parsedTheme : ElementTheme.Default; + + themeService.ConfigBackdrop(backdropType); + themeService.ConfigElementTheme(elementTheme); + } + }); //string selectedTheme = Configuration.GetSection("Theme").Value; //ThemeHelper.RootTheme = Enum.TryParse(selectedTheme, out ElementTheme theme) ? theme : ElementTheme.Default; @@ -89,12 +104,11 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) private ServiceProvider ConfigureServices() { LoadSettings(); - MsalCacheHelper CacheHelper = GetCacheHelper().GetAwaiter().GetResult(); var services = new ServiceCollection(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(CacheHelper); - services.AddSingleton(BuildPublicApp()); + services.AddSingleton>(sp => GetCacheHelper()); + services.AddSingleton(sp => BuildPublicApp()); return services.BuildServiceProvider(); } diff --git a/SimpleList/Pages/DrivePage.xaml b/SimpleList/Pages/DrivePage.xaml index 5cf5bee..12774c8 100644 --- a/SimpleList/Pages/DrivePage.xaml +++ b/SimpleList/Pages/DrivePage.xaml @@ -48,12 +48,12 @@ IsIndeterminate="True" ShowError="False" ShowPaused="False" - Visibility="{Binding IsLoading}" /> + Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay}" /> @@ -86,19 +86,19 @@ FontSize="14" Glyph="" /> - + -