diff --git a/BililiveRecorder.Core/Api/BilibiliApiResponse.cs b/BililiveRecorder.Core/Api/BilibiliApiResponse.cs index 44b282a..0a69929 100644 --- a/BililiveRecorder.Core/Api/BilibiliApiResponse.cs +++ b/BililiveRecorder.Core/Api/BilibiliApiResponse.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Api { - public class BilibiliApiResponse where T : class + internal class BilibiliApiResponse where T : class { [JsonProperty("code")] public int? Code { get; set; } diff --git a/BililiveRecorder.Core/Api/BilibiliApiResponseCodeNotZeroException.cs b/BililiveRecorder.Core/Api/BilibiliApiResponseCodeNotZeroException.cs index 991e58b..543057e 100644 --- a/BililiveRecorder.Core/Api/BilibiliApiResponseCodeNotZeroException.cs +++ b/BililiveRecorder.Core/Api/BilibiliApiResponseCodeNotZeroException.cs @@ -3,7 +3,7 @@ using System.Runtime.Serialization; namespace BililiveRecorder.Core.Api { - public class BilibiliApiResponseCodeNotZeroException : Exception + internal class BilibiliApiResponseCodeNotZeroException : Exception { public BilibiliApiResponseCodeNotZeroException() { } public BilibiliApiResponseCodeNotZeroException(string message) : base(message) { } diff --git a/BililiveRecorder.Core/Api/Danmaku/DanmakuClient.cs b/BililiveRecorder.Core/Api/Danmaku/DanmakuClient.cs index 0a0c5e1..2b79a92 100644 --- a/BililiveRecorder.Core/Api/Danmaku/DanmakuClient.cs +++ b/BililiveRecorder.Core/Api/Danmaku/DanmakuClient.cs @@ -17,7 +17,7 @@ using Timer = System.Timers.Timer; namespace BililiveRecorder.Core.Api.Danmaku { - public class DanmakuClient : IDanmakuClient, IDisposable + internal class DanmakuClient : IDanmakuClient, IDisposable { private readonly ILogger logger; private readonly IDanmakuServerApiClient apiClient; diff --git a/BililiveRecorder.Core/Api/Danmaku/DanmakuModel.cs b/BililiveRecorder.Core/Api/Danmaku/DanmakuModel.cs index 6797a78..58aea37 100644 --- a/BililiveRecorder.Core/Api/Danmaku/DanmakuModel.cs +++ b/BililiveRecorder.Core/Api/Danmaku/DanmakuModel.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json.Linq; #nullable enable namespace BililiveRecorder.Core.Api.Danmaku { - public enum DanmakuMsgType + internal enum DanmakuMsgType { /// /// 彈幕 @@ -39,7 +39,7 @@ namespace BililiveRecorder.Core.Api.Danmaku RoomChange } - public class DanmakuModel + internal class DanmakuModel { /// /// 消息類型 diff --git a/BililiveRecorder.Core/Api/Danmaku/DanmakuReceivedEventArgs.cs b/BililiveRecorder.Core/Api/Danmaku/DanmakuReceivedEventArgs.cs index 7532659..01ed05d 100644 --- a/BililiveRecorder.Core/Api/Danmaku/DanmakuReceivedEventArgs.cs +++ b/BililiveRecorder.Core/Api/Danmaku/DanmakuReceivedEventArgs.cs @@ -1,8 +1,8 @@ -using System; +using System; namespace BililiveRecorder.Core.Api.Danmaku { - public class DanmakuReceivedEventArgs : EventArgs + internal class DanmakuReceivedEventArgs : EventArgs { public readonly DanmakuModel Danmaku; diff --git a/BililiveRecorder.Core/Api/Danmaku/StatusChangedEventArgs.cs b/BililiveRecorder.Core/Api/Danmaku/StatusChangedEventArgs.cs index b8b22c4..4a4db23 100644 --- a/BililiveRecorder.Core/Api/Danmaku/StatusChangedEventArgs.cs +++ b/BililiveRecorder.Core/Api/Danmaku/StatusChangedEventArgs.cs @@ -1,8 +1,8 @@ -using System; +using System; namespace BililiveRecorder.Core.Api.Danmaku { - public class StatusChangedEventArgs : EventArgs + internal class StatusChangedEventArgs : EventArgs { public static readonly StatusChangedEventArgs True = new StatusChangedEventArgs { diff --git a/BililiveRecorder.Core/Api/Http/HttpApiClient.cs b/BililiveRecorder.Core/Api/Http/HttpApiClient.cs index 126f6db..201f321 100644 --- a/BililiveRecorder.Core/Api/Http/HttpApiClient.cs +++ b/BililiveRecorder.Core/Api/Http/HttpApiClient.cs @@ -11,7 +11,7 @@ using Newtonsoft.Json.Linq; namespace BililiveRecorder.Core.Api.Http { - public class HttpApiClient : IApiClient, IDanmakuServerApiClient + internal class HttpApiClient : IApiClient, IDanmakuServerApiClient, IHttpClientAccessor { private const string HttpHeaderAccept = "application/json, text/javascript, */*; q=0.01"; private const string HttpHeaderOrigin = "https://live.bilibili.com"; diff --git a/BililiveRecorder.Core/Api/Http412Exception.cs b/BililiveRecorder.Core/Api/Http412Exception.cs index 008dc4d..7ee5257 100644 --- a/BililiveRecorder.Core/Api/Http412Exception.cs +++ b/BililiveRecorder.Core/Api/Http412Exception.cs @@ -3,7 +3,7 @@ using System.Runtime.Serialization; namespace BililiveRecorder.Core.Api { - public class Http412Exception : Exception + internal class Http412Exception : Exception { public Http412Exception() { } public Http412Exception(string message) : base(message) { } diff --git a/BililiveRecorder.Core/Api/IApiClient.cs b/BililiveRecorder.Core/Api/IApiClient.cs index 602a994..956e82f 100644 --- a/BililiveRecorder.Core/Api/IApiClient.cs +++ b/BililiveRecorder.Core/Api/IApiClient.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Api.Model; namespace BililiveRecorder.Core.Api { - public interface IApiClient : IDisposable + internal interface IApiClient : IDisposable { Task> GetRoomInfoAsync(int roomid); Task> GetStreamUrlAsync(int roomid, int qn); diff --git a/BililiveRecorder.Core/Api/IApiClientExtensions.cs b/BililiveRecorder.Core/Api/IApiClientExtensions.cs index 453cbce..ed29035 100644 --- a/BililiveRecorder.Core/Api/IApiClientExtensions.cs +++ b/BililiveRecorder.Core/Api/IApiClientExtensions.cs @@ -5,7 +5,7 @@ using static BililiveRecorder.Core.Api.Model.RoomPlayInfo; namespace BililiveRecorder.Core.Api { - public static class IApiClientExtensions + internal static class IApiClientExtensions { public static async Task GetCodecItemInStreamUrlAsync(this IApiClient apiClient, int roomid, int qn) { diff --git a/BililiveRecorder.Core/Api/IDanmakuClient.cs b/BililiveRecorder.Core/Api/IDanmakuClient.cs index dc0d215..31546f2 100644 --- a/BililiveRecorder.Core/Api/IDanmakuClient.cs +++ b/BililiveRecorder.Core/Api/IDanmakuClient.cs @@ -5,7 +5,7 @@ using BililiveRecorder.Core.Api.Danmaku; namespace BililiveRecorder.Core.Api { - public interface IDanmakuClient : IDisposable + internal interface IDanmakuClient : IDisposable { bool Connected { get; } diff --git a/BililiveRecorder.Core/Api/IDanmakuServerApiClient.cs b/BililiveRecorder.Core/Api/IDanmakuServerApiClient.cs index 61b9df5..eddfeb5 100644 --- a/BililiveRecorder.Core/Api/IDanmakuServerApiClient.cs +++ b/BililiveRecorder.Core/Api/IDanmakuServerApiClient.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Api.Model; namespace BililiveRecorder.Core.Api { - public interface IDanmakuServerApiClient : IDisposable + internal interface IDanmakuServerApiClient : IDisposable { Task> GetDanmakuServerAsync(int roomid); } diff --git a/BililiveRecorder.Core/Api/IHttpClientAccessor.cs b/BililiveRecorder.Core/Api/IHttpClientAccessor.cs new file mode 100644 index 0000000..83db85a --- /dev/null +++ b/BililiveRecorder.Core/Api/IHttpClientAccessor.cs @@ -0,0 +1,9 @@ +using System.Net.Http; + +namespace BililiveRecorder.Core.Api +{ + public interface IHttpClientAccessor + { + HttpClient MainHttpClient { get; } + } +} diff --git a/BililiveRecorder.Core/Api/Model/DanmuInfo.cs b/BililiveRecorder.Core/Api/Model/DanmuInfo.cs index 61e50c2..25b0c79 100644 --- a/BililiveRecorder.Core/Api/Model/DanmuInfo.cs +++ b/BililiveRecorder.Core/Api/Model/DanmuInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Api.Model { - public class DanmuInfo + internal class DanmuInfo { [JsonProperty("host_list")] public HostListItem[] HostList { get; set; } = Array.Empty(); diff --git a/BililiveRecorder.Core/Api/Model/RoomInfo.cs b/BililiveRecorder.Core/Api/Model/RoomInfo.cs index 2362324..af77b01 100644 --- a/BililiveRecorder.Core/Api/Model/RoomInfo.cs +++ b/BililiveRecorder.Core/Api/Model/RoomInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json.Linq; namespace BililiveRecorder.Core.Api.Model { - public class RoomInfo + internal class RoomInfo { [JsonProperty("room_info")] public InnerRoomInfo Room { get; set; } = new InnerRoomInfo(); diff --git a/BililiveRecorder.Core/Api/Model/RoomPlayInfo.cs b/BililiveRecorder.Core/Api/Model/RoomPlayInfo.cs index 7442fc3..de917b1 100644 --- a/BililiveRecorder.Core/Api/Model/RoomPlayInfo.cs +++ b/BililiveRecorder.Core/Api/Model/RoomPlayInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Api.Model { - public class RoomPlayInfo + internal class RoomPlayInfo { [JsonProperty("live_status")] public int LiveStatus { get; set; } diff --git a/BililiveRecorder.Core/Api/Model/UserInfo.cs b/BililiveRecorder.Core/Api/Model/UserInfo.cs index a1dac23..d25262d 100644 --- a/BililiveRecorder.Core/Api/Model/UserInfo.cs +++ b/BililiveRecorder.Core/Api/Model/UserInfo.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Api.Model { - public class UserInfo + internal class UserInfo { [JsonProperty("info")] public InfoClass? Info { get; set; } diff --git a/BililiveRecorder.Core/Api/ModelExtensions.cs b/BililiveRecorder.Core/Api/ModelExtensions.cs index 13b813e..2f6bd4e 100644 --- a/BililiveRecorder.Core/Api/ModelExtensions.cs +++ b/BililiveRecorder.Core/Api/ModelExtensions.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Api.Model; namespace BililiveRecorder.Core.Api { - public static class ModelExtensions + internal static class ModelExtensions { private static readonly Random random = new Random(); diff --git a/BililiveRecorder.Core/Api/PolicyWrappedApiClient.cs b/BililiveRecorder.Core/Api/PolicyWrappedApiClient.cs index 7baed49..7a11f86 100644 --- a/BililiveRecorder.Core/Api/PolicyWrappedApiClient.cs +++ b/BililiveRecorder.Core/Api/PolicyWrappedApiClient.cs @@ -6,7 +6,7 @@ using Polly.Registry; namespace BililiveRecorder.Core.Api { - public class PolicyWrappedApiClient : IApiClient, IDanmakuServerApiClient, IDisposable where T : class, IApiClient, IDanmakuServerApiClient, IDisposable + internal class PolicyWrappedApiClient : IApiClient, IDanmakuServerApiClient, IDisposable where T : class, IApiClient, IDanmakuServerApiClient, IDisposable { private readonly T client; private readonly IReadOnlyPolicyRegistry policies; diff --git a/BililiveRecorder.Core/Config/V1/ConfigV1.cs b/BililiveRecorder.Core/Config/V1/ConfigV1.cs index f44c151..162fc81 100644 --- a/BililiveRecorder.Core/Config/V1/ConfigV1.cs +++ b/BililiveRecorder.Core/Config/V1/ConfigV1.cs @@ -9,7 +9,7 @@ namespace BililiveRecorder.Core.Config.V1 { [Obsolete] [JsonObject(memberSerialization: MemberSerialization.OptIn)] - public class ConfigV1 : INotifyPropertyChanged + internal class ConfigV1 : INotifyPropertyChanged { //private static readonly Logger logger = LogManager.GetCurrentClassLogger(); diff --git a/BililiveRecorder.Core/Config/V1/RoomV1.cs b/BililiveRecorder.Core/Config/V1/RoomV1.cs index d322878..c42bf78 100644 --- a/BililiveRecorder.Core/Config/V1/RoomV1.cs +++ b/BililiveRecorder.Core/Config/V1/RoomV1.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Config.V1 { [JsonObject(MemberSerialization = MemberSerialization.OptIn)] - public class RoomV1 + internal class RoomV1 { [JsonProperty("id")] public int Roomid { get; set; } diff --git a/BililiveRecorder.Core/Config/V2/Config.gen.cs b/BililiveRecorder.Core/Config/V2/Config.gen.cs index bbd44bc..d3621ea 100644 --- a/BililiveRecorder.Core/Config/V2/Config.gen.cs +++ b/BililiveRecorder.Core/Config/V2/Config.gen.cs @@ -11,7 +11,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Config.V2 { [JsonObject(MemberSerialization.OptIn)] - public sealed partial class RoomConfig : HierarchicalObject + internal sealed partial class RoomConfig : HierarchicalObject { /// /// 房间号 @@ -169,7 +169,7 @@ namespace BililiveRecorder.Core.Config.V2 } [JsonObject(MemberSerialization.OptIn)] - public sealed partial class GlobalConfig : HierarchicalObject + internal sealed partial class GlobalConfig : HierarchicalObject { /// /// 录制模式 @@ -349,7 +349,7 @@ namespace BililiveRecorder.Core.Config.V2 } - public sealed partial class DefaultConfig + internal sealed partial class DefaultConfig { public static readonly DefaultConfig Instance = new DefaultConfig(); private DefaultConfig() { } diff --git a/BililiveRecorder.Core/Config/V2/ConfigV2.cs b/BililiveRecorder.Core/Config/V2/ConfigV2.cs index da9b1ab..bd7fb99 100644 --- a/BililiveRecorder.Core/Config/V2/ConfigV2.cs +++ b/BililiveRecorder.Core/Config/V2/ConfigV2.cs @@ -6,7 +6,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Config.V2 { [Obsolete("Use Config v3")] - public class ConfigV2 : ConfigBase + internal class ConfigV2 : ConfigBase { public override int Version => 2; @@ -21,7 +21,7 @@ namespace BililiveRecorder.Core.Config.V2 } [Obsolete("Use Config v3")] - public partial class RoomConfig + internal partial class RoomConfig { public RoomConfig() : base(x => x.AutoMap(p => new[] { "Has" + p.Name })) { } @@ -32,7 +32,7 @@ namespace BililiveRecorder.Core.Config.V2 } [Obsolete("Use Config v3")] - public partial class GlobalConfig + internal partial class GlobalConfig { public GlobalConfig() : base(x => x.AutoMap(p => new[] { "Has" + p.Name })) { diff --git a/BililiveRecorder.Core/Config/V3/ConfigV3.cs b/BililiveRecorder.Core/Config/V3/ConfigV3.cs index 64508f0..d6834cf 100644 --- a/BililiveRecorder.Core/Config/V3/ConfigV3.cs +++ b/BililiveRecorder.Core/Config/V3/ConfigV3.cs @@ -4,7 +4,7 @@ using Newtonsoft.Json; #nullable enable namespace BililiveRecorder.Core.Config.V3 { - public class ConfigV3 : ConfigBase + public sealed class ConfigV3 : ConfigBase { public override int Version => 3; diff --git a/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs b/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs index c3b2415..f689b5a 100644 --- a/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs +++ b/BililiveRecorder.Core/Danmaku/BasicDanmakuWriter.cs @@ -12,7 +12,7 @@ using Serilog; #nullable enable namespace BililiveRecorder.Core.Danmaku { - public class BasicDanmakuWriter : IBasicDanmakuWriter + internal class BasicDanmakuWriter : IBasicDanmakuWriter { private static readonly XmlWriterSettings xmlWriterSettings = new XmlWriterSettings { diff --git a/BililiveRecorder.Core/Danmaku/IBasicDanmakuWriter.cs b/BililiveRecorder.Core/Danmaku/IBasicDanmakuWriter.cs index d6ccbc4..d412e33 100644 --- a/BililiveRecorder.Core/Danmaku/IBasicDanmakuWriter.cs +++ b/BililiveRecorder.Core/Danmaku/IBasicDanmakuWriter.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Api.Danmaku; namespace BililiveRecorder.Core.Danmaku { - public interface IBasicDanmakuWriter : IDisposable + internal interface IBasicDanmakuWriter : IDisposable { void Disable(); void EnableWithPath(string path, IRoom room); diff --git a/BililiveRecorder.Core/DependencyInjectionExtensions.cs b/BililiveRecorder.Core/DependencyInjectionExtensions.cs index 32a8a70..4c3c7c8 100644 --- a/BililiveRecorder.Core/DependencyInjectionExtensions.cs +++ b/BililiveRecorder.Core/DependencyInjectionExtensions.cs @@ -38,6 +38,7 @@ namespace BililiveRecorder.DependencyInjection public static IServiceCollection AddRecorderApiClients(this IServiceCollection services) => services .AddSingleton() + .AddSingleton(sp => sp.GetRequiredService()) .AddSingleton>() .AddSingleton(sp => sp.GetRequiredService>()) .AddSingleton(sp => sp.GetRequiredService>()) diff --git a/BililiveRecorder.Core/Event/AggregatedRoomEventArgs.cs b/BililiveRecorder.Core/Event/AggregatedRoomEventArgs.cs index 4f69277..dd78f28 100644 --- a/BililiveRecorder.Core/Event/AggregatedRoomEventArgs.cs +++ b/BililiveRecorder.Core/Event/AggregatedRoomEventArgs.cs @@ -2,7 +2,7 @@ using System; namespace BililiveRecorder.Core.Event { - public class AggregatedRoomEventArgs + public sealed class AggregatedRoomEventArgs { public AggregatedRoomEventArgs(IRoom room, T @event) { diff --git a/BililiveRecorder.Core/Event/IOStatsEventArgs.cs b/BililiveRecorder.Core/Event/IOStatsEventArgs.cs index 11fa4a2..40b08ef 100644 --- a/BililiveRecorder.Core/Event/IOStatsEventArgs.cs +++ b/BililiveRecorder.Core/Event/IOStatsEventArgs.cs @@ -2,7 +2,7 @@ using System; namespace BililiveRecorder.Core.Event { - public class IOStatsEventArgs : EventArgs + public sealed class IOStatsEventArgs : EventArgs { /// /// 当前统计区间的开始时间 diff --git a/BililiveRecorder.Core/Event/RecordFileClosedEventArgs.cs b/BililiveRecorder.Core/Event/RecordFileClosedEventArgs.cs index 550fab2..907f50e 100644 --- a/BililiveRecorder.Core/Event/RecordFileClosedEventArgs.cs +++ b/BililiveRecorder.Core/Event/RecordFileClosedEventArgs.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Event { - public class RecordFileClosedEventArgs : RecordEventArgsBase + public sealed class RecordFileClosedEventArgs : RecordEventArgsBase { public RecordFileClosedEventArgs() { } diff --git a/BililiveRecorder.Core/Event/RecordFileOpeningEventArgs.cs b/BililiveRecorder.Core/Event/RecordFileOpeningEventArgs.cs index 9af9076..bd4b8f7 100644 --- a/BililiveRecorder.Core/Event/RecordFileOpeningEventArgs.cs +++ b/BililiveRecorder.Core/Event/RecordFileOpeningEventArgs.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; namespace BililiveRecorder.Core.Event { - public class RecordFileOpeningEventArgs : RecordEventArgsBase + public sealed class RecordFileOpeningEventArgs : RecordEventArgsBase { public RecordFileOpeningEventArgs() { } diff --git a/BililiveRecorder.Core/Event/RecordSessionEndedEventArgs.cs b/BililiveRecorder.Core/Event/RecordSessionEndedEventArgs.cs index fcc1ade..559ceb4 100644 --- a/BililiveRecorder.Core/Event/RecordSessionEndedEventArgs.cs +++ b/BililiveRecorder.Core/Event/RecordSessionEndedEventArgs.cs @@ -1,6 +1,6 @@ namespace BililiveRecorder.Core.Event { - public class RecordSessionEndedEventArgs : RecordEventArgsBase + public sealed class RecordSessionEndedEventArgs : RecordEventArgsBase { public RecordSessionEndedEventArgs() { } diff --git a/BililiveRecorder.Core/Event/RecordSessionStartedEventArgs.cs b/BililiveRecorder.Core/Event/RecordSessionStartedEventArgs.cs index 16cb663..c9c6aef 100644 --- a/BililiveRecorder.Core/Event/RecordSessionStartedEventArgs.cs +++ b/BililiveRecorder.Core/Event/RecordSessionStartedEventArgs.cs @@ -1,6 +1,6 @@ namespace BililiveRecorder.Core.Event { - public class RecordSessionStartedEventArgs : RecordEventArgsBase + public sealed class RecordSessionStartedEventArgs : RecordEventArgsBase { public RecordSessionStartedEventArgs() { } diff --git a/BililiveRecorder.Core/Event/RecordingStatsEventArgs.cs b/BililiveRecorder.Core/Event/RecordingStatsEventArgs.cs index 3107b6f..1d071de 100644 --- a/BililiveRecorder.Core/Event/RecordingStatsEventArgs.cs +++ b/BililiveRecorder.Core/Event/RecordingStatsEventArgs.cs @@ -2,7 +2,7 @@ using System; namespace BililiveRecorder.Core.Event { - public class RecordingStatsEventArgs : EventArgs + public sealed class RecordingStatsEventArgs : EventArgs { /// /// 从录制开始到现在一共经过的时间,毫秒 diff --git a/BililiveRecorder.Core/IRoomFactory.cs b/BililiveRecorder.Core/IRoomFactory.cs index 717f28e..3595c5e 100644 --- a/BililiveRecorder.Core/IRoomFactory.cs +++ b/BililiveRecorder.Core/IRoomFactory.cs @@ -2,7 +2,7 @@ using BililiveRecorder.Core.Config.V3; namespace BililiveRecorder.Core { - public interface IRoomFactory + internal interface IRoomFactory { IRoom CreateRoom(RoomConfig roomConfig, int initDelayFactor); } diff --git a/BililiveRecorder.Core/LoggingContext.cs b/BililiveRecorder.Core/LoggingContext.cs index ae86e8c..18a1a21 100644 --- a/BililiveRecorder.Core/LoggingContext.cs +++ b/BililiveRecorder.Core/LoggingContext.cs @@ -1,6 +1,6 @@ namespace BililiveRecorder.Core { - public class LoggingContext + public static class LoggingContext { public const string RoomId = nameof(RoomId); } diff --git a/BililiveRecorder.Core/NoMatchingQnValueException.cs b/BililiveRecorder.Core/NoMatchingQnValueException.cs index 22e8e52..fdefdd6 100644 --- a/BililiveRecorder.Core/NoMatchingQnValueException.cs +++ b/BililiveRecorder.Core/NoMatchingQnValueException.cs @@ -3,22 +3,11 @@ using System.Runtime.Serialization; namespace BililiveRecorder.Core { - public class NoMatchingQnValueException : Exception + internal class NoMatchingQnValueException : Exception { - public NoMatchingQnValueException() - { - } - - public NoMatchingQnValueException(string message) : base(message) - { - } - - public NoMatchingQnValueException(string message, Exception innerException) : base(message, innerException) - { - } - - protected NoMatchingQnValueException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } + public NoMatchingQnValueException() { } + public NoMatchingQnValueException(string message) : base(message) { } + public NoMatchingQnValueException(string message, Exception innerException) : base(message, innerException) { } + protected NoMatchingQnValueException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/BililiveRecorder.Core/PollyPolicy.cs b/BililiveRecorder.Core/PollyPolicy.cs index 3a71189..932f6e5 100644 --- a/BililiveRecorder.Core/PollyPolicy.cs +++ b/BililiveRecorder.Core/PollyPolicy.cs @@ -15,7 +15,7 @@ namespace BililiveRecorder.Core { private static readonly ILogger logger = Log.ForContext(); - public PollyPolicy() + internal PollyPolicy() { this.IpBlockedHttp412CircuitBreakerPolicy = Policy .Handle() diff --git a/BililiveRecorder.Core/ProcessingRules/SplitRule.cs b/BililiveRecorder.Core/ProcessingRules/SplitRule.cs index a9319df..69a9646 100644 --- a/BililiveRecorder.Core/ProcessingRules/SplitRule.cs +++ b/BililiveRecorder.Core/ProcessingRules/SplitRule.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Flv.Pipeline.Actions; namespace BililiveRecorder.Core.ProcessingRules { - public class SplitRule : ISimpleProcessingRule + internal class SplitRule : ISimpleProcessingRule { // 0 = none, 1 = after, 2 = before private int splitFlag = 0; diff --git a/BililiveRecorder.Core/ProcessingRules/StatsRule.cs b/BililiveRecorder.Core/ProcessingRules/StatsRule.cs index 1fbfb72..7f02668 100644 --- a/BililiveRecorder.Core/ProcessingRules/StatsRule.cs +++ b/BililiveRecorder.Core/ProcessingRules/StatsRule.cs @@ -9,7 +9,7 @@ using StructLinq; namespace BililiveRecorder.Core.ProcessingRules { - public class StatsRule : ISimpleProcessingRule + internal class StatsRule : ISimpleProcessingRule { public const string SkipStatsKey = nameof(SkipStatsKey); diff --git a/BililiveRecorder.Core/Recorder.cs b/BililiveRecorder.Core/Recorder.cs index 1b280b9..13032c0 100644 --- a/BililiveRecorder.Core/Recorder.cs +++ b/BililiveRecorder.Core/Recorder.cs @@ -11,7 +11,7 @@ using Serilog; namespace BililiveRecorder.Core { - public class Recorder : IRecorder + internal class Recorder : IRecorder { private readonly object lockObject = new object(); private readonly ObservableCollection roomCollection; diff --git a/BililiveRecorder.Core/Recording/FlvProcessingContextWriterWithFileWriterFactory.cs b/BililiveRecorder.Core/Recording/FlvProcessingContextWriterWithFileWriterFactory.cs index cb26ff4..301747c 100644 --- a/BililiveRecorder.Core/Recording/FlvProcessingContextWriterWithFileWriterFactory.cs +++ b/BililiveRecorder.Core/Recording/FlvProcessingContextWriterWithFileWriterFactory.cs @@ -6,7 +6,7 @@ using Serilog; namespace BililiveRecorder.Core.Recording { - public class FlvProcessingContextWriterWithFileWriterFactory : IFlvProcessingContextWriterFactory + internal class FlvProcessingContextWriterWithFileWriterFactory : IFlvProcessingContextWriterFactory { private readonly IServiceProvider serviceProvider; diff --git a/BililiveRecorder.Core/Recording/FlvTagReaderFactory.cs b/BililiveRecorder.Core/Recording/FlvTagReaderFactory.cs index 524dde4..4869e7e 100644 --- a/BililiveRecorder.Core/Recording/FlvTagReaderFactory.cs +++ b/BililiveRecorder.Core/Recording/FlvTagReaderFactory.cs @@ -7,7 +7,7 @@ using Serilog; namespace BililiveRecorder.Core.Recording { - public class FlvTagReaderFactory : IFlvTagReaderFactory + internal class FlvTagReaderFactory : IFlvTagReaderFactory { private readonly IServiceProvider serviceProvider; diff --git a/BililiveRecorder.Core/Recording/IFlvProcessingContextWriterFactory.cs b/BililiveRecorder.Core/Recording/IFlvProcessingContextWriterFactory.cs index c42deb5..496b47f 100644 --- a/BililiveRecorder.Core/Recording/IFlvProcessingContextWriterFactory.cs +++ b/BililiveRecorder.Core/Recording/IFlvProcessingContextWriterFactory.cs @@ -2,7 +2,7 @@ using BililiveRecorder.Flv; namespace BililiveRecorder.Core.Recording { - public interface IFlvProcessingContextWriterFactory + internal interface IFlvProcessingContextWriterFactory { IFlvProcessingContextWriter CreateWriter(IFlvWriterTargetProvider targetProvider); } diff --git a/BililiveRecorder.Core/Recording/IFlvTagReaderFactory.cs b/BililiveRecorder.Core/Recording/IFlvTagReaderFactory.cs index e3e818f..1a84ded 100644 --- a/BililiveRecorder.Core/Recording/IFlvTagReaderFactory.cs +++ b/BililiveRecorder.Core/Recording/IFlvTagReaderFactory.cs @@ -3,7 +3,7 @@ using BililiveRecorder.Flv; namespace BililiveRecorder.Core.Recording { - public interface IFlvTagReaderFactory + internal interface IFlvTagReaderFactory { IFlvTagReader CreateFlvTagReader(PipeReader pipeReader); } diff --git a/BililiveRecorder.Core/Recording/IRecordTask.cs b/BililiveRecorder.Core/Recording/IRecordTask.cs index 84577cc..15f50a7 100644 --- a/BililiveRecorder.Core/Recording/IRecordTask.cs +++ b/BililiveRecorder.Core/Recording/IRecordTask.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Event; namespace BililiveRecorder.Core.Recording { - public interface IRecordTask + internal interface IRecordTask { Guid SessionId { get; } diff --git a/BililiveRecorder.Core/Recording/IRecordTaskFactory.cs b/BililiveRecorder.Core/Recording/IRecordTaskFactory.cs index a2f4d69..ab0388d 100644 --- a/BililiveRecorder.Core/Recording/IRecordTaskFactory.cs +++ b/BililiveRecorder.Core/Recording/IRecordTaskFactory.cs @@ -1,6 +1,6 @@ namespace BililiveRecorder.Core.Recording { - public interface IRecordTaskFactory + internal interface IRecordTaskFactory { IRecordTask CreateRecordTask(IRoom room); } diff --git a/BililiveRecorder.Core/Recording/ITagGroupReaderFactory.cs b/BililiveRecorder.Core/Recording/ITagGroupReaderFactory.cs index efddab4..2c9779e 100644 --- a/BililiveRecorder.Core/Recording/ITagGroupReaderFactory.cs +++ b/BililiveRecorder.Core/Recording/ITagGroupReaderFactory.cs @@ -2,7 +2,7 @@ using BililiveRecorder.Flv; namespace BililiveRecorder.Core.Recording { - public interface ITagGroupReaderFactory + internal interface ITagGroupReaderFactory { ITagGroupReader CreateTagGroupReader(IFlvTagReader flvTagReader); } diff --git a/BililiveRecorder.Core/Recording/RawDataRecordTask.cs b/BililiveRecorder.Core/Recording/RawDataRecordTask.cs index 971084d..f40e4be 100644 --- a/BililiveRecorder.Core/Recording/RawDataRecordTask.cs +++ b/BililiveRecorder.Core/Recording/RawDataRecordTask.cs @@ -10,7 +10,7 @@ using Serilog; namespace BililiveRecorder.Core.Recording { - public class RawDataRecordTask : RecordTaskBase + internal class RawDataRecordTask : RecordTaskBase { private RecordFileOpeningEventArgs? fileOpeningEventArgs; diff --git a/BililiveRecorder.Core/Recording/RecordTaskBase.cs b/BililiveRecorder.Core/Recording/RecordTaskBase.cs index 330fa92..b0a1905 100644 --- a/BililiveRecorder.Core/Recording/RecordTaskBase.cs +++ b/BililiveRecorder.Core/Recording/RecordTaskBase.cs @@ -17,7 +17,7 @@ using Timer = System.Timers.Timer; namespace BililiveRecorder.Core.Recording { - public abstract class RecordTaskBase : IRecordTask + internal abstract class RecordTaskBase : IRecordTask { private const string HttpHeaderAccept = "*/*"; private const string HttpHeaderOrigin = "https://live.bilibili.com"; diff --git a/BililiveRecorder.Core/Recording/RecordTaskFactory.cs b/BililiveRecorder.Core/Recording/RecordTaskFactory.cs index d4925d1..9e2aaf8 100644 --- a/BililiveRecorder.Core/Recording/RecordTaskFactory.cs +++ b/BililiveRecorder.Core/Recording/RecordTaskFactory.cs @@ -5,7 +5,7 @@ using Serilog; namespace BililiveRecorder.Core.Recording { - public class RecordTaskFactory : IRecordTaskFactory + internal class RecordTaskFactory : IRecordTaskFactory { private readonly ILogger logger; private readonly IServiceProvider serviceProvider; diff --git a/BililiveRecorder.Core/Recording/StandardRecordTask.cs b/BililiveRecorder.Core/Recording/StandardRecordTask.cs index 5f37ffe..7a1a823 100644 --- a/BililiveRecorder.Core/Recording/StandardRecordTask.cs +++ b/BililiveRecorder.Core/Recording/StandardRecordTask.cs @@ -19,7 +19,7 @@ using Serilog; namespace BililiveRecorder.Core.Recording { - public class StandardRecordTask : RecordTaskBase + internal class StandardRecordTask : RecordTaskBase { private readonly IFlvTagReaderFactory flvTagReaderFactory; private readonly ITagGroupReaderFactory tagGroupReaderFactory; diff --git a/BililiveRecorder.Core/Recording/TagGroupReaderFactory.cs b/BililiveRecorder.Core/Recording/TagGroupReaderFactory.cs index 081c21e..860ea79 100644 --- a/BililiveRecorder.Core/Recording/TagGroupReaderFactory.cs +++ b/BililiveRecorder.Core/Recording/TagGroupReaderFactory.cs @@ -3,7 +3,7 @@ using BililiveRecorder.Flv.Grouping; namespace BililiveRecorder.Core.Recording { - public class TagGroupReaderFactory : ITagGroupReaderFactory + internal class TagGroupReaderFactory : ITagGroupReaderFactory { public ITagGroupReader CreateTagGroupReader(IFlvTagReader flvTagReader) => new TagGroupReader(flvTagReader); diff --git a/BililiveRecorder.Core/RestartRecordingReason.cs b/BililiveRecorder.Core/RestartRecordingReason.cs index ab4b70a..9a976dd 100644 --- a/BililiveRecorder.Core/RestartRecordingReason.cs +++ b/BililiveRecorder.Core/RestartRecordingReason.cs @@ -1,6 +1,6 @@ namespace BililiveRecorder.Core { - public enum RestartRecordingReason + internal enum RestartRecordingReason { /// /// 普通重试 diff --git a/BililiveRecorder.Core/Room.cs b/BililiveRecorder.Core/Room.cs index 5c191ba..7754b75 100644 --- a/BililiveRecorder.Core/Room.cs +++ b/BililiveRecorder.Core/Room.cs @@ -19,7 +19,7 @@ using Timer = System.Timers.Timer; namespace BililiveRecorder.Core { - public class Room : IRoom + internal class Room : IRoom { private readonly object recordStartLock = new object(); private readonly SemaphoreSlim recordRetryDelaySemaphoreSlim = new SemaphoreSlim(1, 1); @@ -51,7 +51,7 @@ namespace BililiveRecorder.Core private DateTimeOffset danmakuClientConnectTime; private static readonly TimeSpan danmakuClientReconnectNoDelay = TimeSpan.FromMinutes(1); - public Room(IServiceScope scope, RoomConfig roomConfig, int initDelayFactor, ILogger logger, IDanmakuClient danmakuClient, IApiClient apiClient, IBasicDanmakuWriter basicDanmakuWriter, IRecordTaskFactory recordTaskFactory) + internal Room(IServiceScope scope, RoomConfig roomConfig, int initDelayFactor, ILogger logger, IDanmakuClient danmakuClient, IApiClient apiClient, IBasicDanmakuWriter basicDanmakuWriter, IRecordTaskFactory recordTaskFactory) { this.scope = scope ?? throw new ArgumentNullException(nameof(scope)); this.RoomConfig = roomConfig ?? throw new ArgumentNullException(nameof(roomConfig)); diff --git a/BililiveRecorder.Core/RoomFactory.cs b/BililiveRecorder.Core/RoomFactory.cs index 5bad53a..30d8a16 100644 --- a/BililiveRecorder.Core/RoomFactory.cs +++ b/BililiveRecorder.Core/RoomFactory.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection; namespace BililiveRecorder.Core { - public class RoomFactory : IRoomFactory + internal class RoomFactory : IRoomFactory { private readonly IServiceProvider serviceProvider; diff --git a/BililiveRecorder.Core/Scripting/Runtime/JintConsole.cs b/BililiveRecorder.Core/Scripting/Runtime/JintConsole.cs index a61c208..521ce19 100644 --- a/BililiveRecorder.Core/Scripting/Runtime/JintConsole.cs +++ b/BililiveRecorder.Core/Scripting/Runtime/JintConsole.cs @@ -15,7 +15,7 @@ using Serilog.Events; namespace BililiveRecorder.Core.Scripting.Runtime { - public class JintConsole : ObjectInstance + internal class JintConsole : ObjectInstance { private readonly ILogger logger; diff --git a/BililiveRecorder.Core/Scripting/Runtime/JintDns.cs b/BililiveRecorder.Core/Scripting/Runtime/JintDns.cs index cb70249..406c2af 100644 --- a/BililiveRecorder.Core/Scripting/Runtime/JintDns.cs +++ b/BililiveRecorder.Core/Scripting/Runtime/JintDns.cs @@ -10,7 +10,7 @@ using Jint.Runtime.Interop; namespace BililiveRecorder.Core.Scripting.Runtime { - public class JintDns : ObjectInstance + internal class JintDns : ObjectInstance { public JintDns(Engine engine) : base(engine) { diff --git a/BililiveRecorder.Core/Scripting/Runtime/JintDotnet.cs b/BililiveRecorder.Core/Scripting/Runtime/JintDotnet.cs index a296704..530e466 100644 --- a/BililiveRecorder.Core/Scripting/Runtime/JintDotnet.cs +++ b/BililiveRecorder.Core/Scripting/Runtime/JintDotnet.cs @@ -9,7 +9,7 @@ using Jint.Runtime.Interop; namespace BililiveRecorder.Core.Scripting.Runtime { - public class JintDotnet : ObjectInstance + internal class JintDotnet : ObjectInstance { public JintDotnet(Engine engine) : base(engine) { diff --git a/BililiveRecorder.Core/Scripting/Runtime/JintFetchSync.cs b/BililiveRecorder.Core/Scripting/Runtime/JintFetchSync.cs index f8f102f..518678a 100644 --- a/BililiveRecorder.Core/Scripting/Runtime/JintFetchSync.cs +++ b/BililiveRecorder.Core/Scripting/Runtime/JintFetchSync.cs @@ -9,7 +9,7 @@ using Jint.Runtime; namespace BililiveRecorder.Core.Scripting.Runtime { - public class JintFetchSync : FunctionInstance + internal class JintFetchSync : FunctionInstance { private static readonly JsString functionName = new JsString("fetchSync"); diff --git a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs index 76f5a19..229a00b 100644 --- a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs +++ b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV1.cs @@ -9,7 +9,7 @@ using Serilog; namespace BililiveRecorder.Core.SimpleWebhook { - public class BasicWebhookV1 + internal class BasicWebhookV1 { private static readonly ILogger logger = Log.ForContext(); diff --git a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs index b1eeddf..c61b6bf 100644 --- a/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs +++ b/BililiveRecorder.Core/SimpleWebhook/BasicWebhookV2.cs @@ -10,7 +10,7 @@ using Serilog; namespace BililiveRecorder.Core.SimpleWebhook { - public class BasicWebhookV2 + internal class BasicWebhookV2 { private static readonly ILogger logger = Log.ForContext(); diff --git a/BililiveRecorder.Core/SimpleWebhook/EventType.cs b/BililiveRecorder.Core/SimpleWebhook/EventType.cs index f6c1efa..58e6c4d 100644 --- a/BililiveRecorder.Core/SimpleWebhook/EventType.cs +++ b/BililiveRecorder.Core/SimpleWebhook/EventType.cs @@ -4,12 +4,32 @@ using Newtonsoft.Json.Converters; namespace BililiveRecorder.Core.SimpleWebhook { [JsonConverter(typeof(StringEnumConverter))] - public enum EventType + internal enum EventType { Unknown, + /// + /// 录制开始 + /// SessionStarted, + /// + /// 录制结束 + /// SessionEnded, + /// + /// 新建了文件 + /// FileOpening, + /// + /// 文件写入结束 + /// FileClosed, + /// + /// 直播开始 + /// + StreamStarted, + /// + /// 直播结束 + /// + StreamEnded, } } diff --git a/BililiveRecorder.Core/SimpleWebhook/EventWrapper.cs b/BililiveRecorder.Core/SimpleWebhook/EventWrapper.cs index 68d2c96..ecc0ad2 100644 --- a/BililiveRecorder.Core/SimpleWebhook/EventWrapper.cs +++ b/BililiveRecorder.Core/SimpleWebhook/EventWrapper.cs @@ -2,7 +2,7 @@ using System; namespace BililiveRecorder.Core.SimpleWebhook { - public class EventWrapper where T : class + internal class EventWrapper where T : class { public EventWrapper() { diff --git a/BililiveRecorder.Core/SimpleWebhook/RecordEndData.cs b/BililiveRecorder.Core/SimpleWebhook/RecordEndData.cs index 85398cc..9ff751a 100644 --- a/BililiveRecorder.Core/SimpleWebhook/RecordEndData.cs +++ b/BililiveRecorder.Core/SimpleWebhook/RecordEndData.cs @@ -4,7 +4,7 @@ using BililiveRecorder.Core.Event; #nullable enable namespace BililiveRecorder.Core.SimpleWebhook { - public class RecordEndData + internal class RecordEndData { public RecordEndData(RecordFileClosedEventArgs args) { diff --git a/BililiveRecorder.Core/Templating/StreamQualityNumber.cs b/BililiveRecorder.Core/Templating/StreamQualityNumber.cs index 86e5b64..b969d87 100644 --- a/BililiveRecorder.Core/Templating/StreamQualityNumber.cs +++ b/BililiveRecorder.Core/Templating/StreamQualityNumber.cs @@ -5,7 +5,7 @@ using Fluid.Values; namespace BililiveRecorder.Core.Templating { - public static class StreamQualityNumber + internal static class StreamQualityNumber { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string MapToString(int qn) => qn switch @@ -22,7 +22,6 @@ namespace BililiveRecorder.Core.Templating _ => $"未知({qn})" }; - public static ValueTask MapToStringFilterDelegateAsync(FluidValue input, FilterArguments arguments, TemplateContext context) => new StringValue(MapToString((int)input.ToNumberValue())); } diff --git a/BililiveRecorder.WPF/App.xaml b/BililiveRecorder.WPF/App.xaml index c1dc34d..aa595f9 100644 --- a/BililiveRecorder.WPF/App.xaml +++ b/BililiveRecorder.WPF/App.xaml @@ -28,7 +28,7 @@ + DataType="{x:Type core:IRoom}"> diff --git a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml index 08de9fd..95b7fab 100644 --- a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml +++ b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml @@ -45,7 +45,7 @@ - + diff --git a/BililiveRecorder.WPF/Models/PollyPolicyModel.cs b/BililiveRecorder.WPF/Models/PollyPolicyModel.cs index 561c205..bcfd7c0 100644 --- a/BililiveRecorder.WPF/Models/PollyPolicyModel.cs +++ b/BililiveRecorder.WPF/Models/PollyPolicyModel.cs @@ -24,10 +24,11 @@ namespace BililiveRecorder.WPF.Models { ExecuteDelegate = _ => { - if (this.policy != null) + if (this.policy is { } p) { - this.policy.IpBlockedHttp412CircuitBreakerPolicy.Reset(); - this.policy.RequestFailedCircuitBreakerPolicy.Reset(); + p.IpBlockedHttp412CircuitBreakerPolicy.Reset(); + p.RequestFailedCircuitBreakerPolicy.Reset(); + p.memoryCache.Compact(1); } } }; diff --git a/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml.cs b/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml.cs index 9958682..5f47cee 100644 --- a/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml.cs +++ b/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml.cs @@ -2,7 +2,7 @@ using System; using System.Runtime.Serialization; using System.Threading.Tasks; using System.Windows; -using BililiveRecorder.Core.Api.Http; +using BililiveRecorder.Core.Api; using BililiveRecorder.Core.Scripting; using Newtonsoft.Json.Linq; using Serilog; @@ -16,10 +16,10 @@ namespace BililiveRecorder.WPF.Pages public partial class AdvancedSettingsPage { private static readonly ILogger logger = Log.ForContext(); - private readonly HttpApiClient? httpApiClient; + private readonly IHttpClientAccessor? httpApiClient; private readonly UserScriptRunner? userScriptRunner; - public AdvancedSettingsPage(HttpApiClient? httpApiClient, UserScriptRunner? userScriptRunner) + public AdvancedSettingsPage(IHttpClientAccessor? httpApiClient, UserScriptRunner? userScriptRunner) { this.InitializeComponent(); this.httpApiClient = httpApiClient; @@ -28,7 +28,7 @@ namespace BililiveRecorder.WPF.Pages public AdvancedSettingsPage() : this( - (HttpApiClient?)(RootPage.ServiceProvider?.GetService(typeof(HttpApiClient))), + (IHttpClientAccessor?)(RootPage.ServiceProvider?.GetService(typeof(IHttpClientAccessor))), (UserScriptRunner?)(RootPage.ServiceProvider?.GetService(typeof(UserScriptRunner))) ) { } diff --git a/BililiveRecorder.WPF/Program.cs b/BililiveRecorder.WPF/Program.cs index 4ce4028..22e2597 100644 --- a/BililiveRecorder.WPF/Program.cs +++ b/BililiveRecorder.WPF/Program.cs @@ -280,7 +280,7 @@ namespace BililiveRecorder.WPF private class SentryEventProcessor : ISentryEventProcessor { - private static readonly string JintConsole = typeof(Core.Scripting.Runtime.JintConsole).FullName; + private const string JintConsole = "Core.Scripting.Runtime.JintConsole"; private static readonly string UserScriptRunner = typeof(Core.Scripting.UserScriptRunner).FullName; public SentryEvent? Process(SentryEvent e) => (e?.Logger == JintConsole || e?.Logger == UserScriptRunner) ? null : e; } diff --git a/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj b/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj index f067eae..a4ecf33 100644 --- a/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj +++ b/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj @@ -9,6 +9,9 @@ + + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/BililiveRecorder.Core.UnitTests/Expectations/PublicApi.HasNoChangesAsync.verified.txt b/test/BililiveRecorder.Core.UnitTests/Expectations/PublicApi.HasNoChangesAsync.verified.txt new file mode 100644 index 0000000..0df5231 --- /dev/null +++ b/test/BililiveRecorder.Core.UnitTests/Expectations/PublicApi.HasNoChangesAsync.verified.txt @@ -0,0 +1,491 @@ +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("BililiveRecorder.Core.UnitTests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName="")] +namespace BililiveRecorder.Core.Api +{ + public interface IHttpClientAccessor + { + System.Net.Http.HttpClient MainHttpClient { get; } + } +} +namespace BililiveRecorder.Core.Config +{ + public enum AllowedAddressFamily + { + System = -1, + Any = 0, + Ipv4 = 1, + Ipv6 = 2, + } + [Newtonsoft.Json.JsonConverter(typeof(JsonSubTypes.JsonSubtypes?), new object?[]?[] { + "Version"})] + public abstract class ConfigBase + { + protected ConfigBase() { } + [Newtonsoft.Json.JsonProperty("$schema", Order=-2)] + public string? DollarSignSchema { get; set; } + [Newtonsoft.Json.JsonProperty("version")] + public virtual int Version { get; set; } + } + public class ConfigParser + { + public const string CONFIG_FILE_NAME = "config.json"; + public ConfigParser() { } + public static BililiveRecorder.Core.Config.V3.ConfigV3? LoadFrom(string directory) { } + public static BililiveRecorder.Core.Config.V3.ConfigV3? LoadJson(string json) { } + public static string? SaveJson(BililiveRecorder.Core.Config.V3.ConfigV3 config) { } + public static bool SaveTo(string directory, BililiveRecorder.Core.Config.V3.ConfigV3 config) { } + public static void WriteAllTextWithBackup(string path, string contents) { } + } + public enum CuttingMode + { + Disabled = 0, + ByTime = 1, + BySize = 2, + } + public enum RecordMode + { + Standard = 0, + RawData = 1, + } +} +namespace BililiveRecorder.Core.Config.V3 +{ + public sealed class ConfigV3 : BililiveRecorder.Core.Config.ConfigBase + { + public ConfigV3() { } + [Newtonsoft.Json.JsonIgnore] + public bool DisableConfigSave { get; set; } + [Newtonsoft.Json.JsonProperty("global")] + public BililiveRecorder.Core.Config.V3.GlobalConfig Global { get; set; } + [Newtonsoft.Json.JsonProperty("rooms")] + public System.Collections.Generic.List Rooms { get; set; } + public override int Version { get; } + } + public sealed class DefaultConfig + { + public static readonly BililiveRecorder.Core.Config.V3.DefaultConfig Instance; + public string Cookie { get; } + public BililiveRecorder.Core.Config.CuttingMode CuttingMode { get; } + public uint CuttingNumber { get; } + public string FileNameRecordTemplate { get; } + public string LiveApiHost { get; } + public BililiveRecorder.Core.Config.AllowedAddressFamily NetworkTransportAllowedAddressFamily { get; } + public bool NetworkTransportUseSystemProxy { get; } + public bool RecordDanmaku { get; } + public uint RecordDanmakuFlushInterval { get; } + public bool RecordDanmakuGift { get; } + public bool RecordDanmakuGuard { get; } + public bool RecordDanmakuRaw { get; } + public bool RecordDanmakuSuperChat { get; } + public BililiveRecorder.Core.Config.RecordMode RecordMode { get; } + public string RecordingQuality { get; } + public uint TimingCheckInterval { get; } + public uint TimingDanmakuRetry { get; } + public uint TimingStreamConnect { get; } + public uint TimingStreamRetry { get; } + public uint TimingStreamRetryNoQn { get; } + public uint TimingWatchdogTimeout { get; } + public string UserScript { get; } + public string WebHookUrls { get; } + public string WebHookUrlsV2 { get; } + public bool WpfShowTitleAndArea { get; } + } + [Newtonsoft.Json.JsonObject(Newtonsoft.Json.MemberSerialization.OptIn)] + public sealed class GlobalConfig : HierarchicalPropertyDefault.HierarchicalObject + { + public GlobalConfig() { } + public string? Cookie { get; set; } + public BililiveRecorder.Core.Config.CuttingMode CuttingMode { get; set; } + public uint CuttingNumber { get; set; } + public string? FileNameRecordTemplate { get; set; } + public bool HasCookie { get; set; } + public bool HasCuttingMode { get; set; } + public bool HasCuttingNumber { get; set; } + public bool HasFileNameRecordTemplate { get; set; } + public bool HasLiveApiHost { get; set; } + public bool HasNetworkTransportAllowedAddressFamily { get; set; } + public bool HasNetworkTransportUseSystemProxy { get; set; } + public bool HasRecordDanmaku { get; set; } + public bool HasRecordDanmakuFlushInterval { get; set; } + public bool HasRecordDanmakuGift { get; set; } + public bool HasRecordDanmakuGuard { get; set; } + public bool HasRecordDanmakuRaw { get; set; } + public bool HasRecordDanmakuSuperChat { get; set; } + public bool HasRecordMode { get; set; } + public bool HasRecordingQuality { get; set; } + public bool HasTimingCheckInterval { get; set; } + public bool HasTimingDanmakuRetry { get; set; } + public bool HasTimingStreamConnect { get; set; } + public bool HasTimingStreamRetry { get; set; } + public bool HasTimingStreamRetryNoQn { get; set; } + public bool HasTimingWatchdogTimeout { get; set; } + public bool HasUserScript { get; set; } + public bool HasWebHookUrls { get; set; } + public bool HasWebHookUrlsV2 { get; set; } + public bool HasWpfShowTitleAndArea { get; set; } + public string? LiveApiHost { get; set; } + public BililiveRecorder.Core.Config.AllowedAddressFamily NetworkTransportAllowedAddressFamily { get; set; } + public bool NetworkTransportUseSystemProxy { get; set; } + [Newtonsoft.Json.JsonProperty("Cookie")] + public HierarchicalPropertyDefault.Optional OptionalCookie { get; set; } + [Newtonsoft.Json.JsonProperty("CuttingMode")] + public HierarchicalPropertyDefault.Optional OptionalCuttingMode { get; set; } + [Newtonsoft.Json.JsonProperty("CuttingNumber")] + public HierarchicalPropertyDefault.Optional OptionalCuttingNumber { get; set; } + [Newtonsoft.Json.JsonProperty("FileNameRecordTemplate")] + public HierarchicalPropertyDefault.Optional OptionalFileNameRecordTemplate { get; set; } + [Newtonsoft.Json.JsonProperty("LiveApiHost")] + public HierarchicalPropertyDefault.Optional OptionalLiveApiHost { get; set; } + [Newtonsoft.Json.JsonProperty("NetworkTransportAllowedAddressFamily")] + public HierarchicalPropertyDefault.Optional OptionalNetworkTransportAllowedAddressFamily { get; set; } + [Newtonsoft.Json.JsonProperty("NetworkTransportUseSystemProxy")] + public HierarchicalPropertyDefault.Optional OptionalNetworkTransportUseSystemProxy { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmaku")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmaku { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuFlushInterval")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuFlushInterval { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuGift")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuGift { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuGuard")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuGuard { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuRaw")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuRaw { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuSuperChat")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuSuperChat { get; set; } + [Newtonsoft.Json.JsonProperty("RecordMode")] + public HierarchicalPropertyDefault.Optional OptionalRecordMode { get; set; } + [Newtonsoft.Json.JsonProperty("RecordingQuality")] + public HierarchicalPropertyDefault.Optional OptionalRecordingQuality { get; set; } + [Newtonsoft.Json.JsonProperty("TimingCheckInterval")] + public HierarchicalPropertyDefault.Optional OptionalTimingCheckInterval { get; set; } + [Newtonsoft.Json.JsonProperty("TimingDanmakuRetry")] + public HierarchicalPropertyDefault.Optional OptionalTimingDanmakuRetry { get; set; } + [Newtonsoft.Json.JsonProperty("TimingStreamConnect")] + public HierarchicalPropertyDefault.Optional OptionalTimingStreamConnect { get; set; } + [Newtonsoft.Json.JsonProperty("TimingStreamRetry")] + public HierarchicalPropertyDefault.Optional OptionalTimingStreamRetry { get; set; } + [Newtonsoft.Json.JsonProperty("TimingStreamRetryNoQn")] + public HierarchicalPropertyDefault.Optional OptionalTimingStreamRetryNoQn { get; set; } + [Newtonsoft.Json.JsonProperty("TimingWatchdogTimeout")] + public HierarchicalPropertyDefault.Optional OptionalTimingWatchdogTimeout { get; set; } + [Newtonsoft.Json.JsonProperty("UserScript")] + public HierarchicalPropertyDefault.Optional OptionalUserScript { get; set; } + [Newtonsoft.Json.JsonProperty("WebHookUrls")] + public HierarchicalPropertyDefault.Optional OptionalWebHookUrls { get; set; } + [Newtonsoft.Json.JsonProperty("WebHookUrlsV2")] + public HierarchicalPropertyDefault.Optional OptionalWebHookUrlsV2 { get; set; } + [Newtonsoft.Json.JsonProperty("WpfShowTitleAndArea")] + public HierarchicalPropertyDefault.Optional OptionalWpfShowTitleAndArea { get; set; } + public bool RecordDanmaku { get; set; } + public uint RecordDanmakuFlushInterval { get; set; } + public bool RecordDanmakuGift { get; set; } + public bool RecordDanmakuGuard { get; set; } + public bool RecordDanmakuRaw { get; set; } + public bool RecordDanmakuSuperChat { get; set; } + public BililiveRecorder.Core.Config.RecordMode RecordMode { get; set; } + public string? RecordingQuality { get; set; } + public uint TimingCheckInterval { get; set; } + public uint TimingDanmakuRetry { get; set; } + public uint TimingStreamConnect { get; set; } + public uint TimingStreamRetry { get; set; } + public uint TimingStreamRetryNoQn { get; set; } + public uint TimingWatchdogTimeout { get; set; } + public string UserScript { get; set; } + public string? WebHookUrls { get; set; } + public string? WebHookUrlsV2 { get; set; } + public string? WorkDirectory { get; set; } + public bool WpfShowTitleAndArea { get; set; } + } + [Newtonsoft.Json.JsonObject(Newtonsoft.Json.MemberSerialization.OptIn)] + public sealed class RoomConfig : HierarchicalPropertyDefault.HierarchicalObject + { + public RoomConfig() { } + public bool AutoRecord { get; set; } + public string? Cookie { get; } + public BililiveRecorder.Core.Config.CuttingMode CuttingMode { get; set; } + public uint CuttingNumber { get; set; } + public string? FileNameRecordTemplate { get; } + public bool HasAutoRecord { get; set; } + public bool HasCuttingMode { get; set; } + public bool HasCuttingNumber { get; set; } + public bool HasRecordDanmaku { get; set; } + public bool HasRecordDanmakuGift { get; set; } + public bool HasRecordDanmakuGuard { get; set; } + public bool HasRecordDanmakuRaw { get; set; } + public bool HasRecordDanmakuSuperChat { get; set; } + public bool HasRecordMode { get; set; } + public bool HasRecordingQuality { get; set; } + public bool HasRoomId { get; set; } + public string? LiveApiHost { get; } + public BililiveRecorder.Core.Config.AllowedAddressFamily NetworkTransportAllowedAddressFamily { get; } + public bool NetworkTransportUseSystemProxy { get; } + [Newtonsoft.Json.JsonProperty("AutoRecord")] + public HierarchicalPropertyDefault.Optional OptionalAutoRecord { get; set; } + [Newtonsoft.Json.JsonProperty("CuttingMode")] + public HierarchicalPropertyDefault.Optional OptionalCuttingMode { get; set; } + [Newtonsoft.Json.JsonProperty("CuttingNumber")] + public HierarchicalPropertyDefault.Optional OptionalCuttingNumber { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmaku")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmaku { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuGift")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuGift { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuGuard")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuGuard { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuRaw")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuRaw { get; set; } + [Newtonsoft.Json.JsonProperty("RecordDanmakuSuperChat")] + public HierarchicalPropertyDefault.Optional OptionalRecordDanmakuSuperChat { get; set; } + [Newtonsoft.Json.JsonProperty("RecordMode")] + public HierarchicalPropertyDefault.Optional OptionalRecordMode { get; set; } + [Newtonsoft.Json.JsonProperty("RecordingQuality")] + public HierarchicalPropertyDefault.Optional OptionalRecordingQuality { get; set; } + [Newtonsoft.Json.JsonProperty("RoomId")] + public HierarchicalPropertyDefault.Optional OptionalRoomId { get; set; } + public bool RecordDanmaku { get; set; } + public uint RecordDanmakuFlushInterval { get; } + public bool RecordDanmakuGift { get; set; } + public bool RecordDanmakuGuard { get; set; } + public bool RecordDanmakuRaw { get; set; } + public bool RecordDanmakuSuperChat { get; set; } + public BililiveRecorder.Core.Config.RecordMode RecordMode { get; set; } + public string? RecordingQuality { get; set; } + public int RoomId { get; set; } + public uint TimingCheckInterval { get; } + public uint TimingDanmakuRetry { get; } + public uint TimingStreamConnect { get; } + public uint TimingStreamRetry { get; } + public uint TimingStreamRetryNoQn { get; } + public uint TimingWatchdogTimeout { get; } + public string UserScript { get; } + public string? WebHookUrls { get; } + public string? WebHookUrlsV2 { get; } + public string? WorkDirectory { get; } + public bool WpfShowTitleAndArea { get; } + } +} +namespace BililiveRecorder.Core.Event +{ + public sealed class AggregatedRoomEventArgs + { + public AggregatedRoomEventArgs(BililiveRecorder.Core.IRoom room, T @event) { } + public T Event { get; } + public BililiveRecorder.Core.IRoom Room { get; } + } + public sealed class IOStatsEventArgs : System.EventArgs + { + public IOStatsEventArgs() { } + public int DiskBytesWritten { get; set; } + public double DiskMBps { get; set; } + public System.TimeSpan DiskWriteDuration { get; set; } + public System.TimeSpan Duration { get; set; } + public System.DateTimeOffset EndTime { get; set; } + public int NetworkBytesDownloaded { get; set; } + public double NetworkMbps { get; set; } + public System.DateTimeOffset StartTime { get; set; } + } + public abstract class RecordEventArgsBase : System.EventArgs + { + public RecordEventArgsBase() { } + public RecordEventArgsBase(BililiveRecorder.Core.IRoom room) { } + public string AreaNameChild { get; set; } + public string AreaNameParent { get; set; } + public string Name { get; set; } + public int RoomId { get; set; } + public System.Guid SessionId { get; set; } + public int ShortId { get; set; } + public string Title { get; set; } + } + public sealed class RecordFileClosedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase + { + public RecordFileClosedEventArgs() { } + public RecordFileClosedEventArgs(BililiveRecorder.Core.IRoom room) { } + public double Duration { get; set; } + public System.DateTimeOffset FileCloseTime { get; set; } + public System.DateTimeOffset FileOpenTime { get; set; } + public long FileSize { get; set; } + [Newtonsoft.Json.JsonIgnore] + public string FullPath { get; set; } + public string RelativePath { get; set; } + } + public sealed class RecordFileOpeningEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase + { + public RecordFileOpeningEventArgs() { } + public RecordFileOpeningEventArgs(BililiveRecorder.Core.IRoom room) { } + public System.DateTimeOffset FileOpenTime { get; set; } + [Newtonsoft.Json.JsonIgnore] + public string FullPath { get; set; } + public string RelativePath { get; set; } + } + public sealed class RecordSessionEndedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase + { + public RecordSessionEndedEventArgs() { } + public RecordSessionEndedEventArgs(BililiveRecorder.Core.IRoom room) { } + } + public sealed class RecordSessionStartedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase + { + public RecordSessionStartedEventArgs() { } + public RecordSessionStartedEventArgs(BililiveRecorder.Core.IRoom room) { } + } + public sealed class RecordingStatsEventArgs : System.EventArgs + { + public RecordingStatsEventArgs() { } + public double AddedDuration { get; set; } + public long CurrentFileSize { get; set; } + public double DurationRatio { get; set; } + public int FileMaxTimestamp { get; set; } + public long InputAudioBytes { get; set; } + public long InputVideoBytes { get; set; } + public long OutputAudioBytes { get; set; } + public int OutputAudioFrames { get; set; } + public long OutputVideoBytes { get; set; } + public int OutputVideoFrames { get; set; } + public double PassedTime { get; set; } + public double SessionDuration { get; set; } + public int SessionMaxTimestamp { get; set; } + public long TotalInputAudioBytes { get; set; } + public long TotalInputBytes { get; set; } + public long TotalInputVideoBytes { get; set; } + public long TotalOutputAudioBytes { get; set; } + public int TotalOutputAudioFrames { get; set; } + public long TotalOutputBytes { get; set; } + public long TotalOutputVideoBytes { get; set; } + public int TotalOutputVideoFrames { get; set; } + } +} +namespace BililiveRecorder.Core +{ + public interface IRecorder : System.ComponentModel.INotifyPropertyChanged, System.IDisposable + { + BililiveRecorder.Core.Config.V3.ConfigV3 Config { get; } + System.Collections.ObjectModel.ReadOnlyObservableCollection Rooms { get; } + event System.EventHandler>? IOStats; + event System.EventHandler>? RecordFileClosed; + event System.EventHandler>? RecordFileOpening; + event System.EventHandler>? RecordSessionEnded; + event System.EventHandler>? RecordSessionStarted; + event System.EventHandler>? RecordingStats; + BililiveRecorder.Core.IRoom AddRoom(int roomid); + BililiveRecorder.Core.IRoom AddRoom(int roomid, bool enabled); + void RemoveRoom(BililiveRecorder.Core.IRoom room); + void SaveConfig(); + } + public interface IRoom : System.ComponentModel.INotifyPropertyChanged, System.IDisposable + { + string AreaNameChild { get; } + string AreaNameParent { get; } + bool AutoRecordForThisSession { get; } + bool DanmakuConnected { get; } + string Name { get; } + System.Guid ObjectId { get; } + Newtonsoft.Json.Linq.JObject? RawBilibiliApiJsonData { get; } + bool Recording { get; } + BililiveRecorder.Core.Config.V3.RoomConfig RoomConfig { get; } + int ShortId { get; } + BililiveRecorder.Core.RoomStats Stats { get; } + bool Streaming { get; } + string Title { get; } + event System.EventHandler? IOStats; + event System.EventHandler? RecordFileClosed; + event System.EventHandler? RecordFileOpening; + event System.EventHandler? RecordSessionEnded; + event System.EventHandler? RecordSessionStarted; + event System.EventHandler? RecordingStats; + System.Threading.Tasks.Task RefreshRoomInfoAsync(); + void SplitOutput(); + void StartRecord(); + void StopRecord(); + } + public static class LoggingContext + { + public const string RoomId = "RoomId"; + } + public class PollyPolicy : Polly.Registry.PolicyRegistry + { + public readonly Polly.CircuitBreaker.AsyncCircuitBreakerPolicy IpBlockedHttp412CircuitBreakerPolicy; + public readonly Polly.CircuitBreaker.AsyncCircuitBreakerPolicy RequestFailedCircuitBreakerPolicy; + public readonly Microsoft.Extensions.Caching.Memory.MemoryCache memoryCache; + } + public class RoomStats : System.ComponentModel.INotifyPropertyChanged + { + public RoomStats() { } + public double AddedDuration { get; set; } + public long CurrentFileSize { get; set; } + public int DiskBytesWritten { get; set; } + public double DiskMBps { get; set; } + public System.TimeSpan DiskWriteDuration { get; set; } + public System.TimeSpan Duration { get; set; } + public double DurationRatio { get; set; } + public System.DateTimeOffset EndTime { get; set; } + public System.TimeSpan FileMaxTimestamp { get; set; } + public long InputAudioBytes { get; set; } + public long InputVideoBytes { get; set; } + public int NetworkBytesDownloaded { get; set; } + public double NetworkMbps { get; set; } + public long OutputAudioBytes { get; set; } + public int OutputAudioFrames { get; set; } + public long OutputVideoBytes { get; set; } + public int OutputVideoFrames { get; set; } + public double PassedTime { get; set; } + public System.TimeSpan SessionDuration { get; set; } + public System.TimeSpan SessionMaxTimestamp { get; set; } + public System.DateTimeOffset StartTime { get; set; } + public long TotalInputAudioBytes { get; set; } + public long TotalInputBytes { get; set; } + public long TotalInputVideoBytes { get; set; } + public long TotalOutputAudioBytes { get; set; } + public int TotalOutputAudioFrames { get; set; } + public long TotalOutputBytes { get; set; } + public long TotalOutputVideoBytes { get; set; } + public int TotalOutputVideoFrames { get; set; } + public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged; + protected virtual void OnPropertyChanged(string propertyName) { } + public void Reset() { } + protected bool SetField(ref T location, T value, [System.Runtime.CompilerServices.CallerMemberName] string propertyName = "") { } + } +} +namespace BililiveRecorder.Core.Scripting +{ + public class UserScriptRunner + { + public UserScriptRunner(BililiveRecorder.Core.Config.V3.GlobalConfig config) { } + public string? CallOnFetchStreamUrl(Serilog.ILogger logger, int roomid, int[] qnSetting) { } + public void CallOnTest(Serilog.ILogger logger, System.Action? alert) { } + [return: System.Runtime.CompilerServices.TupleElementNames(new string[] { + "url", + "ip"})] + public System.ValueTuple? CallOnTransformStreamUrl(Serilog.ILogger logger, string originalUrl) { } + } +} +namespace BililiveRecorder.Core.Templating +{ + public class FileNameGenerator + { + public FileNameGenerator(BililiveRecorder.Core.Config.V3.GlobalConfig config) { } + [return: System.Runtime.CompilerServices.TupleElementNames(new string[] { + "fullPath", + "relativePath"})] + public System.ValueTuple CreateFilePath(BililiveRecorder.Core.Templating.FileNameGenerator.FileNameContextData data) { } + public class FileNameContextData + { + public FileNameContextData() { } + public string AreaChild { get; set; } + public string AreaParent { get; set; } + public Newtonsoft.Json.Linq.JObject? Json { get; set; } + public string Name { get; set; } + public int Qn { get; set; } + public int RoomId { get; set; } + public int ShortId { get; set; } + public string Title { get; set; } + } + } +} +namespace BililiveRecorder.DependencyInjection +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddRecorder(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { } + public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddRecorderApiClients(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { } + public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddRecorderConfig(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, BililiveRecorder.Core.Config.V3.ConfigV3 config) { } + public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddRecorderRecording(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { } + } +} \ No newline at end of file diff --git a/test/BililiveRecorder.Core.UnitTests/PublicApi.cs b/test/BililiveRecorder.Core.UnitTests/PublicApi.cs new file mode 100644 index 0000000..d937521 --- /dev/null +++ b/test/BililiveRecorder.Core.UnitTests/PublicApi.cs @@ -0,0 +1,18 @@ +using System.Threading.Tasks; +using PublicApiGenerator; +using VerifyXunit; +using Xunit; + +namespace BililiveRecorder.Core.UnitTests +{ + [UsesVerify] + public class PublicApi + { + [Fact] + public Task HasNoChangesAsync() + { + var publicApi = typeof(Recorder).Assembly.GeneratePublicApi(); + return Verifier.Verify(publicApi); + } + } +} diff --git a/test/BililiveRecorder.Core.UnitTests/VerifyConfig.cs b/test/BililiveRecorder.Core.UnitTests/VerifyConfig.cs new file mode 100644 index 0000000..84471ba --- /dev/null +++ b/test/BililiveRecorder.Core.UnitTests/VerifyConfig.cs @@ -0,0 +1,18 @@ +using System.IO; +using System.Runtime.CompilerServices; +using DiffEngine; +using VerifyTests; + +namespace BililiveRecorder.Core.UnitTests +{ + public static class VerifyConfig + { + [ModuleInitializer] + public static void Init() + { + VerifierSettings.DerivePathInfo(Expectations.Initialize); + VerifierSettings.ModifySerialization(_ => _.IgnoreMembersWithType()); + DiffRunner.Disabled = true; + } + } +}