BililiveRecorder/BililiveRecorder.WPF/Pages/AdvancedSettingsPage.xaml
2023-11-02 13:43:08 +08:00

204 lines
15 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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"
xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
l:LocalizeDictionary.DesignCulture=""
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings"
xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:config="clr-namespace:BililiveRecorder.Core.Config;assembly=BililiveRecorder.Core"
xmlns:configv3="clr-namespace:BililiveRecorder.Core.Config.V3;assembly=BililiveRecorder.Core"
xmlns:model="clr-namespace:BililiveRecorder.WPF.Models"
mc:Ignorable="d"
d:DesignHeight="2500" d:DesignWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Recorder.Config.Global}"
Title="SettingsPage">
<ui:Page.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="14"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="c:SettingWithDefault">
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style TargetType="ui:NumberBox">
<Setter Property="Width" Value="220"/>
<Setter Property="ValidationMode" Value="InvalidInputOverwritten"/>
<Setter Property="SpinButtonPlacementMode" Value="Inline"/>
</Style>
</ui:Page.Resources>
<ScrollViewer d:DataContext="{d:DesignInstance Type=configv3:GlobalConfig}">
<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_Warning}"/>
<TextBlock TextWrapping="Wrap" Text="所有高级设置项目均不是录播姬的“正式功能”,它们的作用是便于 power users 在不修改录播姬源码重新编译的情况下深度调整录播姬的行为。请根据个人实际需求谨慎使用高级设置,不要随意修改。"/>
<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}"/>
</c:SettingWithDefault>
</GroupBox>
<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="弹幕服务器">
<ui:SimpleStackPanel>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasDanmakuAuthenticateWithStreamerUid}">
<ui:ToggleSwitch IsOn="{Binding DanmakuAuthenticateWithStreamerUid}" OnContent="连接弹幕服务器时使用主播 UID 认证" OffContent="连接弹幕服务器时使用主播 UID 认证"/>
</c:SettingWithDefault>
<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>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="录制">
<ui:SimpleStackPanel Spacing="10">
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasFlvWriteMetadata}">
<ui:ToggleSwitch IsOn="{Binding FlvWriteMetadata}" OnContent="在视频文件写入直播信息 metadata" OffContent="在视频文件写入直播信息 metadata"/>
</c:SettingWithDefault>
</ui:SimpleStackPanel>
</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="mikufans直播 API Host">
<TextBox ui:TextBoxHelper.IsDeleteButtonVisible="False" Text="{Binding LiveApiHost,UpdateSourceTrigger=LostFocus}"/>
</c:SettingWithDefault>
</StackPanel>
</GroupBox>
<GroupBox Header="Timing">
<ui:SimpleStackPanel Spacing="10">
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingStreamRetry}" Header="录制重试间隔">
<c:SettingWithDefault.ToolTip>
<TextBlock>录制断开后等待多长时间再尝试开始录制</TextBlock>
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="1000" Description="单位: 毫秒" SmallChange="100" Text="{Binding TimingStreamRetry,Delay=500}"/>
</c:SettingWithDefault>
<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>
<c:SettingWithDefault IsSettingNotUsingDefault="{Binding HasTimingStreamConnect}" Header="录制连接超时">
<c:SettingWithDefault.ToolTip>
<TextBlock>
发出连接直播服务器的请求后等待多长时间<LineBreak/>
防止直播服务器长时间不返回数据导致卡住
</TextBlock>
</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>
<TextBlock>
弹幕服务器被断开后等待多长时间再尝试连接<LineBreak/>
监控开播的主要途径是通过弹幕服务器发送的信息
</TextBlock>
</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>
<TextBlock>
在一定时间没有收到直播服务器发送的数据后断开重连<LineBreak/>
用于防止因为玄学网络问题导致卡住
</TextBlock>
</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>
<TextBlock>
此项影响的时间间隔是定时请求HTTP接口的间隔
主要目的是防止没有从弹幕服务器收到开播消息,
所以此项不需要设置太短。<LineBreak/>
时间间隔设置太短会被mikufans服务器屏蔽导致无法录制。
</TextBlock>
</c:SettingWithDefault.ToolTip>
<ui:NumberBox Minimum="60" Description="单位: 秒" SmallChange="10" Text="{Binding TimingCheckInterval,Delay=500}"/>
</c:SettingWithDefault>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="Cookie">
<StackPanel Orientation="Vertical">
<TextBlock TextWrapping="Wrap">
Cookie 会用于包括获取直播间信息、获取直播流地址、连接弹幕服务器在内的所有 API 请求中。录播姬的请求与浏览器内正常使用所发送的请求不完全一致,能通过分析请求日志识别出来。<LineBreak/>
软件开发者不对账号发生的任何事情负责,包括并不限于被标记为机器人账号、大会员被冻结、无法参与各种抽奖和活动等。建议使用小号。<LineBreak/>
如您知晓您的账号会因以上所列出来的部分原因所导致无法使用或权益受损等情况,并愿意承担由此所会带来的一系列后果,请继续以下的操作,软件开发者不会对您账号所发生的任何后果承担责任。<LineBreak/>
</TextBlock>
<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>
</GroupBox>
<GroupBox Header="Reset Request Policies">
<GroupBox.DataContext>
<model:PollyPolicyModel/>
</GroupBox.DataContext>
<Button Content="Reset" Command="{Binding ResetAllPolicy}"/>
</GroupBox>
<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>
</ui:SimpleStackPanel>
</ScrollViewer>
</ui:Page>