Switch to config v3

This commit is contained in:
genteure 2021-12-19 21:10:34 +08:00
parent 8a65c9645d
commit 441343e92e
20 changed files with 57 additions and 55 deletions

View File

@ -5,6 +5,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using BililiveRecorder.Core.Config;
using BililiveRecorder.Core.Config.V3; using BililiveRecorder.Core.Config.V3;
namespace BililiveRecorder.Cli.Configure namespace BililiveRecorder.Cli.Configure

View File

@ -7,7 +7,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using BililiveRecorder.Core.Config; using BililiveRecorder.Core.Config;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using Spectre.Console; using Spectre.Console;
namespace BililiveRecorder.Cli.Configure namespace BililiveRecorder.Cli.Configure
@ -30,7 +30,7 @@ namespace BililiveRecorder.Cli.Configure
return 0; return 0;
} }
private static void ShowRootMenu(ConfigV2 config, string fullPath) private static void ShowRootMenu(ConfigV3 config, string fullPath)
{ {
while (true) while (true)
{ {
@ -69,7 +69,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static void SetRoomConfig(ConfigV2 config) private static void SetRoomConfig(ConfigV3 config)
{ {
if (config.Rooms.Count < 1) if (config.Rooms.Count < 1)
{ {
@ -112,7 +112,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static void SetGlobalConfig(ConfigV2 config) private static void SetGlobalConfig(ConfigV3 config)
{ {
while (true) while (true)
{ {
@ -136,7 +136,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static void ListRooms(ConfigV2 config) private static void ListRooms(ConfigV3 config)
{ {
var table = new Table() var table = new Table()
.AddColumns("Roomid", "AutoRecord") .AddColumns("Roomid", "AutoRecord")
@ -150,7 +150,7 @@ namespace BililiveRecorder.Cli.Configure
AnsiConsole.Render(table); AnsiConsole.Render(table);
} }
private static void AddRoom(ConfigV2 config) private static void AddRoom(ConfigV3 config)
{ {
while (true) while (true)
{ {
@ -177,7 +177,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static void DeleteRoom(ConfigV2 config) private static void DeleteRoom(ConfigV3 config)
{ {
var toBeDeleted = AnsiConsole.Prompt(new MultiSelectionPrompt<RoomConfig>() var toBeDeleted = AnsiConsole.Prompt(new MultiSelectionPrompt<RoomConfig>()
.Title("Delete rooms") .Title("Delete rooms")
@ -194,7 +194,7 @@ namespace BililiveRecorder.Cli.Configure
AnsiConsole.MarkupLine("[green]{0} rooms deleted[/]", toBeDeleted.Count); AnsiConsole.MarkupLine("[green]{0} rooms deleted[/]", toBeDeleted.Count);
} }
private static void SetJsonSchema(ConfigV2 config) private static void SetJsonSchema(ConfigV3 config)
{ {
var selection = PromptEnumSelection<JsonSchemaSelection>(); var selection = PromptEnumSelection<JsonSchemaSelection>();
switch (selection) switch (selection)
@ -210,7 +210,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static bool SaveConfig(ConfigV2 config, string fullPath) private static bool SaveConfig(ConfigV3 config, string fullPath)
{ {
try try
{ {
@ -227,7 +227,7 @@ namespace BililiveRecorder.Cli.Configure
} }
} }
private static bool FindConfig(string path, [NotNullWhen(true)] out ConfigV2? config, out string fullPath) private static bool FindConfig(string path, [NotNullWhen(true)] out ConfigV3? config, out string fullPath)
{ {
if (Directory.Exists(path)) if (Directory.Exists(path))
{ {
@ -241,7 +241,7 @@ namespace BililiveRecorder.Cli.Configure
if (File.Exists(fullPath)) if (File.Exists(fullPath))
config = ConfigParser.LoadJson(File.ReadAllText(fullPath, Encoding.UTF8)); config = ConfigParser.LoadJson(File.ReadAllText(fullPath, Encoding.UTF8));
else else
config = new ConfigV2(); config = new ConfigV3();
var result = config != null; var result = config != null;
if (!result) if (!result)

View File

@ -9,7 +9,7 @@ using BililiveRecorder.Cli.Configure;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core; using BililiveRecorder.Core;
using BililiveRecorder.Core.Config; using BililiveRecorder.Core.Config;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.DependencyInjection; using BililiveRecorder.DependencyInjection;
using BililiveRecorder.ToolBox; using BililiveRecorder.ToolBox;
using BililiveRecorder.Web; using BililiveRecorder.Web;
@ -44,7 +44,7 @@ namespace BililiveRecorder.Cli
new Option<LogEventLevel>(new []{ "--logfilelevel", "--flog" }, () => LogEventLevel.Debug, "Minimal log level output to file"), new Option<LogEventLevel>(new []{ "--logfilelevel", "--flog" }, () => LogEventLevel.Debug, "Minimal log level output to file"),
new Option<RecordMode>(new []{ "--record-mode", "--mode" }, () => RecordMode.Standard, "Recording mode"), new Option<RecordMode>(new []{ "--record-mode", "--mode" }, () => RecordMode.Standard, "Recording mode"),
new Option<string>(new []{ "--cookie", "-c" }, "Cookie string for api requests"), new Option<string>(new []{ "--cookie", "-c" }, "Cookie string for api requests"),
new Option<string>(new []{ "--filename-format", "-f" }, "File name format"), new Option<string>(new []{ "--filename", "-f" }, "File name format"),
new Option<PortableModeArguments.PortableDanmakuMode>(new []{ "--danmaku", "-d" }, "Flags for danmaku recording"), new Option<PortableModeArguments.PortableDanmakuMode>(new []{ "--danmaku", "-d" }, "Flags for danmaku recording"),
new Option<string>("--webhook-url", "URL of webhoook"), new Option<string>("--webhook-url", "URL of webhoook"),
new Option<string>("--live-api-host"), new Option<string>("--live-api-host"),
@ -149,7 +149,7 @@ namespace BililiveRecorder.Cli
using var logger = BuildLogger(opts.LogLevel, opts.LogFileLevel); using var logger = BuildLogger(opts.LogLevel, opts.LogFileLevel);
Log.Logger = logger; Log.Logger = logger;
var config = new ConfigV2() var config = new ConfigV3()
{ {
DisableConfigSave = true, DisableConfigSave = true,
}; };
@ -163,8 +163,8 @@ namespace BililiveRecorder.Cli
if (!string.IsNullOrWhiteSpace(opts.LiveApiHost)) if (!string.IsNullOrWhiteSpace(opts.LiveApiHost))
global.LiveApiHost = opts.LiveApiHost; global.LiveApiHost = opts.LiveApiHost;
if (!string.IsNullOrWhiteSpace(opts.FilenameFormat)) if (!string.IsNullOrWhiteSpace(opts.Filename))
global.RecordFilenameFormat = opts.FilenameFormat; global.FileNameRecordTemplate = opts.Filename;
if (!string.IsNullOrWhiteSpace(opts.WebhookUrl)) if (!string.IsNullOrWhiteSpace(opts.WebhookUrl))
global.WebHookUrlsV2 = opts.WebhookUrl; global.WebHookUrlsV2 = opts.WebhookUrl;
@ -203,7 +203,7 @@ namespace BililiveRecorder.Cli
return 0; return 0;
} }
private static IServiceProvider BuildServiceProvider(ConfigV2 config, ILogger logger) => new ServiceCollection() private static IServiceProvider BuildServiceProvider(ConfigV3 config, ILogger logger) => new ServiceCollection()
.AddSingleton(logger) .AddSingleton(logger)
.AddFlv() .AddFlv()
.AddRecorderConfig(config) .AddRecorderConfig(config)
@ -254,7 +254,7 @@ namespace BililiveRecorder.Cli
public string? LiveApiHost { get; set; } public string? LiveApiHost { get; set; }
public string? FilenameFormat { get; set; } public string? Filename { get; set; }
public string? WebhookUrl { get; set; } public string? WebhookUrl { get; set; }

View File

@ -5,7 +5,7 @@ using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Api.Model; using BililiveRecorder.Core.Api.Model;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace BililiveRecorder.Core.Api.Http namespace BililiveRecorder.Core.Api.Http
@ -23,7 +23,7 @@ namespace BililiveRecorder.Core.Api.Http
private HttpClient mainClient; private HttpClient mainClient;
private bool disposedValue; private bool disposedValue;
public HttpClient MainHttpClient => mainClient; public HttpClient MainHttpClient => this.mainClient;
public HttpApiClient(GlobalConfig config) public HttpApiClient(GlobalConfig config)
{ {

View File

@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
using BililiveRecorder.Core.Api.Danmaku; using BililiveRecorder.Core.Api.Danmaku;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using Serilog; using Serilog;
#nullable enable #nullable enable

View File

@ -2,7 +2,7 @@ using BililiveRecorder.Core;
using BililiveRecorder.Core.Api; using BililiveRecorder.Core.Api;
using BililiveRecorder.Core.Api.Danmaku; using BililiveRecorder.Core.Api.Danmaku;
using BililiveRecorder.Core.Api.Http; using BililiveRecorder.Core.Api.Http;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Danmaku; using BililiveRecorder.Core.Danmaku;
using BililiveRecorder.Core.Recording; using BililiveRecorder.Core.Recording;
using BililiveRecorder.Flv; using BililiveRecorder.Flv;
@ -13,9 +13,9 @@ namespace BililiveRecorder.DependencyInjection
{ {
public static class DependencyInjectionExtensions public static class DependencyInjectionExtensions
{ {
public static IServiceCollection AddRecorderConfig(this IServiceCollection services, ConfigV2 config) => services public static IServiceCollection AddRecorderConfig(this IServiceCollection services, ConfigV3 config) => services
.AddSingleton(config) .AddSingleton(config)
.AddSingleton(sp => sp.GetRequiredService<ConfigV2>().Global) .AddSingleton(sp => sp.GetRequiredService<ConfigV3>().Global)
; ;
public static IServiceCollection AddRecorder(this IServiceCollection services) => services public static IServiceCollection AddRecorder(this IServiceCollection services) => services

View File

@ -1,14 +1,14 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Event; using BililiveRecorder.Core.Event;
namespace BililiveRecorder.Core namespace BililiveRecorder.Core
{ {
public interface IRecorder : INotifyPropertyChanged, IDisposable public interface IRecorder : INotifyPropertyChanged, IDisposable
{ {
ConfigV2 Config { get; } ConfigV3 Config { get; }
ReadOnlyObservableCollection<IRoom> Rooms { get; } ReadOnlyObservableCollection<IRoom> Rooms { get; }
event EventHandler<AggregatedRoomEventArgs<RecordSessionStartedEventArgs>>? RecordSessionStarted; event EventHandler<AggregatedRoomEventArgs<RecordSessionStartedEventArgs>>? RecordSessionStarted;

View File

@ -1,7 +1,7 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Event; using BililiveRecorder.Core.Event;
namespace BililiveRecorder.Core namespace BililiveRecorder.Core

View File

@ -1,4 +1,4 @@
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
namespace BililiveRecorder.Core namespace BililiveRecorder.Core
{ {

View File

@ -4,7 +4,7 @@ using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Config; using BililiveRecorder.Core.Config;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Event; using BililiveRecorder.Core.Event;
using BililiveRecorder.Core.SimpleWebhook; using BililiveRecorder.Core.SimpleWebhook;
using Serilog; using Serilog;
@ -22,7 +22,7 @@ namespace BililiveRecorder.Core
private bool disposedValue; private bool disposedValue;
public Recorder(IRoomFactory roomFactory, ConfigV2 config, ILogger logger) public Recorder(IRoomFactory roomFactory, ConfigV3 config, ILogger logger)
{ {
this.roomFactory = roomFactory ?? throw new ArgumentNullException(nameof(roomFactory)); this.roomFactory = roomFactory ?? throw new ArgumentNullException(nameof(roomFactory));
this.Config = config ?? throw new ArgumentNullException(nameof(config)); this.Config = config ?? throw new ArgumentNullException(nameof(config));
@ -54,7 +54,7 @@ namespace BililiveRecorder.Core
public event EventHandler<AggregatedRoomEventArgs<RecordingStatsEventArgs>>? RecordingStats; public event EventHandler<AggregatedRoomEventArgs<RecordingStatsEventArgs>>? RecordingStats;
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
public ConfigV2 Config { get; } public ConfigV3 Config { get; }
public ReadOnlyObservableCollection<IRoom> Rooms { get; } public ReadOnlyObservableCollection<IRoom> Rooms { get; }

View File

@ -156,7 +156,7 @@ namespace BililiveRecorder.Core.Recording
protected (string fullPath, string relativePath) CreateFileName() protected (string fullPath, string relativePath) CreateFileName()
{ {
var formatString = this.room.RoomConfig.RecordFilenameFormat!; var formatString = this.room.RoomConfig.FileNameRecordTemplate!; // TODO
var now = DateTime.Now; var now = DateTime.Now;
var date = now.ToString("yyyyMMdd"); var date = now.ToString("yyyyMMdd");

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Api; using BililiveRecorder.Core.Api;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Danmaku; using BililiveRecorder.Core.Danmaku;
using BililiveRecorder.Core.Event; using BililiveRecorder.Core.Event;
using BililiveRecorder.Core.Recording; using BililiveRecorder.Core.Recording;

View File

@ -1,5 +1,5 @@
using System; using System;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace BililiveRecorder.Core namespace BililiveRecorder.Core

View File

@ -3,7 +3,7 @@ using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
@ -14,7 +14,7 @@ namespace BililiveRecorder.Core.SimpleWebhook
private static readonly ILogger logger = Log.ForContext<BasicWebhookV1>(); private static readonly ILogger logger = Log.ForContext<BasicWebhookV1>();
private static readonly HttpClient client; private static readonly HttpClient client;
private readonly ConfigV2 Config; private readonly ConfigV3 Config;
static BasicWebhookV1() static BasicWebhookV1()
{ {
@ -22,7 +22,7 @@ namespace BililiveRecorder.Core.SimpleWebhook
client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{GitVersionInformation.FullSemVer}"); client.DefaultRequestHeaders.Add("User-Agent", $"BililiveRecorder/{GitVersionInformation.FullSemVer}");
} }
public BasicWebhookV1(ConfigV2 config) public BasicWebhookV1(ConfigV3 config)
{ {
this.Config = config ?? throw new ArgumentNullException(nameof(config)); this.Config = config ?? throw new ArgumentNullException(nameof(config));
} }

View File

@ -3,7 +3,7 @@ using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using BililiveRecorder.Core.Config.V2; using BililiveRecorder.Core.Config.V3;
using BililiveRecorder.Core.Event; using BililiveRecorder.Core.Event;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;

View File

@ -10,7 +10,7 @@
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF" l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings" l:ResxLocalizationProvider.DefaultDictionary="Strings"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls" xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:confiv2="clr-namespace:BililiveRecorder.Core.Config.V2;assembly=BililiveRecorder.Core" xmlns:config="clr-namespace:BililiveRecorder.Core.Config;assembly=BililiveRecorder.Core"
xmlns:core="clr-namespace:BililiveRecorder.Core;assembly=BililiveRecorder.Core" xmlns:core="clr-namespace:BililiveRecorder.Core;assembly=BililiveRecorder.Core"
d:DataContext="{d:DesignInstance core:Room}" d:DataContext="{d:DesignInstance core:Room}"
DefaultButton="Close" DefaultButton="Close"
@ -53,10 +53,10 @@
<StackPanel> <StackPanel>
<RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_Standard}" <RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_Standard}"
IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:RecordMode.Standard}}" /> ConverterParameter={x:Static config:RecordMode.Standard}}" />
<RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_RawData}" <RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_RawData}"
IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:RecordMode.RawData}}" /> ConverterParameter={x:Static config:RecordMode.RawData}}" />
</StackPanel> </StackPanel>
</local:SettingWithDefault> </local:SettingWithDefault>
</StackPanel> </StackPanel>
@ -67,13 +67,13 @@
<StackPanel> <StackPanel>
<RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_Disabled}" <RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_Disabled}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.Disabled}}" /> ConverterParameter={x:Static config:CuttingMode.Disabled}}" />
<RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_BySize}" <RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_BySize}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.BySize}}" /> ConverterParameter={x:Static config:CuttingMode.BySize}}" />
<RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_ByTime}" <RadioButton GroupName="Splitting" Content="{l:Loc Settings_Splitting_RadioButton_ByTime}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.ByTime}}" /> ConverterParameter={x:Static config:CuttingMode.ByTime}}" />
</StackPanel> </StackPanel>
</local:SettingWithDefault> </local:SettingWithDefault>
<local:SettingWithDefault IsSettingNotUsingDefault="{Binding HasCuttingNumber}"> <local:SettingWithDefault IsSettingNotUsingDefault="{Binding HasCuttingNumber}">

View File

@ -11,7 +11,7 @@
l:ResxLocalizationProvider.DefaultDictionary="Strings" l:ResxLocalizationProvider.DefaultDictionary="Strings"
xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls" xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages" xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:config="clr-namespace:BililiveRecorder.Core.Config.V2;assembly=BililiveRecorder.Core" xmlns:configv3="clr-namespace:BililiveRecorder.Core.Config.V3;assembly=BililiveRecorder.Core"
xmlns:model="clr-namespace:BililiveRecorder.WPF.Models" xmlns:model="clr-namespace:BililiveRecorder.WPF.Models"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="1500" d:DesignWidth="500" d:DesignHeight="1500" d:DesignWidth="500"
@ -31,7 +31,7 @@
<Setter Property="SpinButtonPlacementMode" Value="Inline"/> <Setter Property="SpinButtonPlacementMode" Value="Inline"/>
</Style> </Style>
</ui:Page.Resources> </ui:Page.Resources>
<ScrollViewer d:DataContext="{d:DesignInstance Type=config:GlobalConfig}"> <ScrollViewer d:DataContext="{d:DesignInstance Type=configv3:GlobalConfig}">
<ui:SimpleStackPanel Orientation="Vertical" Spacing="5" Margin="20"> <ui:SimpleStackPanel Orientation="Vertical" Spacing="5" Margin="20">
<TextBlock Text="{l:Loc Settings_AdvancedPage_Title}" Style="{StaticResource TitleTextBlockStyle}" FontFamily="Microsoft YaHei" Margin="0,10"/> <TextBlock Text="{l:Loc Settings_AdvancedPage_Title}" Style="{StaticResource TitleTextBlockStyle}" FontFamily="Microsoft YaHei" Margin="0,10"/>
<TextBlock Text="{l:Loc Settings_AdvancedPage_Warning}"/> <TextBlock Text="{l:Loc Settings_AdvancedPage_Warning}"/>

View File

@ -278,7 +278,7 @@ You can uninstall me in system settings.", "安装成功 Installed", MessageBoxB
} }
} }
private ServiceProvider BuildServiceProvider(Core.Config.V2.ConfigV2 config, ILogger logger) => new ServiceCollection() private ServiceProvider BuildServiceProvider(Core.Config.V3.ConfigV3 config, ILogger logger) => new ServiceCollection()
.AddSingleton(logger) .AddSingleton(logger)
.AddRecorderConfig(config) .AddRecorderConfig(config)
.AddFlv() .AddFlv()

View File

@ -12,8 +12,8 @@
xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls" xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:m="clr-namespace:BililiveRecorder.WPF.Models" xmlns:m="clr-namespace:BililiveRecorder.WPF.Models"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages" xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:config="clr-namespace:BililiveRecorder.Core.Config.V2;assembly=BililiveRecorder.Core" xmlns:config="clr-namespace:BililiveRecorder.Core.Config;assembly=BililiveRecorder.Core"
xmlns:confiv2="clr-namespace:BililiveRecorder.Core.Config.V2;assembly=BililiveRecorder.Core" xmlns:configv3="clr-namespace:BililiveRecorder.Core.Config.V3;assembly=BililiveRecorder.Core"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="1500" d:DesignWidth="500" d:DesignHeight="1500" d:DesignWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Recorder.Config.Global}" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Recorder.Config.Global}"
@ -24,7 +24,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
</Style> </Style>
</ui:Page.Resources> </ui:Page.Resources>
<ScrollViewer d:DataContext="{d:DesignInstance Type=config:GlobalConfig}"> <ScrollViewer d:DataContext="{d:DesignInstance Type=configv3:GlobalConfig}">
<ui:SimpleStackPanel Orientation="Vertical" Spacing="5" Margin="20"> <ui:SimpleStackPanel Orientation="Vertical" Spacing="5" Margin="20">
<TextBlock Text="{l:Loc Settings_SettingsPage_Title}" Style="{StaticResource TitleTextBlockStyle}" FontFamily="Microsoft Yahei" Margin="0,10"/> <TextBlock Text="{l:Loc Settings_SettingsPage_Title}" Style="{StaticResource TitleTextBlockStyle}" FontFamily="Microsoft Yahei" Margin="0,10"/>
<GroupBox Header="{l:Loc Settings_Danmaku_Title}"> <GroupBox Header="{l:Loc Settings_Danmaku_Title}">
@ -46,23 +46,23 @@
<StackPanel> <StackPanel>
<RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_Standard}" <RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_Standard}"
IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:RecordMode.Standard}}" /> ConverterParameter={x:Static config:RecordMode.Standard}}" />
<RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_RawData}" <RadioButton GroupName="RecordMode" Content="{l:Loc Settings_RecordMode_RadioButton_RawData}"
IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=RecordMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:RecordMode.RawData}}" /> ConverterParameter={x:Static config:RecordMode.RawData}}" />
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<GroupBox Header="{l:Loc Settings_Splitting_Title}"> <GroupBox Header="{l:Loc Settings_Splitting_Title}">
<StackPanel> <StackPanel>
<RadioButton GroupName="Splitting" Name="CutDisabledRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_Disabled}" <RadioButton GroupName="Splitting" Name="CutDisabledRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_Disabled}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.Disabled}}" /> ConverterParameter={x:Static config:CuttingMode.Disabled}}" />
<RadioButton GroupName="Splitting" Name="CutBySizeRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_BySize}" <RadioButton GroupName="Splitting" Name="CutBySizeRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_BySize}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.BySize}}" /> ConverterParameter={x:Static config:CuttingMode.BySize}}" />
<RadioButton GroupName="Splitting" Name="CutByTimeRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_ByTime}" <RadioButton GroupName="Splitting" Name="CutByTimeRadioButton" Content="{l:Loc Settings_Splitting_RadioButton_ByTime}"
IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter}, IsChecked="{Binding Path=CuttingMode, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static confiv2:CuttingMode.ByTime}}" /> ConverterParameter={x:Static config:CuttingMode.ByTime}}" />
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" <StackPanel Orientation="Horizontal" Margin="0,5,0,0"
Visibility="{Binding ElementName=CutDisabledRadioButton,Path=IsChecked,Converter={StaticResource InvertBooleanToVisibilityCollapsedConverter}}"> Visibility="{Binding ElementName=CutDisabledRadioButton,Path=IsChecked,Converter={StaticResource InvertBooleanToVisibilityCollapsedConverter}}">

View File

@ -4,6 +4,7 @@ import { trimEnd } from "../utils";
export default function (data: ConfigEntry[]): string { export default function (data: ConfigEntry[]): string {
let result = `using System.Collections.Generic; let result = `using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using BililiveRecorder.Core.Config;
using BililiveRecorder.Core.Config.V3; using BililiveRecorder.Core.Config.V3;
namespace BililiveRecorder.Cli.Configure namespace BililiveRecorder.Cli.Configure