From 1e09a91e1b12dbac77123abbb4f30dd62aba5773 Mon Sep 17 00:00:00 2001 From: Harlan-H <370256750@qq.com> Date: Mon, 10 Oct 2022 12:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 62 ++++++++++--------- .../DownloadMultipleSetupViewModel.cs | 4 +- .../ViewModels/DownloadViewModel.cs | 8 +-- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 86f195a..4f4239c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,11 @@ name: main -on: push +on: + push: + branches: + - master + tags: + - "*" jobs: package: @@ -16,59 +21,60 @@ jobs: uses: actions/checkout@v3 - name: Install .NET - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.100 + dotnet-version: 6.0.x - name: Publish - run: dotnet publish BiliDownloader/ -o BiliDownloader/bin/Publish --configuration Release + run: | + dotnet publish BiliDownloader/ -o BiliDownloader/bin/Publish --configuration Release + dotnet publish BiliDownloader/ -o BiliDownloader/bin/PublishSingleFile -c Release --self-contained true -r win7-x64 -p:PublishSingleFile=true - - name: Upload artifacts + - name: Upload artifacts normal if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} uses: actions/upload-artifact@v3 with: name: BiliDownloader path: BiliDownloader/bin/Publish + - name: Upload artifacts single file + if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + uses: actions/upload-artifact@v3 + with: + name: BiliDownloader-SingleFile + path: BiliDownloader/bin/PublishSingleFile + deploy: if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} needs: package runs-on: ubuntu-latest steps: - - name: Download artifacts + - name: Download artifacts normal uses: actions/download-artifact@v3 with: name: BiliDownloader path: BiliDownloader + - name: Download artifacts single file + uses: actions/download-artifact@v3 + with: + name: BiliDownloader-SingleFile + path: BiliDownloader-SingleFile + - name: Create package - run: Compress-Archive -Path BiliDownloader/* -DestinationPath BiliDownloader.zip -Force + run: | + Compress-Archive -Path BiliDownloader/* -DestinationPath BiliDownloader.zip -Force + Compress-Archive -Path BiliDownloader-SingleFile/* -DestinationPath BiliDownloader-SingleFile.zip -Force shell: pwsh - name: Create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} body: | - [Changelog](https://github.com/Harlan-H/BiliDownloader/blob/master/Changelog.md) + - [更新日志](https://github.com/Harlan-H/BiliDownloader/blob/master/Changelog.md) draft: false prerelease: false - - - name: Upload release asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_name: BiliDownloader.zip - asset_path: BiliDownloader.zip - asset_content_type: application/zip - - - uses: geekyeggo/delete-artifact@v1 - with: - name: BiliDownloader + files: | + BiliDownloader.zip + BiliDownloader-SingleFile.zip \ No newline at end of file diff --git a/BiliDownloader/ViewModels/DownloadMultipleSetupViewModel.cs b/BiliDownloader/ViewModels/DownloadMultipleSetupViewModel.cs index 23740fd..31f4561 100644 --- a/BiliDownloader/ViewModels/DownloadMultipleSetupViewModel.cs +++ b/BiliDownloader/ViewModels/DownloadMultipleSetupViewModel.cs @@ -31,8 +31,6 @@ public class DownloadMultipleSetupViewModel : DialogScreen AvailableVideos { get; set; } = Array.Empty(); public IList SelectedVideos { get; set; } = Array.Empty(); - //todo 增加checkbox 如果字幕数组大于0 则可用 - //todo 当checkbox选中说明需要下载字幕 public DownloadMultipleSetupViewModel(IViewModelFactory viewModelFactory, SettingsService settingsService) { this.viewModelFactory = viewModelFactory; @@ -64,7 +62,7 @@ public void Confirm() PathEx.CreateDirectoryForFile(filePath); - var download = viewModelFactory.CreateDownloadViewModel(playlist, filePath,true); + var download = viewModelFactory.CreateDownloadViewModel(playlist, filePath); downloads.Add(download); } diff --git a/BiliDownloader/ViewModels/DownloadViewModel.cs b/BiliDownloader/ViewModels/DownloadViewModel.cs index 76e4b5a..90f70f8 100644 --- a/BiliDownloader/ViewModels/DownloadViewModel.cs +++ b/BiliDownloader/ViewModels/DownloadViewModel.cs @@ -122,11 +122,11 @@ public void OnShowFile() if (!CanOnShowFile) return; + if (string.IsNullOrWhiteSpace(FilePath)) + return; + try { - if (string.IsNullOrWhiteSpace(FilePath)) - return; - Process.Start("explorer", $"/select, \"{FilePath}\""); } catch (Exception) @@ -143,7 +143,7 @@ public void Dispose() public static class DownloadViewModelExtensions { - public static DownloadViewModel CreateDownloadViewModel(this IViewModelFactory viewModelFactory, IPlaylist playlist,string filePath,bool isDownloadSubtitle) + public static DownloadViewModel CreateDownloadViewModel(this IViewModelFactory viewModelFactory, IPlaylist playlist,string filePath) { var view = viewModelFactory.CreateDownloadViewModel(); view.Playlist = playlist;