BililiveRecorder/test/BililiveRecorder.Core.UnitTests/Expectations/PublicApi.HasNoChangesAsync.verified.txt
进栈检票 adc91cc4f3
feat(core): connect to danmaku server with buvid3 from cookie & refactor HttpApiClient (#507)
* feat(core): connect to danmaku server with buvid3

* make buvid3 nullable & add json serializer setting

* fix test

* fix regex & make regex static

* remove anonHttpClient

* remove MainHttpClient

* split FetchAsTextAsync

* GetAnonymousCookieAsync

* use template string in TestCookieAsync

* fix test

* background get anonymous cookie

* make jsonSerializerSettings static

* fix uid parse logic

* fix buvid match

* remove GetAnonCookie

* restore merge typo

* fix comment

* rename ICookieTester
2023-07-16 08:01:50 +00:00

578 lines
31 KiB
Plaintext

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("BililiveRecorder.Core.UnitTests")]
namespace BililiveRecorder.Core.Api
{
public interface ICookieTester
{
System.Threading.Tasks.Task<System.ValueTuple<bool, string>> TestCookieAsync();
}
}
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? LoadFromDirectory(string directory) { }
public static BililiveRecorder.Core.Config.V3.ConfigV3? LoadFromFile(string path) { }
public static BililiveRecorder.Core.Config.V3.ConfigV3? LoadJson(string json) { }
public static bool Save(BililiveRecorder.Core.Config.V3.ConfigV3 config) { }
public static string? SaveJson(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 DanmakuTransportMode
{
Random = 0,
Tcp = 1,
Ws = 2,
Wss = 3,
}
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 string? ConfigPathOverride { get; set; }
[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<BililiveRecorder.Core.Config.V3.RoomConfig> 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 bool DanmakuAuthenticateWithStreamerUid { get; }
public BililiveRecorder.Core.Config.DanmakuTransportMode DanmakuTransport { get; }
public string FileNameRecordTemplate { get; }
public bool FlvProcessorSplitOnScriptTag { get; }
public bool FlvWriteMetadata { 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 bool SaveStreamCover { get; }
public uint TimingApiTimeout { 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 WpfNotifyStreamStart { get; }
public bool WpfShowTitleAndArea { get; }
}
[Newtonsoft.Json.JsonObject(Newtonsoft.Json.MemberSerialization.OptIn)]
public sealed class GlobalConfig : HierarchicalPropertyDefault.HierarchicalObject<BililiveRecorder.Core.Config.V3.DefaultConfig, BililiveRecorder.Core.Config.V3.GlobalConfig>, BililiveRecorder.Core.Config.V3.IFileNameConfig
{
public GlobalConfig() { }
public string? Cookie { get; set; }
public BililiveRecorder.Core.Config.CuttingMode CuttingMode { get; set; }
public uint CuttingNumber { get; set; }
public bool DanmakuAuthenticateWithStreamerUid { get; set; }
public BililiveRecorder.Core.Config.DanmakuTransportMode DanmakuTransport { get; set; }
public string? FileNameRecordTemplate { get; set; }
public bool FlvProcessorSplitOnScriptTag { get; set; }
public bool FlvWriteMetadata { get; set; }
public bool HasCookie { get; set; }
public bool HasCuttingMode { get; set; }
public bool HasCuttingNumber { get; set; }
public bool HasDanmakuAuthenticateWithStreamerUid { get; set; }
public bool HasDanmakuTransport { get; set; }
public bool HasFileNameRecordTemplate { get; set; }
public bool HasFlvProcessorSplitOnScriptTag { get; set; }
public bool HasFlvWriteMetadata { 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 HasSaveStreamCover { get; set; }
public bool HasTimingApiTimeout { 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 HasWpfNotifyStreamStart { 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<string?> OptionalCookie { get; set; }
[Newtonsoft.Json.JsonProperty("CuttingMode")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.CuttingMode> OptionalCuttingMode { get; set; }
[Newtonsoft.Json.JsonProperty("CuttingNumber")]
public HierarchicalPropertyDefault.Optional<uint> OptionalCuttingNumber { get; set; }
[Newtonsoft.Json.JsonProperty("DanmakuAuthenticateWithStreamerUid")]
public HierarchicalPropertyDefault.Optional<bool> OptionalDanmakuAuthenticateWithStreamerUid { get; set; }
[Newtonsoft.Json.JsonProperty("DanmakuTransport")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.DanmakuTransportMode> OptionalDanmakuTransport { get; set; }
[Newtonsoft.Json.JsonProperty("FileNameRecordTemplate")]
public HierarchicalPropertyDefault.Optional<string?> OptionalFileNameRecordTemplate { get; set; }
[Newtonsoft.Json.JsonProperty("FlvProcessorSplitOnScriptTag")]
public HierarchicalPropertyDefault.Optional<bool> OptionalFlvProcessorSplitOnScriptTag { get; set; }
[Newtonsoft.Json.JsonProperty("FlvWriteMetadata")]
public HierarchicalPropertyDefault.Optional<bool> OptionalFlvWriteMetadata { get; set; }
[Newtonsoft.Json.JsonProperty("LiveApiHost")]
public HierarchicalPropertyDefault.Optional<string?> OptionalLiveApiHost { get; set; }
[Newtonsoft.Json.JsonProperty("NetworkTransportAllowedAddressFamily")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.AllowedAddressFamily> OptionalNetworkTransportAllowedAddressFamily { get; set; }
[Newtonsoft.Json.JsonProperty("NetworkTransportUseSystemProxy")]
public HierarchicalPropertyDefault.Optional<bool> OptionalNetworkTransportUseSystemProxy { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmaku")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmaku { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuFlushInterval")]
public HierarchicalPropertyDefault.Optional<uint> OptionalRecordDanmakuFlushInterval { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuGift")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuGift { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuGuard")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuGuard { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuRaw")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuRaw { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuSuperChat")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuSuperChat { get; set; }
[Newtonsoft.Json.JsonProperty("RecordMode")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.RecordMode> OptionalRecordMode { get; set; }
[Newtonsoft.Json.JsonProperty("RecordingQuality")]
public HierarchicalPropertyDefault.Optional<string?> OptionalRecordingQuality { get; set; }
[Newtonsoft.Json.JsonProperty("SaveStreamCover")]
public HierarchicalPropertyDefault.Optional<bool> OptionalSaveStreamCover { get; set; }
[Newtonsoft.Json.JsonProperty("TimingApiTimeout")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingApiTimeout { get; set; }
[Newtonsoft.Json.JsonProperty("TimingCheckInterval")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingCheckInterval { get; set; }
[Newtonsoft.Json.JsonProperty("TimingDanmakuRetry")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingDanmakuRetry { get; set; }
[Newtonsoft.Json.JsonProperty("TimingStreamConnect")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingStreamConnect { get; set; }
[Newtonsoft.Json.JsonProperty("TimingStreamRetry")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingStreamRetry { get; set; }
[Newtonsoft.Json.JsonProperty("TimingStreamRetryNoQn")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingStreamRetryNoQn { get; set; }
[Newtonsoft.Json.JsonProperty("TimingWatchdogTimeout")]
public HierarchicalPropertyDefault.Optional<uint> OptionalTimingWatchdogTimeout { get; set; }
[Newtonsoft.Json.JsonProperty("UserScript")]
public HierarchicalPropertyDefault.Optional<string?> OptionalUserScript { get; set; }
[Newtonsoft.Json.JsonProperty("WebHookUrls")]
public HierarchicalPropertyDefault.Optional<string?> OptionalWebHookUrls { get; set; }
[Newtonsoft.Json.JsonProperty("WebHookUrlsV2")]
public HierarchicalPropertyDefault.Optional<string?> OptionalWebHookUrlsV2 { get; set; }
[Newtonsoft.Json.JsonProperty("WpfNotifyStreamStart")]
public HierarchicalPropertyDefault.Optional<bool> OptionalWpfNotifyStreamStart { get; set; }
[Newtonsoft.Json.JsonProperty("WpfShowTitleAndArea")]
public HierarchicalPropertyDefault.Optional<bool> 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 bool SaveStreamCover { get; set; }
public uint TimingApiTimeout { 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 WpfNotifyStreamStart { get; set; }
public bool WpfShowTitleAndArea { get; set; }
}
public interface IFileNameConfig
{
string? FileNameRecordTemplate { get; }
string? WorkDirectory { get; }
}
[Newtonsoft.Json.JsonObject(Newtonsoft.Json.MemberSerialization.OptIn)]
public sealed class RoomConfig : HierarchicalPropertyDefault.HierarchicalObject<BililiveRecorder.Core.Config.V3.GlobalConfig, BililiveRecorder.Core.Config.V3.RoomConfig>, BililiveRecorder.Core.Config.V3.IFileNameConfig
{
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 bool DanmakuAuthenticateWithStreamerUid { get; }
public BililiveRecorder.Core.Config.DanmakuTransportMode DanmakuTransport { get; }
public string? FileNameRecordTemplate { get; }
public bool FlvProcessorSplitOnScriptTag { get; set; }
public bool FlvWriteMetadata { get; }
public bool HasAutoRecord { get; set; }
public bool HasCuttingMode { get; set; }
public bool HasCuttingNumber { get; set; }
public bool HasFlvProcessorSplitOnScriptTag { 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 bool HasSaveStreamCover { get; set; }
public string? LiveApiHost { get; }
public BililiveRecorder.Core.Config.AllowedAddressFamily NetworkTransportAllowedAddressFamily { get; }
public bool NetworkTransportUseSystemProxy { get; }
[Newtonsoft.Json.JsonProperty("AutoRecord")]
public HierarchicalPropertyDefault.Optional<bool> OptionalAutoRecord { get; set; }
[Newtonsoft.Json.JsonProperty("CuttingMode")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.CuttingMode> OptionalCuttingMode { get; set; }
[Newtonsoft.Json.JsonProperty("CuttingNumber")]
public HierarchicalPropertyDefault.Optional<uint> OptionalCuttingNumber { get; set; }
[Newtonsoft.Json.JsonProperty("FlvProcessorSplitOnScriptTag")]
public HierarchicalPropertyDefault.Optional<bool> OptionalFlvProcessorSplitOnScriptTag { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmaku")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmaku { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuGift")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuGift { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuGuard")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuGuard { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuRaw")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuRaw { get; set; }
[Newtonsoft.Json.JsonProperty("RecordDanmakuSuperChat")]
public HierarchicalPropertyDefault.Optional<bool> OptionalRecordDanmakuSuperChat { get; set; }
[Newtonsoft.Json.JsonProperty("RecordMode")]
public HierarchicalPropertyDefault.Optional<BililiveRecorder.Core.Config.RecordMode> OptionalRecordMode { get; set; }
[Newtonsoft.Json.JsonProperty("RecordingQuality")]
public HierarchicalPropertyDefault.Optional<string?> OptionalRecordingQuality { get; set; }
[Newtonsoft.Json.JsonProperty("RoomId")]
public HierarchicalPropertyDefault.Optional<int> OptionalRoomId { get; set; }
[Newtonsoft.Json.JsonProperty("SaveStreamCover")]
public HierarchicalPropertyDefault.Optional<bool> OptionalSaveStreamCover { 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 bool SaveStreamCover { get; set; }
public uint TimingApiTimeout { 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 string? WorkDirectory { get; }
public bool WpfNotifyStreamStart { get; }
public bool WpfShowTitleAndArea { get; }
}
}
namespace BililiveRecorder.Core.Event
{
public sealed class AggregatedRoomEventArgs<T>
{
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 string? StreamHost { get; set; }
}
public interface IRecordSessionEventArgs
{
System.Guid SessionId { get; }
}
public abstract class RecordEventArgsBase : System.EventArgs
{
protected RecordEventArgsBase(BililiveRecorder.Core.IRoom room) { }
public string AreaNameChild { get; set; }
public string AreaNameParent { get; set; }
public bool DanmakuConnected { get; set; }
public string Name { get; set; }
public bool Recording { get; set; }
public int RoomId { get; set; }
public int ShortId { get; set; }
public bool Streaming { get; set; }
public string Title { get; set; }
}
public sealed class RecordFileClosedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase, BililiveRecorder.Core.Event.IRecordSessionEventArgs
{
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 System.Guid SessionId { get; set; }
}
public sealed class RecordFileOpeningEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase, BililiveRecorder.Core.Event.IRecordSessionEventArgs
{
public System.DateTimeOffset FileOpenTime { get; set; }
[Newtonsoft.Json.JsonIgnore]
public string FullPath { get; set; }
public string RelativePath { get; set; }
public System.Guid SessionId { get; set; }
}
public sealed class RecordSessionEndedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase, BililiveRecorder.Core.Event.IRecordSessionEventArgs
{
public System.Guid SessionId { get; set; }
}
public sealed class RecordSessionStartedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase, BililiveRecorder.Core.Event.IRecordSessionEventArgs
{
public System.Guid SessionId { get; set; }
}
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; }
}
public sealed class StreamEndedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase { }
public sealed class StreamStartedEventArgs : BililiveRecorder.Core.Event.RecordEventArgsBase { }
}
namespace BililiveRecorder.Core
{
public interface IRecorder : System.ComponentModel.INotifyPropertyChanged, System.IDisposable
{
BililiveRecorder.Core.Config.V3.ConfigV3 Config { get; }
System.Collections.ObjectModel.ReadOnlyObservableCollection<BililiveRecorder.Core.IRoom> Rooms { get; }
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.IOStatsEventArgs>>? IOStats;
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.RecordFileClosedEventArgs>>? RecordFileClosed;
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.RecordFileOpeningEventArgs>>? RecordFileOpening;
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.RecordSessionEndedEventArgs>>? RecordSessionEnded;
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.RecordSessionStartedEventArgs>>? RecordSessionStarted;
event System.EventHandler<BililiveRecorder.Core.Event.AggregatedRoomEventArgs<BililiveRecorder.Core.Event.RecordingStatsEventArgs>>? RecordingStats;
event System.EventHandler<BililiveRecorder.Core.IRoom> StreamStarted;
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; }
long Uid { get; }
event System.EventHandler<BililiveRecorder.Core.Event.IOStatsEventArgs>? IOStats;
event System.EventHandler<BililiveRecorder.Core.Event.RecordFileClosedEventArgs>? RecordFileClosed;
event System.EventHandler<BililiveRecorder.Core.Event.RecordFileOpeningEventArgs>? RecordFileOpening;
event System.EventHandler<BililiveRecorder.Core.Event.RecordSessionEndedEventArgs>? RecordSessionEnded;
event System.EventHandler<BililiveRecorder.Core.Event.RecordSessionStartedEventArgs>? RecordSessionStarted;
event System.EventHandler<BililiveRecorder.Core.Event.RecordingStatsEventArgs>? 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 PollyPolicy() { }
}
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 string? StreamHost { 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<T>(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 bool CallOnDanmaku(Serilog.ILogger logger, string json) { }
public string? CallOnDanmakuHandshake(Serilog.ILogger logger, BililiveRecorder.Core.IRoom room, string json) { }
public string? CallOnFetchStreamUrl(Serilog.ILogger logger, int roomid, int[] qnSetting) { }
public void CallOnTest(Serilog.ILogger logger, System.Action<string>? alert) { }
[return: System.Runtime.CompilerServices.TupleElementNames(new string[] {
"url",
"ip"})]
public System.ValueTuple<string, string?>? CallOnTransformStreamUrl(Serilog.ILogger logger, string originalUrl) { }
}
}
namespace BililiveRecorder.Core.Templating
{
public sealed class FileNameGenerator
{
public FileNameGenerator(BililiveRecorder.Core.Config.V3.IFileNameConfig config, Serilog.ILogger? logger) { }
public BililiveRecorder.Core.Templating.FileNameTemplateOutput CreateFilePath(BililiveRecorder.Core.Templating.FileNameTemplateContext data) { }
}
public class FileNameTemplateContext
{
public FileNameTemplateContext() { }
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 PartIndex { get; set; }
public int Qn { get; set; }
public int RoomId { get; set; }
public int ShortId { get; set; }
public string Title { get; set; }
public long Uid { get; set; }
}
public readonly struct FileNameTemplateOutput
{
public FileNameTemplateOutput(BililiveRecorder.Core.Templating.FileNameTemplateStatus status, string? errorMessage, string relativePath, string? fullPath) { }
public string? ErrorMessage { get; }
public string? FullPath { get; }
public string RelativePath { get; }
public BililiveRecorder.Core.Templating.FileNameTemplateStatus Status { get; }
}
public enum FileNameTemplateStatus
{
Success = 0,
TemplateError = 1,
OutOfRange = 2,
FileConflict = 3,
}
}
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) { }
}
}