BililiveRecorder/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml

186 lines
13 KiB
Plaintext
Raw Normal View History

2020-11-27 18:51:02 +08:00
<ui:Page
x:Class="BililiveRecorder.WPF.Pages.AdvancedSettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.modernwpf.com/2019"
2021-01-05 19:08:57 +08:00
xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
l:LocalizeDictionary.DesignCulture=""
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings"
2021-01-01 14:46:27 +08:00
xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls"
2020-11-27 18:51:02 +08:00
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:config="clr-namespace:BililiveRecorder.Core.Config;assembly=BililiveRecorder.Core"
2021-12-19 21:10:34 +08:00
xmlns:configv3="clr-namespace:BililiveRecorder.Core.Config.V3;assembly=BililiveRecorder.Core"
xmlns:model="clr-namespace:BililiveRecorder.WPF.Models"
2020-11-27 18:51:02 +08:00
mc:Ignorable="d"
d:DesignHeight="1500" d:DesignWidth="500"
2021-01-01 14:46:27 +08:00
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Recorder.Config.Global}"
2020-11-27 18:51:02 +08:00
Title="SettingsPage">
<ui:Page.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="14"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
2021-01-01 14:46:27 +08:00
<Style TargetType="c:SettingWithDefault">
2020-11-27 18:51:02 +08:00
<Setter Property="HorizontalAlignment" Value="Left"/>
2021-01-01 14:46:27 +08:00
</Style>
<Style TargetType="ui:NumberBox">
<Setter Property="Width" Value="220"/>
2020-11-27 18:51:02 +08:00
<Setter Property="ValidationMode" Value="InvalidInputOverwritten"/>
<Setter Property="SpinButtonPlacementMode" Value="Inline"/>
</Style>
</ui:Page.Resources>
2021-12-19 21:10:34 +08:00
<ScrollViewer d:DataContext="{d:DesignInstance Type=configv3:GlobalConfig}">
2020-11-27 18:51:02 +08:00
<ui:SimpleStackPanel Orientation="Vertical" Spacing="5" Margin="20">
2021-01-05 19:08:57 +08:00
<TextBlock Text="{l:Loc Settings_AdvancedPage_Title}" Style="{StaticResource TitleTextBlockStyle}" FontFamily="Microsoft YaHei" Margin="0,10"/>
<TextBlock Text="{l:Loc Settings_AdvancedPage_Warning}"/>
2020-11-27 18:51:02 +08:00
<GroupBox Header="Cookie">
2021-07-05 23:30:13 +08:00
<StackPanel Orientation="Vertical">
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasCookie}">
<TextBox Text="{Binding Cookie,UpdateSourceTrigger=PropertyChanged,Delay=1000}" Width="220" HorizontalAlignment="Left"/>
</c:SettingWithDefault>
<Button Content="Test" Click="TestCookie_Click"/>
</StackPanel>
2020-11-27 18:51:02 +08:00
</GroupBox>
2021-01-05 19:08:57 +08:00
<GroupBox Header="{l:Loc Settings_Danmaku_Title}">
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasRecordDanmakuFlushInterval}" Header="{l:Loc Settings_Danmaku_FlushInterval}">
<ui:NumberBox Minimum="0" SmallChange="1" Text="{Binding RecordDanmakuFlushInterval,UpdateSourceTrigger=PropertyChanged}"/>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault>
2020-12-17 19:32:48 +08:00
</GroupBox>
2022-05-11 19:07:21 +08:00
<GroupBox Header="Scripting">
<StackPanel>
<Button Click="TestScript_Click" Content="Test"/>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasUserScript}" Header="请自由发挥((">
<TextBox Text="{Binding UserScript, UpdateSourceTrigger=LostFocus}" AcceptsReturn="True" MinHeight="70" MaxHeight="130"/>
</c:SettingWithDefault>
</StackPanel>
</GroupBox>
<GroupBox Header="弹幕服务器">
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasDanmakuTransport}" Header="弹幕服务器传输协议">
<StackPanel>
<RadioButton GroupName="DanmakuTransport" Content="随机"
IsChecked="{Binding Path=DanmakuTransport, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:DanmakuTransportMode.Random}}" />
<RadioButton GroupName="DanmakuTransport" Content="TCP"
IsChecked="{Binding Path=DanmakuTransport, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:DanmakuTransportMode.Tcp}}" />
<RadioButton GroupName="DanmakuTransport" Content="WS"
IsChecked="{Binding Path=DanmakuTransport, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:DanmakuTransportMode.Ws}}" />
<RadioButton GroupName="DanmakuTransport" Content="WSS"
IsChecked="{Binding Path=DanmakuTransport, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:DanmakuTransportMode.Wss}}" />
</StackPanel>
</c:SettingWithDefault>
</GroupBox>
<GroupBox Header="Network">
<StackPanel>
<CheckBox IsChecked="{Binding Path=NetworkTransportUseSystemProxy}" Content="使用系统代理"/>
<TextBlock Margin="0,10" Text="允许使用的网络类型:"/>
<RadioButton GroupName="NetworkTransportAllowedAddressFamily" Content="系统 (禁用录播姬的 IP 随机选择)"
IsChecked="{Binding Path=NetworkTransportAllowedAddressFamily, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:AllowedAddressFamily.System}}" />
<RadioButton GroupName="NetworkTransportAllowedAddressFamily" Content="IPv4 和 IPv6"
IsChecked="{Binding Path=NetworkTransportAllowedAddressFamily, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:AllowedAddressFamily.Any}}" />
<RadioButton GroupName="NetworkTransportAllowedAddressFamily" Content="仅限 IPv4"
IsChecked="{Binding Path=NetworkTransportAllowedAddressFamily, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:AllowedAddressFamily.Ipv4}}" />
<RadioButton GroupName="NetworkTransportAllowedAddressFamily" Content="仅限 IPv6"
IsChecked="{Binding Path=NetworkTransportAllowedAddressFamily, Converter={StaticResource EnumToBooleanConverter},
ConverterParameter={x:Static config:AllowedAddressFamily.Ipv6}}" />
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasLiveApiHost}" Header="B站直播 API Host">
<TextBox ui:TextBoxHelper.IsDeleteButtonVisible="False" Text="{Binding LiveApiHost,UpdateSourceTrigger=LostFocus}"/>
</c:SettingWithDefault>
</StackPanel>
</GroupBox>
2020-11-27 18:51:02 +08:00
<GroupBox Header="Timing">
<ui:SimpleStackPanel Spacing="10">
2021-01-01 14:46:27 +08:00
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingStreamRetry}" Header="录制重试间隔">
<c:SettingWithDefault.ToolTip>
2020-11-27 18:51:02 +08:00
<TextBlock>录制断开后等待多长时间再尝试开始录制</TextBlock>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="1000" Description="单位: 毫秒" SmallChange="100" Text="{Binding TimingStreamRetry,Delay=500}"/>
</c:SettingWithDefault>
2021-11-20 14:34:35 +08:00
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingStreamRetryNoQn}" Header="录制重试间隔(无匹配画质)">
<c:SettingWithDefault.ToolTip>
<TextBlock>无匹配的画质后等待多长时间再尝试开始录制</TextBlock>
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="10" Description="单位: 秒" SmallChange="5" Text="{Binding TimingStreamRetryNoQn,Delay=500}"/>
</c:SettingWithDefault>
2021-01-01 14:46:27 +08:00
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingStreamConnect}" Header="录制连接超时">
<c:SettingWithDefault.ToolTip>
2020-11-27 18:51:02 +08:00
<TextBlock>
发出连接直播服务器的请求后等待多长时间<LineBreak/>
防止直播服务器长时间不返回数据导致卡住
</TextBlock>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="1000" Description="单位: 毫秒" SmallChange="100" Text="{Binding TimingStreamConnect,Delay=500}"/>
</c:SettingWithDefault>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingDanmakuRetry}" Header="弹幕重连间隔">
<c:SettingWithDefault.ToolTip>
2020-11-27 18:51:02 +08:00
<TextBlock>
弹幕服务器被断开后等待多长时间再尝试连接<LineBreak/>
监控开播的主要途径是通过弹幕服务器发送的信息
</TextBlock>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="1000" Description="单位: 毫秒" SmallChange="100" Text="{Binding TimingDanmakuRetry,Delay=500}"/>
</c:SettingWithDefault>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingWatchdogTimeout}" Header="接收数据超时">
<c:SettingWithDefault.ToolTip>
2020-11-27 18:51:02 +08:00
<TextBlock>
在一定时间没有收到直播服务器发送的数据后断开重连<LineBreak/>
用于防止因为玄学网络问题导致卡住
</TextBlock>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="1000" Description="单位: 毫秒" SmallChange="100" Text="{Binding TimingWatchdogTimeout,Delay=500}"/>
</c:SettingWithDefault>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingCheckInterval}" Header="开播检查间隔">
<c:SettingWithDefault.ToolTip>
2020-11-27 18:51:02 +08:00
<TextBlock>
此项影响的时间间隔是定时请求HTTP接口的间隔
主要目的是防止没有从弹幕服务器收到开播消息,
所以此项不需要设置太短。<LineBreak/>
时间间隔设置太短会被B站服务器屏蔽导致无法录制。
</TextBlock>
2021-01-01 14:46:27 +08:00
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="60" Description="单位: 秒" SmallChange="10" Text="{Binding TimingCheckInterval,Delay=500}"/>
</c:SettingWithDefault>
2020-11-27 18:51:02 +08:00
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="Reset Request Policies">
<GroupBox.DataContext>
<model:PollyPolicyModel/>
</GroupBox.DataContext>
<Button Content="Reset" Command="{Binding ResetAllPolicy}"/>
</GroupBox>
2021-05-18 22:36:37 +08:00
<GroupBox Header="手动崩溃 Test Crash">
<StackPanel>
<Button Content="Crash EVERTHING !!1">
<ui:FlyoutService.Flyout>
<ui:Flyout>
<StackPanel>
<TextBlock Text="Are you sure about that?" Margin="0,0,0,12" />
<Button Click="Crash_Click" Content="Yes" />
</StackPanel>
</ui:Flyout>
</ui:FlyoutService.Flyout>
</Button>
<Button Content="Throw in task">
<ui:FlyoutService.Flyout>
<ui:Flyout>
<StackPanel>
<TextBlock Text="Are you sure about that?" Margin="0,0,0,12" />
<Button Click="Throw_In_Task_Click" Content="Yes" />
</StackPanel>
</ui:Flyout>
</ui:FlyoutService.Flyout>
</Button>
</StackPanel>
</GroupBox>
2020-11-27 18:51:02 +08:00
</ui:SimpleStackPanel>
</ScrollViewer>
</ui:Page>