2021-12-19 20:58:32 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
#nullable enable
|
|
|
|
namespace BililiveRecorder.Core.Config.V3
|
|
|
|
{
|
2022-05-16 23:28:31 +08:00
|
|
|
public sealed class ConfigV3 : ConfigBase
|
2021-12-19 20:58:32 +08:00
|
|
|
{
|
|
|
|
public override int Version => 3;
|
|
|
|
|
|
|
|
[JsonProperty("global")]
|
|
|
|
public GlobalConfig Global { get; set; } = new GlobalConfig();
|
|
|
|
|
|
|
|
[JsonProperty("rooms")]
|
|
|
|
public List<RoomConfig> Rooms { get; set; } = new List<RoomConfig>();
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
public bool DisableConfigSave { get; set; } = false; // for CLI
|
|
|
|
}
|
|
|
|
|
2022-06-28 16:10:06 +08:00
|
|
|
public partial class RoomConfig : IFileNameConfig
|
2021-12-19 20:58:32 +08:00
|
|
|
{
|
|
|
|
public RoomConfig() : base(x => x.AutoMap(p => new[] { "Has" + p.Name }))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
internal void SetParent(GlobalConfig? config) => this.Parent = config;
|
|
|
|
|
|
|
|
public string? WorkDirectory => this.GetPropertyValue<string>();
|
|
|
|
}
|
|
|
|
|
2022-06-28 16:10:06 +08:00
|
|
|
public partial class GlobalConfig : IFileNameConfig
|
2021-12-19 20:58:32 +08:00
|
|
|
{
|
|
|
|
public GlobalConfig() : base(x => x.AutoMap(p => new[] { "Has" + p.Name }))
|
|
|
|
{
|
|
|
|
this.Parent = DefaultConfig.Instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 当前工作目录
|
|
|
|
/// </summary>
|
|
|
|
public string? WorkDirectory
|
|
|
|
{
|
|
|
|
get => this.GetPropertyValue<string>();
|
|
|
|
set => this.SetPropertyValue(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|