BililiveRecorder/BililiveRecorder.Core/Config/V3/ConfigV3.cs

53 lines
1.4 KiB
C#
Raw Normal View History

2021-12-19 20:58:32 +08:00
using System.Collections.Generic;
using Newtonsoft.Json;
#nullable enable
namespace BililiveRecorder.Core.Config.V3
{
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>();
// for CLI
2021-12-19 20:58:32 +08:00
[JsonIgnore]
public bool DisableConfigSave { get; set; } = false;
// for CLI
[JsonIgnore]
public string? ConfigPathOverride { get; set; }
2021-12-19 20:58:32 +08:00
}
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);
}
}
}