WPF: Add "show logs" menu item

This commit is contained in:
Genteure 2021-08-09 22:58:30 +08:00
parent 59628e36e3
commit 7dd2afd9de
4 changed files with 105 additions and 63 deletions

View File

@ -58,6 +58,7 @@
<MenuItem Header="{l:Loc RoomListPage_Menu_File_OpenWorkDirectory}" Click="MenuItem_OpenWorkDirectory_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_File_ChangeWorkPath}" Click="MenuItem_ChangeWorkPath_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_File_SaveConfig}" Click="MenuItem_SaveConfig_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_File_ShowLogFilesInExplorer}" Click="MenuItem_ShowLogFilesInExplorer_Click"/>
</MenuItem>
<MenuItem Header="{l:Loc RoomListPage_Menu_View}">
<MenuItem Header="{l:Loc RoomListPage_Menu_Sort_Default}" Tag="{x:Static local:SortedBy.None}" Click="MenuItem_SortBy_Click"/>

View File

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
@ -295,6 +296,17 @@ namespace BililiveRecorder.WPF.Pages
if (((MenuItem)sender).Tag is bool b && this.DataContext is IRecorder rec)
rec.Config.Global.WpfShowTitleAndArea = b;
}
private void MenuItem_ShowLogFilesInExplorer_Click(object sender, RoutedEventArgs e)
{
try
{
var logPath = Path.Combine(Path.GetDirectoryName(typeof(RoomListPage).Assembly.Location), "logs");
Process.Start("explorer.exe", logPath);
}
catch (Exception)
{ }
}
}
public enum SortedBy

View File

@ -739,6 +739,15 @@ namespace BililiveRecorder.WPF.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to 显示日志文件.
/// </summary>
public static string RoomListPage_Menu_File_ShowLogFilesInExplorer {
get {
return ResourceManager.GetString("RoomListPage_Menu_File_ShowLogFilesInExplorer", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 链接.
/// </summary>

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -89,17 +109,16 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="About_Contact" xml:space="preserve">
<value>联系方式</value>
</data>
<data name="About_Copyright" xml:space="preserve">
<value>版权所有</value>
@ -129,7 +148,6 @@
</data>
<data name="About_Website" xml:space="preserve">
<value>官方网站</value>
</data>
<data name="AddRoomCard_ConfirmButton" xml:space="preserve">
<value>确定</value>
@ -338,6 +356,9 @@
<data name="RoomListPage_Menu_File_SaveConfig" xml:space="preserve">
<value>保存设置</value>
</data>
<data name="RoomListPage_Menu_File_ShowLogFilesInExplorer" xml:space="preserve">
<value>显示日志文件</value>
</data>
<data name="RoomListPage_Menu_Links" xml:space="preserve">
<value>链接</value>
</data>
@ -631,7 +652,6 @@ Will use default setting and disable user input when checked.</comment>
</data>
<data name="Window_Title" xml:space="preserve">
<value>B站录播姬 {0}</value>
</data>
<data name="WorkDirectorySelector_Browse" xml:space="preserve">
<value>浏览...</value>