diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..40ce1ec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +name: Build and Test + +on: + push: + pull_request: + +jobs: + + test: + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: dotnet restore -v m + - name: Run Tests + run: dotnet test -v m + + build_wpf: + needs: test + strategy: + matrix: + build_configuration: [Debug, Release] + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: nuget restore -Verbosity quiet + - name: Build WPF + run: msbuild /nologo /v:m /p:Configuration="${{ matrix.build_configuration }}" + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: WPF-${{ matrix.build_configuration }} + path: BililiveRecorder.WPF/bin/${{ matrix.build_configuration }} + + build_cli: + needs: test + strategy: + matrix: + rid: [any, linux-arm, linux-arm64, linux-x64, osx-x64, win-x64] + build_configuration: [Debug, Release] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: dotnet restore -v m + - name: Build CLI + if: ${{ matrix.rid == 'any' }} + run: dotnet publish -c ${{ matrix.build_configuration }} BililiveRecorder.Cli\BililiveRecorder.Cli.csproj + - name: Build CLI + if: ${{ matrix.rid != 'any' }} + run: dotnet publish -c ${{ matrix.build_configuration }} -r ${{ matrix.rid }} BililiveRecorder.Cli\BililiveRecorder.Cli.csproj + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: CLI-${{ matrix.rid }}-${{ matrix.build_configuration }} + path: BililiveRecorder.Cli/publish/${{ matrix.build_configuration }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ccff7f2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,102 @@ +name: Release + +on: + release: + types: [published] + +jobs: + + test: + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: dotnet restore -v m + - name: Run Tests + run: dotnet test -v m + + release_wpf: + needs: test + strategy: + matrix: + build_configuration: [Release] + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: nuget restore -Verbosity quiet + - name: Build WPF + run: msbuild /nologo /v:m /p:Configuration="${{ matrix.build_configuration }}" + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: WPF-${{ matrix.build_configuration }} + path: BililiveRecorder.WPF/bin/${{ matrix.build_configuration }} + - name: Pack Release Asset + run: 7z a BililiveRecorder-WPF-Portable.zip BililiveRecorder.WPF/bin/${{ matrix.build_configuration }} + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: BililiveRecorder-WPF-Portable.zip + asset_name: BililiveRecorder-WPF-Portable.zip + asset_content_type: application/zip + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: BililiveRecorder.WPF\bin\SquirrelReleases\Setup.exe + asset_name: BililiveRecorder-WPF-Setup.exe + asset_content_type: application/vnd.microsoft.portable-executable + + release_cli: + needs: test + strategy: + matrix: + rid: [any, linux-arm, linux-arm64, linux-x64, osx-x64, win-x64] + build_configuration: [Release] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Restore Packages + run: dotnet restore -v m + - name: Build CLI + if: ${{ matrix.rid == 'any' }} + run: dotnet publish -c ${{ matrix.build_configuration }} BililiveRecorder.Cli\BililiveRecorder.Cli.csproj + - name: Build CLI + if: ${{ matrix.rid != 'any' }} + run: dotnet publish -c ${{ matrix.build_configuration }} -r ${{ matrix.rid }} BililiveRecorder.Cli\BililiveRecorder.Cli.csproj + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: CLI-${{ matrix.rid }}-${{ matrix.build_configuration }} + path: BililiveRecorder.Cli/publish/${{ matrix.build_configuration }} + - name: Pack Release Asset + run: | + cd BililiveRecorder.Cli/publish + zip -r CLI-${{ matrix.rid }}-${{ matrix.build_configuration }}.zip ./${{ matrix.build_configuration }} + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: BililiveRecorder.Cli/publish/CLI-${{ matrix.rid }}-${{ matrix.build_configuration }}.zip + asset_name: BililiveRecorder-CLI-${{ matrix.rid }}.zip + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index eb2eee4..2103d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -261,6 +261,4 @@ paket-files/ __pycache__/ *.pyc -TempBuildInfo/*.cs -BililiveRecorder.WPF/Nlog.config BililiveRecorder.Cli/Properties/launchSettings.json diff --git a/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj b/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj index 1ed705d..b671d53 100644 --- a/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj +++ b/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj @@ -1,32 +1,23 @@ + Exe - netcoreapp3.1 - enable - 9.0 + net5.0 BililiveRecorder.Cli.Program win-x64;osx-x64;osx.10.11-x64;linux-arm64;linux-arm;linux-x64 + publish\any publish\$(RuntimeIdentifier) false true + - - - - - - - - - Always - - + @@ -39,10 +30,9 @@ + - - - + diff --git a/BililiveRecorder.Cli/NLog.config b/BililiveRecorder.Cli/NLog.config deleted file mode 100644 index bad8ba7..0000000 --- a/BililiveRecorder.Cli/NLog.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/BililiveRecorder.Core/BililiveRecorder.Core.csproj b/BililiveRecorder.Core/BililiveRecorder.Core.csproj index f1b4bb5..c0a8ceb 100644 --- a/BililiveRecorder.Core/BililiveRecorder.Core.csproj +++ b/BililiveRecorder.Core/BililiveRecorder.Core.csproj @@ -1,24 +1,12 @@ + netstandard2.0 - 9.0 - 0.0.0.0 - Genteure - Genteure - Copyright © 2018 - 2021 Genteure - 0.0.0.0 - 0.0.0.0 - 2.0 true - enable - - portable true - - - + @@ -30,13 +18,9 @@ + - - - cd $(SolutionDir) - powershell -ExecutionPolicy Bypass -File .\CI\patch_buildinfo.ps1 Core - - + \ No newline at end of file diff --git a/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs b/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs index 9c7516e..d22313d 100644 --- a/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs +++ b/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs @@ -181,7 +181,7 @@ namespace BililiveRecorder.Core.Danmaku writer.WriteStartDocument(); writer.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"#s\""); writer.WriteStartElement("i"); - writer.WriteComment("\nB站录播姬 " + BuildInfo.Version + " " + BuildInfo.HeadSha1 + "\n本文件的弹幕信息兼容B站主站视频弹幕XML格式\n本XML自带样式可以在浏览器里打开(推荐使用Chrome)\n\nsc 为SuperChat\ngift为礼物\nguard为上船\n\nattribute \"raw\" 为原始数据\n"); + writer.WriteComment("\nB站录播姬 " + GitVersionInformation.FullSemVer + "\n本文件的弹幕信息兼容B站主站视频弹幕XML格式\n本XML自带样式可以在浏览器里打开(推荐使用Chrome)\n\nsc 为SuperChat\ngift为礼物\nguard为上船\n\nattribute \"raw\" 为原始数据\n"); writer.WriteElementString("chatserver", "chat.bilibili.com"); writer.WriteElementString("chatid", "0"); writer.WriteElementString("mission", "0"); @@ -190,7 +190,7 @@ namespace BililiveRecorder.Core.Danmaku writer.WriteElementString("real_name", "0"); writer.WriteElementString("source", "0"); writer.WriteStartElement("BililiveRecorder"); - writer.WriteAttributeString("version", BuildInfo.Version + "-" + BuildInfo.HeadShaShort); + writer.WriteAttributeString("version", GitVersionInformation.FullSemVer); writer.WriteEndElement(); writer.WriteStartElement("BililiveRecorderRecordInfo"); writer.WriteAttributeString("roomid", room.RoomConfig.RoomId.ToString()); diff --git a/BililiveRecorder.Core/Recording/RecordTask.cs b/BililiveRecorder.Core/Recording/RecordTask.cs index 4528701..7327bd6 100644 --- a/BililiveRecorder.Core/Recording/RecordTask.cs +++ b/BililiveRecorder.Core/Recording/RecordTask.cs @@ -224,7 +224,6 @@ namespace BililiveRecorder.Core.Recording if (scriptTagBody.Values.Count == 2 && scriptTagBody.Values[1] is ScriptDataEcmaArray value) { var now = DateTimeOffset.Now; - const string version = "TODO-dev-1.3.x"; value["Title"] = (ScriptDataString)this.room.Title; value["Artist"] = (ScriptDataString)$"{this.room.Name} ({this.room.RoomConfig.RoomId})"; value["Comment"] = (ScriptDataString) @@ -233,12 +232,13 @@ namespace BililiveRecorder.Core.Recording $"直播标题: {this.room.Title}\n" + $"直播分区: {this.room.AreaNameParent}·{this.room.AreaNameChild}\n" + $"录制时间: {now:O}\n" + - $"\n使用 B站录播姬 录制 https://rec.danmuji.org\n" + - $"录播姬版本: {version}"); + $"\n" + + $"使用 B站录播姬 录制 https://rec.danmuji.org\n" + + $"录播姬版本: {GitVersionInformation.FullSemVer}"); value["BililiveRecorder"] = new ScriptDataEcmaArray { ["RecordedBy"] = (ScriptDataString)"BililiveRecorder B站录播姬", - ["RecorderVersion"] = (ScriptDataString)version, // TODO fix version + ["RecorderVersion"] = (ScriptDataString)GitVersionInformation.FullSemVer, ["StartTime"] = (ScriptDataDate)now, ["RoomId"] = (ScriptDataString)this.room.RoomConfig.RoomId.ToString(), ["ShortId"] = (ScriptDataString)this.room.ShortId.ToString(), diff --git a/BililiveRecorder.Core/Room.cs b/BililiveRecorder.Core/Room.cs index 16e262a..e5cc5bd 100644 --- a/BililiveRecorder.Core/Room.cs +++ b/BililiveRecorder.Core/Room.cs @@ -325,7 +325,7 @@ namespace BililiveRecorder.Core this.logger.Verbose("Recording stats: {@stats}", e); var diff = DateTimeOffset.UtcNow - this.recordTaskStartTime; - this.Stats.SessionDuration = diff.Subtract(TimeSpan.FromMilliseconds(diff.Milliseconds)); + this.Stats.SessionDuration = TimeSpan.FromSeconds(Math.Round(diff.TotalSeconds)); this.Stats.FileMaxTimestamp = TimeSpan.FromMilliseconds(e.FileMaxTimestamp); this.Stats.SessionMaxTimestamp = TimeSpan.FromMilliseconds(e.SessionMaxTimestamp); this.Stats.DuraionRatio = e.DuraionRatio; diff --git a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs index 4d6943a..40f4878 100644 --- a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs +++ b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs @@ -19,7 +19,7 @@ namespace BililiveRecorder.Core.SimpleWebhook static BasicWebhookV1() { client = new HttpClient(); - client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{typeof(BasicWebhookV1).Assembly.GetName().Version}-{BuildInfo.HeadShaShort}"); + client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{GitVersionInformation.FullSemVer}"); } public BasicWebhookV1(ConfigV2 config) diff --git a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs index 4d3e8dd..757653d 100644 --- a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs +++ b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs @@ -22,7 +22,7 @@ namespace BililiveRecorder.Core.SimpleWebhook this.config = config ?? throw new ArgumentNullException(nameof(config)); this.client = new HttpClient(); - this.client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{typeof(BasicWebhookV1).Assembly.GetName().Version}-{BuildInfo.HeadShaShort}"); + this.client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{GitVersionInformation.FullSemVer}"); } public Task SendSessionStartedAsync(RecordSessionStartedEventArgs args) => diff --git a/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj b/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj index 7703c65..646df7c 100644 --- a/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj +++ b/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj @@ -1,24 +1,24 @@ - + - - netstandard2.0 - 8.0 - enable - true - + + netstandard2.0 + true + portable + true + - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + diff --git a/BililiveRecorder.Flv/Pipeline/Rules/HandleNewHeaderRule.cs b/BililiveRecorder.Flv/Pipeline/Rules/HandleNewHeaderRule.cs index 76fe65f..b37d909 100644 --- a/BililiveRecorder.Flv/Pipeline/Rules/HandleNewHeaderRule.cs +++ b/BililiveRecorder.Flv/Pipeline/Rules/HandleNewHeaderRule.cs @@ -20,7 +20,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules public Task RunAsync(FlvProcessingContext context, Func next) { - if (!(context.OriginalInput is PipelineHeaderAction header)) + if (context.OriginalInput is not PipelineHeaderAction header) return next(); else { diff --git a/BililiveRecorder.Flv/Pipeline/Rules/RemoveDuplicatedChunkRule.cs b/BililiveRecorder.Flv/Pipeline/Rules/RemoveDuplicatedChunkRule.cs index aaf8610..543f117 100644 --- a/BililiveRecorder.Flv/Pipeline/Rules/RemoveDuplicatedChunkRule.cs +++ b/BililiveRecorder.Flv/Pipeline/Rules/RemoveDuplicatedChunkRule.cs @@ -21,7 +21,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules public Task RunAsync(FlvProcessingContext context, Func next) { - if (!(context.OriginalInput is PipelineDataAction data)) + if (context.OriginalInput is not PipelineDataAction data) return next(); else { diff --git a/BililiveRecorder.WPF/App.config b/BililiveRecorder.WPF/App.config index 7158f48..a932133 100644 --- a/BililiveRecorder.WPF/App.config +++ b/BililiveRecorder.WPF/App.config @@ -1,8 +1,6 @@ - + - - - - + + - \ No newline at end of file + diff --git a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj index 53d74ae..c82005d 100644 --- a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj +++ b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj @@ -1,5 +1,6 @@  - + Debug @@ -12,8 +13,6 @@ 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 - 9.0 - enable true @@ -82,7 +81,6 @@ MSBuild:Compile Designer - AddRoomCard.xaml @@ -238,8 +236,6 @@ - - NewMainWindow.xaml @@ -276,11 +272,6 @@ - - Always - - - @@ -296,6 +287,10 @@ + + all + runtime; build; native; contentfiles; analyzers + 1.0.8 @@ -311,16 +306,11 @@ 12.0.3 - - 4.7.1 - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - 3.0.6 + 3.0.7 - 3.0.6 + 3.0.7 2.0.1 @@ -359,18 +349,16 @@ 3.8.0 - - - cd $(SolutionDir) -powershell -ExecutionPolicy Bypass -File .\CI\patch_buildinfo.ps1 WPF -copy /y .\BililiveRecorder.WPF\NLog.$(ConfigurationName).config .\BililiveRecorder.WPF\NLog.config - - - .\SquirrelRelease - - - + + + + + bin\NupkgReleases\ + bin\SquirrelReleases\ + + + \ No newline at end of file diff --git a/BililiveRecorder.WPF/BililiveRecorder.nuspec b/BililiveRecorder.WPF/BililiveRecorder.nuspec index cd994e9..37414c0 100644 --- a/BililiveRecorder.WPF/BililiveRecorder.nuspec +++ b/BililiveRecorder.WPF/BililiveRecorder.nuspec @@ -12,6 +12,6 @@ zh-CN - + diff --git a/BililiveRecorder.WPF/Converters/BoolToValueConverter.cs b/BililiveRecorder.WPF/Converters/BoolToValueConverter.cs index ae7c891..ce3b48e 100644 --- a/BililiveRecorder.WPF/Converters/BoolToValueConverter.cs +++ b/BililiveRecorder.WPF/Converters/BoolToValueConverter.cs @@ -13,21 +13,10 @@ namespace BililiveRecorder.WPF.Converters public object TrueValue { get => this.GetValue(TrueValueProperty); set => this.SetValue(TrueValueProperty, value); } public object FalseValue { get => this.GetValue(FalseValueProperty); set => this.SetValue(FalseValueProperty, value); } - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value == null) - { - return this.FalseValue; - } - else - { - return (bool)value ? this.TrueValue : this.FalseValue; - } - } + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => + value == null ? this.FalseValue : (bool)value ? this.TrueValue : this.FalseValue; - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return value != null ? value.Equals(this.TrueValue) : false; - } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => + value != null && value.Equals(this.TrueValue); } } diff --git a/BililiveRecorder.WPF/MockData/MockRecordedRoom.cs b/BililiveRecorder.WPF/MockData/MockRecordedRoom.cs deleted file mode 100644 index 739945a..0000000 --- a/BililiveRecorder.WPF/MockData/MockRecordedRoom.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.ComponentModel; -using BililiveRecorder.Core; -using BililiveRecorder.Core.Config.V2; - -#nullable enable -namespace BililiveRecorder.WPF.MockData -{ -#if false && DEBUG - internal class MockRecordedRoom : IRecordedRoom - { - private bool disposedValue; - - public MockRecordedRoom() - { - this.RoomId = 123456789; - this.ShortRoomId = 1234; - this.StreamerName = "Mock主播名Mock主播名Mock主播名Mock主播名"; - this.IsMonitoring = false; - this.IsRecording = true; - this.IsStreaming = true; - this.DownloadSpeedPersentage = 100d; - this.DownloadSpeedMegaBitps = 2.45d; - } - - public int ShortRoomId { get; set; } - - public int RoomId { get; set; } - - public string StreamerName { get; set; } - - public string Title { get; set; } = string.Empty; - - public IStreamMonitor StreamMonitor { get; set; } = null!; - - public IFlvStreamProcessor? Processor { get; set; } - - public bool IsMonitoring { get; set; } - - public bool IsRecording { get; set; } - - public bool IsDanmakuConnected { get; set; } - - public bool IsStreaming { get; set; } - - public double DownloadSpeedPersentage { get; set; } - - public double DownloadSpeedMegaBitps { get; set; } - - public DateTime LastUpdateDateTime { get; set; } - - public Guid Guid { get; } = Guid.NewGuid(); - - public RoomConfig RoomConfig => new RoomConfig(); - - public event PropertyChangedEventHandler? PropertyChanged; - - public event EventHandler? RecordEnded; - - public void Clip() - { - } - - public void RefreshRoomInfo() - { - } - - public void Shutdown() - { - } - - public bool Start() - { - this.IsMonitoring = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.IsMonitoring))); - return true; - } - - public void StartRecord() - { - this.IsRecording = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.IsRecording))); - } - - public void Stop() - { - this.IsMonitoring = false; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.IsMonitoring))); - } - - public void StopRecord() - { - this.IsRecording = false; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.IsRecording))); - } - - protected virtual void Dispose(bool disposing) - { - if (!this.disposedValue) - { - if (disposing) - { - // TODO: dispose managed state (managed objects) - } - - // TODO: free unmanaged resources (unmanaged objects) and override finalizer - // TODO: set large fields to null - this.disposedValue = true; - } - } - - // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources - // ~MockRecordedRoom() - // { - // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - // Dispose(disposing: false); - // } - - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - this.Dispose(disposing: true); - GC.SuppressFinalize(this); - } - } -#endif -} diff --git a/BililiveRecorder.WPF/MockData/MockRecorder.cs b/BililiveRecorder.WPF/MockData/MockRecorder.cs deleted file mode 100644 index 0b639b1..0000000 --- a/BililiveRecorder.WPF/MockData/MockRecorder.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using BililiveRecorder.Core; -using BililiveRecorder.Core.Config.V2; - -namespace BililiveRecorder.WPF.MockData -{ -#if false && DEBUG - internal class MockRecorder : IRecorder - { - private bool disposedValue; - - public MockRecorder() - { - this.Rooms.Add(new MockRecordedRoom - { - IsMonitoring = false, - IsRecording = false - }); - this.Rooms.Add(new MockRecordedRoom - { - IsMonitoring = true, - IsRecording = false - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 100, - DownloadSpeedMegaBitps = 12.45 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 95, - DownloadSpeedMegaBitps = 789.45 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 90 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 85 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 80 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 75 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 70 - }); - this.Rooms.Add(new MockRecordedRoom - { - DownloadSpeedPersentage = 109 - }); - } - - private ObservableCollection Rooms { get; } = new ObservableCollection(); - - public ConfigV2 Config { get; } = new ConfigV2(); - - public int Count => this.Rooms.Count; - - public bool IsReadOnly => true; - - int ICollection.Count => this.Rooms.Count; - - bool ICollection.IsReadOnly => true; - - public IRecordedRoom this[int index] => this.Rooms[index]; - - public event PropertyChangedEventHandler PropertyChanged - { - add => (this.Rooms as INotifyPropertyChanged).PropertyChanged += value; - remove => (this.Rooms as INotifyPropertyChanged).PropertyChanged -= value; - } - - public event NotifyCollectionChangedEventHandler CollectionChanged - { - add => (this.Rooms as INotifyCollectionChanged).CollectionChanged += value; - remove => (this.Rooms as INotifyCollectionChanged).CollectionChanged -= value; - } - - void ICollection.Add(IRecordedRoom item) => throw new NotSupportedException("Collection is readonly"); - - void ICollection.Clear() => throw new NotSupportedException("Collection is readonly"); - - bool ICollection.Remove(IRecordedRoom item) => throw new NotSupportedException("Collection is readonly"); - - bool ICollection.Contains(IRecordedRoom item) => this.Rooms.Contains(item); - - void ICollection.CopyTo(IRecordedRoom[] array, int arrayIndex) => this.Rooms.CopyTo(array, arrayIndex); - - public IEnumerator GetEnumerator() => this.Rooms.GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() => this.Rooms.GetEnumerator(); - - IEnumerator IEnumerable.GetEnumerator() => this.Rooms.GetEnumerator(); - - public bool Initialize(string workdir) - { - this.Config.Global.WorkDirectory = workdir; - return true; - } - - public void AddRoom(int roomid) - { - this.AddRoom(roomid, false); - } - - public void AddRoom(int roomid, bool enabled) - { - this.Rooms.Add(new MockRecordedRoom { RoomId = roomid, IsMonitoring = enabled }); - } - - public void RemoveRoom(IRecordedRoom rr) - { - this.Rooms.Remove(rr); - } - - public void SaveConfigToFile() - { - - } - - protected virtual void Dispose(bool disposing) - { - if (!this.disposedValue) - { - if (disposing) - { - // dispose managed state (managed objects) - this.Rooms.Clear(); - } - - // free unmanaged resources (unmanaged objects) and override finalizer - // set large fields to null - this.disposedValue = true; - } - } - - // override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources - // ~MockRecorder() - // { - // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - // Dispose(disposing: false); - // } - - public void Dispose() - { - // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method - this.Dispose(disposing: true); - GC.SuppressFinalize(this); - } - } -#endif -} diff --git a/BililiveRecorder.WPF/NLog.Debug.config b/BililiveRecorder.WPF/NLog.Debug.config deleted file mode 100644 index b80049d..0000000 --- a/BililiveRecorder.WPF/NLog.Debug.config +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BililiveRecorder.WPF/NewMainWindow.xaml.cs b/BililiveRecorder.WPF/NewMainWindow.xaml.cs index bb1489c..6d9d311 100644 --- a/BililiveRecorder.WPF/NewMainWindow.xaml.cs +++ b/BililiveRecorder.WPF/NewMainWindow.xaml.cs @@ -20,7 +20,7 @@ namespace BililiveRecorder.WPF public NewMainWindow() { - this.SoftwareVersion = BuildInfo.Version + " " + BuildInfo.HeadShaShort; + this.SoftwareVersion = GitVersionInformation.FullSemVer; Pages.AnnouncementPage.CultureInfo = CultureInfo.CurrentUICulture; LocalizeDictionary.Instance.Culture = CultureInfo.CurrentUICulture; diff --git a/BililiveRecorder.WPF/Nlog.Release.config b/BililiveRecorder.WPF/Nlog.Release.config deleted file mode 100644 index 0abe861..0000000 --- a/BililiveRecorder.WPF/Nlog.Release.config +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BililiveRecorder.WPF/Pages/AnnouncementPage.xaml.cs b/BililiveRecorder.WPF/Pages/AnnouncementPage.xaml.cs index 92ac522..fc376cc 100644 --- a/BililiveRecorder.WPF/Pages/AnnouncementPage.xaml.cs +++ b/BililiveRecorder.WPF/Pages/AnnouncementPage.xaml.cs @@ -26,7 +26,7 @@ namespace BililiveRecorder.WPF.Pages static AnnouncementPage() { client = new HttpClient(); - client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{typeof(AnnouncementPage).Assembly.GetName().Version}-{BuildInfo.HeadShaShort}"); + client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{GitVersionInformation.FullSemVer}"); } public AnnouncementPage() diff --git a/BililiveRecorder.WPF/Pages/LogPage.xaml.cs b/BililiveRecorder.WPF/Pages/LogPage.xaml.cs index 3c1f012..e02a7a6 100644 --- a/BililiveRecorder.WPF/Pages/LogPage.xaml.cs +++ b/BililiveRecorder.WPF/Pages/LogPage.xaml.cs @@ -8,7 +8,8 @@ namespace BililiveRecorder.WPF.Pages public LogPage() { this.InitializeComponent(); - this.VersionTextBlock.Text = " " + BuildInfo.Version + " " + BuildInfo.HeadShaShort; + this.VersionTextBlock.Text = " " + GitVersionInformation.FullSemVer; + this.VersionTextBlock.ToolTip = GitVersionInformation.InformationalVersion; } } } diff --git a/BililiveRecorder.WPF/Properties/AssemblyInfo.cs b/BililiveRecorder.WPF/Properties/AssemblyInfo.cs index 1f3b04d..2c68685 100644 --- a/BililiveRecorder.WPF/Properties/AssemblyInfo.cs +++ b/BililiveRecorder.WPF/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; using System.Windows; @@ -6,7 +6,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("B站录播姬")] -[assembly: AssemblyDescription("B站录播姬")] +[assembly: AssemblyDescription("B站录播姬 by genteure")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Genteure")] [assembly: AssemblyProduct("B站录播姬")] @@ -37,17 +37,3 @@ using System.Windows; //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.0.0")] -[assembly: AssemblyFileVersion("0.0.0.0")] diff --git a/BuildInfo.txt b/BuildInfo.txt deleted file mode 100644 index 71c021a..0000000 --- a/BuildInfo.txt +++ /dev/null @@ -1,10 +0,0 @@ -namespace BililiveRecorder.[PROJECT_NAME] -{ - internal class BuildInfo - { - internal const bool Appveyor = [APPVEYOR]; - internal const string Version = @"[VERSION]"; - internal const string HeadSha1 = @"[GIT_HASH]"; - internal const string HeadShaShort = @"[GIT_HASH_S]"; - } -} diff --git a/CI/NLog.xsd b/CI/NLog.xsd deleted file mode 100644 index 578682a..0000000 --- a/CI/NLog.xsd +++ /dev/null @@ -1,3638 +0,0 @@ - - - - - - - - - - - - - - - Watch config file for changes and reload automatically. - - - - - Print internal NLog messages to the console. Default value is: false - - - - - Print internal NLog messages to the console error output. Default value is: false - - - - - Write internal NLog messages to the specified file. - - - - - Log level threshold for internal log messages. Default value is: Info. - - - - - Global log level threshold for application log messages. Messages below this level won't be logged. - - - - - Throw an exception when there is an internal error. Default value is: false. Not recommend to set to true in production! - - - - - Throw an exception when there is a configuration error. If not set, determined by throwExceptions. - - - - - Gets or sets a value indicating whether Variables should be kept on configuration reload. Default value is: false. - - - - - Write internal NLog messages to the System.Diagnostics.Trace. Default value is: false. - - - - - Write timestamps for internal NLog messages. Default value is: true. - - - - - Use InvariantCulture as default culture instead of CurrentCulture. Default value is: false. - - - - - Perform message template parsing and formatting of LogEvent messages (true = Always, false = Never, empty = Auto Detect). Default value is: empty. - - - - - - - - - - - - - - Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). - - - - - - - - - - - - - - - - - Prefix for targets/layout renderers/filters/conditions loaded from this assembly. - - - - - Load NLog extensions from the specified file (*.dll) - - - - - Load NLog extensions from the specified assembly. Assembly name should be fully qualified. - - - - - - - - - - Filter on the name of the logger. May include wildcard characters ('*' or '?'). - - - - - Comma separated list of levels that this rule matches. - - - - - Minimum level that this rule matches. - - - - - Maximum level that this rule matches. - - - - - Level that this rule matches. - - - - - Comma separated list of target names. - - - - - Ignore further rules if this one matches. - - - - - Enable this rule. Note: disabled rules aren't available from the API. - - - - - Rule identifier to allow rule lookup with Configuration.FindRuleByName and Configuration.RemoveRuleByName. - - - - - - - - - - - - - - - Default action if none of the filters match. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the file to be included. You could use * wildcard. The name is relative to the name of the current config file. - - - - - Ignore any errors in the include file. - - - - - - - - Variable value. Note, the 'value' attribute has precedence over this one. - - - - - - Variable name. - - - - - Variable value. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Number of log events that should be processed in a batch by the lazy writer thread. - - - - - Whether to use the locking queue, instead of a lock-free concurrent queue The locking queue is less concurrent when many logger threads, but reduces memory allocation - - - - - Limit of full s to write before yielding into Performance is better when writing many small batches, than writing a single large batch - - - - - Action to be taken when the lazy writer thread request queue count exceeds the set limit. - - - - - Limit on the number of requests in the lazy writer thread request queue. - - - - - Time in milliseconds to sleep between batches. (1 or less means trigger on new activity) - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - Delay the flush until the LogEvent has been confirmed as written - - - - - Condition expression. Log events who meet this condition will cause a flush on the wrapped target. - - - - - Only flush when LogEvent matches condition. Ignore explicit-flush, config-reload-flush and shutdown-flush - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Number of log events to be buffered. - - - - - Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. - - - - - Action to take if the buffer overflows. - - - - - Indicates whether to use sliding timeout. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Encoding to be used. - - - - - Instance of that is used to format log messages. - - - - - End of line value if a newline is appended at the end of log message . - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - The number of seconds a connection will remain idle before the first keep-alive probe is sent - - - - - Maximum queue size. - - - - - Maximum current connections. 0 = no maximum. - - - - - Action that should be taken if the will be more connections than . - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - Indicates whether to keep connection open whenever possible. - - - - - NDLC item separator. - - - - - Indicates whether to include source info (file name and line number) in the information sent over the network. - - - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - - - - Indicates whether to include NLog-specific extensions to log4j schema. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include stack contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include call site (class and method name) in the information sent over the network. - - - - - Option to include all properties from the log events - - - - - AppInfo field. By default it's the friendly name of the current AppDomain. - - - - - NDC item separator. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Viewer parameter name. - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether to auto-check if the console is available. - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) - - - - - Enables output using ANSI Color Codes - - - - - The encoding for writing messages to the . - - - - - Indicates whether the error stream (stderr) should be used instead of the output stream (stdout). - - - - - Indicates whether to auto-flush after - - - - - Indicates whether to auto-check if the console has been redirected to file - Disables coloring logic when System.Console.IsOutputRedirected = true - - - - - Indicates whether to use default row highlighting rules. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Condition that must be met in order to set the specified foreground and background color. - - - - - Background color. - - - - - Foreground color. - - - - - - - - - - - - - - - - - Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. - - - - - Condition that must be met before scanning the row for highlight of words - - - - - Indicates whether to ignore case when comparing texts. - - - - - Regular expression to be matched. You must specify either text or regex. - - - - - Text to be matched. You must specify either text or regex. - - - - - Indicates whether to match whole words only. - - - - - Background color. - - - - - Foreground color. - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether to auto-flush after - - - - - Indicates whether to auto-check if the console is available - Disables console writing if Environment.UserInteractive = False (Windows Service) - Disables console writing if Console Standard Input is not available (Non-Console-App) - - - - - The encoding for writing messages to the . - - - - - Indicates whether to send the log messages to the standard error instead of the standard output. - - - - - Whether to enable batch writing using char[]-buffers, instead of using - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some data providers require this. - - - - - Indicates whether to keep the database connection open between the log events. - - - - - Name of the database provider. - - - - - Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. - - - - - Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. - - - - - Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. - - - - - Name of the connection string (as specified in <connectionStrings> configuration section. - - - - - Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. - - - - - Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. - - - - - Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. - - - - - Configures isolated transaction batch writing. If supported by the database, then it will improve insert performance. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Text of the SQL command to be run on each log level. - - - - - Type of the SQL command to be run on each log level. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Convert format of the property value - - - - - Culture used for parsing property string-value for type-conversion - - - - - Value to assign on the object-property - - - - - Name for the object-property - - - - - Type of the object-property - - - - - - - - - - - - - - Type of the command. - - - - - Connection string to run the command against. If not provided, connection string from the target is used. - - - - - Indicates whether to ignore failures. - - - - - Command text. - - - - - - - - - - - - - - - - - - Database parameter name. - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Database parameter DbType. - - - - - Database parameter size. - - - - - Database parameter precision. - - - - - Database parameter scale. - - - - - Type of the parameter. - - - - - Convert format of the database parameter value. - - - - - Culture used for parsing parameter string-value for type-conversion - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Layout that renders event Category. - - - - - Optional entry type. When not set, or when not convertible to then determined by - - - - - Layout that renders event ID. - - - - - Name of the Event Log to write to. This can be System, Application or any user-defined name. - - - - - Name of the machine on which Event Log service is running. - - - - - Maximum Event log size in kilobytes. - - - - - Message length limit to write to the Event Log. - - - - - Value to be used as the event Source. - - - - - Action to take if the message is larger than the option. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Indicates whether to return to the first target after any successful write. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - File encoding. - - - - - Line ending mode. - - - - - Maximum days of archive files that should be kept. - - - - - Indicates whether to compress archive files into the zip archive format. - - - - - Way file archives are numbered. - - - - - Name of the file to be used for an archive. - - - - - Is the an absolute or relative path? - - - - - Indicates whether to automatically archive log files every time the specified time passes. - - - - - Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: - - - - - Maximum number of archive files that should be kept. - - - - - Indicates whether the footer should be written only when the file is archived. - - - - - Maximum number of log file names that should be stored as existing. - - - - - Indicates whether to delete old log file on startup. - - - - - File attributes (Windows only). - - - - - Indicates whether to create directories if they do not exist. - - - - - Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. If set to false, nothing gets written when the filename is wrong. - - - - - Value of the file size threshold to archive old log file on startup. - - - - - Indicates whether to archive old log file on startup. - - - - - Value specifying the date format to use when archiving files. - - - - - Indicates whether to enable log file(s) to be deleted. - - - - - Indicates whether to write BOM (byte order mark) in created files - - - - - Indicates whether to replace file contents on each write instead of appending log message at the end. - - - - - Indicates whether file creation calls should be synchronized by a system global mutex. - - - - - Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation. - - - - - Is the an absolute or relative path? - - - - - Name of the file to write to. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Indicates whether concurrent writes to the log file by multiple processes on different network hosts. - - - - - Maximum number of seconds that files are kept open. If this number is negative the files are not automatically closed after a period of inactivity. - - - - - Number of files to be kept open. Setting this to a higher value may improve performance in a situation where a single File target is writing to many files (such as splitting by level or by logger). - - - - - Indicates whether to keep log file open instead of opening and closing it on each logging event. - - - - - Whether or not this target should just discard all data that its asked to write. Mostly used for when testing NLog Stack except final write - - - - - Indicates whether concurrent writes to the log file by multiple processes on the same host. - - - - - Number of times the write is appended on the file before NLog discards the log message. - - - - - Delay in milliseconds to wait before attempting to write to the file again. - - - - - Log file buffer size in bytes. - - - - - Maximum number of seconds before open files are flushed. If this number is negative or zero the files are not flushed by timer. - - - - - Indicates whether to automatically flush the file buffers after each log message. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Condition expression. Log events who meet this condition will be forwarded to the wrapped target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Windows domain name to change context to. - - - - - Required impersonation level. - - - - - Type of the logon provider. - - - - - Logon Type. - - - - - User account password. - - - - - Indicates whether to revert to the credentials of the process instead of impersonating another user. - - - - - Username to change context to. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Interval in which messages will be written up to the number of messages. - - - - - Maximum allowed number of messages written per . - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Endpoint address. - - - - - Name of the endpoint configuration in WCF configuration file. - - - - - Indicates whether to use a WCF service contract that is one way (fire and forget) or two way (request-reply) - - - - - Client ID. - - - - - Indicates whether to include per-event properties in the payload sent to the server. - - - - - Indicates whether to use binary message encoding. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Name of the parameter. - - - - - Type of the parameter. - - - - - Type of the parameter. Obsolete alias for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether NewLine characters in the body should be replaced with tags. - - - - - Priority used for sending mails. - - - - - Encoding to be used for sending e-mail. - - - - - BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). - - - - - CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). - - - - - Indicates whether to add new lines between log entries. - - - - - Indicates whether to send message as HTML instead of plain text. - - - - - Sender's email address (e.g. joe@domain.com). - - - - - Mail message body (repeated for each log message send in one mail). - - - - - Mail subject. - - - - - Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Indicates the SMTP client timeout. - - - - - SMTP Server to be used for sending. - - - - - SMTP Authentication mode. - - - - - Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). - - - - - Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). - - - - - Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. - - - - - Port number that SMTP Server is listening on. - - - - - Indicates whether the default Settings from System.Net.MailSettings should be used. - - - - - Folder where applications save mail messages to be processed by the local SMTP server. - - - - - Specifies how outgoing email messages will be handled. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Max number of items to have in memory - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Class name. - - - - - Method name. The method must be public and static. Use the AssemblyQualifiedName , https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx e.g. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Encoding to be used. - - - - - End of line value if a newline is appended at the end of log message . - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - The number of seconds a connection will remain idle before the first keep-alive probe is sent - - - - - Indicates whether to keep connection open whenever possible. - - - - - Maximum current connections. 0 = no maximum. - - - - - Maximum queue size. - - - - - Action that should be taken if the will be more connections than . - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Encoding to be used. - - - - - Instance of that is used to format log messages. - - - - - End of line value if a newline is appended at the end of log message . - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - The number of seconds a connection will remain idle before the first keep-alive probe is sent - - - - - Maximum queue size. - - - - - Maximum current connections. 0 = no maximum. - - - - - Action that should be taken if the will be more connections than . - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - Indicates whether to keep connection open whenever possible. - - - - - NDLC item separator. - - - - - Indicates whether to include source info (file name and line number) in the information sent over the network. - - - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - - - - Indicates whether to include NLog-specific extensions to log4j schema. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include stack contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include call site (class and method name) in the information sent over the network. - - - - - Option to include all properties from the log events - - - - - AppInfo field. By default it's the friendly name of the current AppDomain. - - - - - NDC item separator. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Indicates whether to perform layout calculation. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Indicates whether performance counter should be automatically created. - - - - - Name of the performance counter category. - - - - - Counter help text. - - - - - Name of the performance counter. - - - - - Performance counter type. - - - - - The value by which to increment the counter. - - - - - Performance counter instance name. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Default filter to be applied when no specific rule matches. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - Condition to be tested. - - - - - Resulting filter to be applied when the condition matches. - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Number of times to repeat each log message. - - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Number of retries that should be attempted on the wrapped target in case of a failure. - - - - - Time to wait between retries in milliseconds. - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Forward to (Instead of ) - - - - - Always use independent of - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit - - - - - Should we include the BOM (Byte-order-mark) for UTF? Influences the property. This will only work for UTF-8. - - - - - Web service method name. Only used with Soap. - - - - - Web service namespace. Only used with Soap. - - - - - Protocol to be used when calling web service. - - - - - Custom proxy address, include port separated by a colon - - - - - Encoding. - - - - - Web service URL. - - - - - Value whether escaping be done according to the old NLog style (Very non-standard) - - - - - Value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs) - - - - - Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in parameters) - - - - - Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see and ). - - - - - (optional) root namespace of the XML document, if POST of XML document chosen. (see and ). - - - - - Proxy configuration when calling web service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Footer layout. - - - - - Header layout. - - - - - Body layout (can be repeated multiple times). - - - - - Custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). - - - - - Column delimiter. - - - - - Quote Character. - - - - - Quoting mode. - - - - - Indicates whether CVS should include header. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Layout of the column. - - - - - Name of the column. - - - - - Override of Quoting mode - - - - - - - - - - - - - - - - - - - - - Should forward slashes be escaped? If true, / will be converted to \/ - - - - - Option to render the empty object value {} - - - - - Option to suppress the extra spaces in the output json - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as JSON) - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the JSON serializer follow object references before backing off - - - - - - - - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Json encoded. - - - - - Should forward slashes be escaped? If true, / will be converted to \/ - - - - - Indicates whether to escape non-ascii characters - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - Footer layout. - - - - - Header layout. - - - - - Body layout (can be repeated multiple times). - - - - - - - - - - - - - - - - - - - - - Option to include all properties from the log events - - - - - Indicates whether to include call site (class and method name) in the information sent over the network. - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include source info (file name and line number) in the information sent over the network. - - - - - - - - - - - - - - Layout text. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as XML) - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the XML serializer follow object references before backing off - - - - - XML element name to use for rendering IList-collections items - - - - - XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included - - - - - XML element name to use when rendering properties - - - - - XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value - - - - - Name of the root XML element - - - - - Value inside the root XML element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - Auto indent and create new lines - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - - - - - - - - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Name of the element - - - - - Value inside the element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - Auto indent and create new lines - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as XML) - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the XML serializer follow object references before backing off - - - - - XML element name to use for rendering IList-collections items - - - - - XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included - - - - - XML element name to use when rendering properties - - - - - XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Condition expression. - - - - - - - - - - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - Substring to be matched. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - String to compare the layout to. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - Substring to be matched. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - String to compare the layout to. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - - - - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Default number of unique filter values to expect, will automatically increase if needed - - - - - Applies the configured action to the initial logevent that starts the timeout period. Used to configure that it should ignore all events until timeout. - - - - - Layout to be used to filter log messages. - - - - - Max number of unique filter values to expect simultaneously - - - - - Max length of filter values, will truncate if above limit - - - - - How long before a filter expires, and logging is accepted again - - - - - Default buffer size for the internal buffers - - - - - Reuse internal buffers, and doesn't have to constantly allocate new buffers - - - - - Append FilterCount to the when an event is no longer filtered - - - - - Insert FilterCount value into when an event is no longer filtered - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CI/appveyor_install.ps1 b/CI/appveyor_install.ps1 index fdffbdc..3efb411 100644 --- a/CI/appveyor_install.ps1 +++ b/CI/appveyor_install.ps1 @@ -1,6 +1,6 @@ Write-Host "Current build configuration is $env:CONFIGURATION" -if ($env:APPVEYOR -and (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and $env:CONFIGURATION -eq "Release") { +if ($false -and $env:APPVEYOR -and (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and $env:CONFIGURATION -eq "Release") { git config --global credential.helper store Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:github_access_token):x-oauth-basic@github.com`n" git config --global user.email "appveyor@genteure.com" diff --git a/CI/patch_buildinfo.ps1 b/CI/patch_buildinfo.ps1 deleted file mode 100644 index e404192..0000000 --- a/CI/patch_buildinfo.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -# called by msbuild - -$isAppveyor = if ($env:APPVEYOR -eq $null) { "false" } else { $env:APPVEYOR } -$buildversion = if ($env:APPVEYOR_BUILD_VERSION -eq $null) { "本地编译" } else { $env:APPVEYOR_BUILD_VERSION } -$githash = git rev-parse --verify HEAD - -(Get-Content .\BuildInfo.txt).Replace('[PROJECT_NAME]', $args).Replace('[APPVEYOR]', $isAppveyor.ToLower()).Replace('[VERSION]', $buildversion).Replace('[GIT_HASH]', $githash).Replace('[GIT_HASH_S]', $githash.Substring(0, 8)) | Set-Content ".\TempBuildInfo\BuildInfo.$args.cs" - -Write-Output "BuildInfo for $args patched" diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..df4bd22 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,15 @@ + + + Copyright © 2018 - 2021 Genteure + Genteure + $(Authors) + 9.0 + enable + + + + all + runtime; build; native; contentfiles; analyzers + + + diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..ed16160 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,5 @@ +mode: ContinuousDelivery +branches: {} +ignore: + sha: [] +merge-message-formats: {} diff --git a/TempBuildInfo/.gitkeep b/TempBuildInfo/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/appveyor.yml b/appveyor.yml index ac0ec49..5c1399f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,13 +4,13 @@ platform: Any CPU skip_tags: true assembly_info: - patch: true + patch: false file: '**\AssemblyInfo.*' assembly_version: $(APPVEYOR_BUILD_VERSION) assembly_file_version: $(APPVEYOR_BUILD_VERSION) assembly_informational_version: $(APPVEYOR_BUILD_VERSION) dotnet_csproj: - patch: true + patch: false file: '**\*.csproj' version: $(APPVEYOR_BUILD_VERSION) package_version: $(APPVEYOR_BUILD_VERSION) @@ -19,18 +19,14 @@ dotnet_csproj: informational_version: $(APPVEYOR_BUILD_VERSION) environment: - github_access_token: - secure: 3n2WMbrqWb0nmy2LBmu7w6dJltiHHC4LCoNuIKBh7fKV0xfxCwVGOxbTpunLI2pe - codesignaes: - secure: 9f78dD9jN5vlVZ0zv15kdD4Mj+/+uacfu29bbGC+cBVFs834aFVf5Ci+n3NP3Bl7 - codesignpasswd: - secure: iKv14aGuHUDEfb5fSIBMuSsu1JnisWXL8wJ7x/2DCNtggWKevjhOFBOrI7c95xBY +# github_access_token: +# secure: 3n2WMbrqWb0nmy2LBmu7w6dJltiHHC4LCoNuIKBh7fKV0xfxCwVGOxbTpunLI2pe cache: - packages install: - - ps: ./CI/appveyor_install.ps1 +# - ps: ./CI/appveyor_install.ps1 before_build: - nuget restore -Verbosity quiet @@ -47,21 +43,21 @@ build_script: - ps: msbuild /nologo /v:m /t:BililiveRecorder_Cli:Publish /p:Configuration="$env:CONFIGURATION" /p:RuntimeIdentifier="win-x64" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" for: -- - branches: - only: - - master # including pull requests target at master - configuration: Release - before_deploy: # wont run on pull request - - ps: ./CI/appveyor_deploy.ps1 - deploy: # wont run on pull request - provider: GitHub - release: v$(APPVEYOR_BUILD_VERSION) - description: '# ◁☆Fill out this before publish☆▷' - auth_token: - secure: 3n2WMbrqWb0nmy2LBmu7w6dJltiHHC4LCoNuIKBh7fKV0xfxCwVGOxbTpunLI2pe - artifact: github - draft: true +#- +# branches: +# only: +# - master # including pull requests target at master +# configuration: Release +# before_deploy: # wont run on pull request +# - ps: ./CI/appveyor_deploy.ps1 +# deploy: # wont run on pull request +# provider: GitHub +# release: v$(APPVEYOR_BUILD_VERSION) +# description: '# ◁☆Fill out this before publish☆▷' +# auth_token: +# secure: 3n2WMbrqWb0nmy2LBmu7w6dJltiHHC4LCoNuIKBh7fKV0xfxCwVGOxbTpunLI2pe +# artifact: github +# draft: true - configuration: Debug artifacts: diff --git a/global.json b/global.json index cb62ab4..a46dc9b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.102", + "version": "5.0.100", "rollForward": "latestFeature" } } diff --git a/test/BililiveRecorder.Core.UnitTests/Danmaku/ManualTests.cs b/test/BililiveRecorder.Core.UnitTests/Danmaku/ManualTests.cs index bc035bd..ed20fe2 100644 --- a/test/BililiveRecorder.Core.UnitTests/Danmaku/ManualTests.cs +++ b/test/BililiveRecorder.Core.UnitTests/Danmaku/ManualTests.cs @@ -12,7 +12,7 @@ namespace BililiveRecorder.Core.UnitTests.Danmaku { public class ManualTests { - [Fact] + [Fact(Skip = "skip")] public async Task TestAsync() { var client = new DanmakuClient(new HttpApiClient(null!), null);