BililiveRecorder/BililiveRecorder.Core/Config/V2/ConfigV2.cs

52 lines
1.3 KiB
C#
Raw Normal View History

2021-12-19 20:58:32 +08:00
using System;
2021-01-01 14:46:27 +08:00
using System.Collections.Generic;
using Newtonsoft.Json;
#nullable enable
namespace BililiveRecorder.Core.Config.V2
{
2021-12-19 20:58:32 +08:00
[Obsolete("Use Config v3")]
internal class ConfigV2 : ConfigBase
2021-01-01 14:46:27 +08:00
{
public override int Version => 2;
[JsonProperty("global")]
public GlobalConfig Global { get; set; } = new GlobalConfig();
[JsonProperty("rooms")]
public List<RoomConfig> Rooms { get; set; } = new List<RoomConfig>();
2021-01-04 16:24:36 +08:00
[JsonIgnore]
public bool DisableConfigSave { get; set; } = false; // for CLI
2021-01-01 14:46:27 +08:00
}
2021-12-19 20:58:32 +08:00
[Obsolete("Use Config v3")]
internal partial class RoomConfig
2021-01-01 14:46:27 +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>();
}
2021-12-19 20:58:32 +08:00
[Obsolete("Use Config v3")]
internal partial class GlobalConfig
2021-01-01 14:46:27 +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);
}
}
}