migrate wpf to net8

This commit is contained in:
genteure 2023-12-12 00:42:35 +08:00
parent fe9bd29c7d
commit 1ab575f1a0
9 changed files with 73 additions and 416 deletions

View File

@ -1,332 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<ProjectGuid>{0C7D4236-BF43-4944-81FE-E07E05A3F31D}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>BililiveRecorder.WPF</RootNamespace> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>BililiveRecorder.WPF</AssemblyName> <UseWindowsForms>true</UseWindowsForms>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <UseWPF>true</UseWPF>
<FileAlignment>512</FileAlignment> <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>BililiveRecorder.WPF.Program</StartupObject> <StartupObject>BililiveRecorder.WPF.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests> <GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ico.ico</ApplicationIcon> <ApplicationIcon>ico.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest> <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <None Update="lib\miniffmpeg">
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Controls\AddRoomCard.xaml.cs">
<DependentUpon>AddRoomCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\AddRoomFailedDialog.xaml.cs">
<DependentUpon>AddRoomFailedDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\AutoFixProgressDialog.xaml.cs">
<DependentUpon>AutoFixProgressDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\CloseWindowConfirmDialog.xaml.cs">
<DependentUpon>CloseWindowConfirmDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ContentDialogExtensions.cs" />
<Compile Include="Controls\DeleteRoomConfirmDialog.xaml.cs">
<DependentUpon>DeleteRoomConfirmDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\LogPanel.xaml.cs">
<DependentUpon>LogPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\PerRoomSettingsDialog.xaml.cs">
<DependentUpon>PerRoomSettingsDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\RoomCard.xaml.cs">
<DependentUpon>RoomCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SettingWithDefault.xaml.cs">
<DependentUpon>SettingWithDefault.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\TaskbarIconControl.xaml.cs">
<DependentUpon>TaskbarIconControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\WorkDirectorySelectorDialog.xaml.cs">
<DependentUpon>WorkDirectorySelectorDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\ByteUnitsConverter.cs" />
<Compile Include="Converters\ClipEnabledToBooleanConverter.cs" />
<Compile Include="Converters\EnumToBooleanConverter.cs" />
<Compile Include="Converters\IsNullToVisibilityConverter.cs" />
<Compile Include="Converters\RatioToArrowIconConverter.cs" />
<Compile Include="Converters\IsNaNToValueConverter.cs" />
<Compile Include="Converters\ShortRoomIdToVisibilityConverter.cs" />
<Compile Include="Converters\ValueConverterGroup.cs" />
<Compile Include="Models\AboutModel.cs" />
<Compile Include="Models\Commands.cs" />
<Compile Include="Models\DanmakuFileWithOffset.cs" />
<Compile Include="Models\LogModel.cs" />
<Compile Include="Models\PollyPolicyModel.cs" />
<Compile Include="Models\RootModel.cs" />
<Compile Include="NetworkChangeDetector.cs" />
<Compile Include="Pages\AboutPage.xaml.cs">
<DependentUpon>AboutPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\AnnouncementPage.xaml.cs">
<DependentUpon>AnnouncementPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\RootPage.xaml.cs">
<DependentUpon>RootPage.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\BooleanAndConverter.cs" />
<Compile Include="Converters\BooleanInverterConverter.cs" />
<Compile Include="Converters\BoolToValueConverter.cs" />
<Compile Include="Converters\MultiBoolToValueConverter.cs" />
<Compile Include="Converters\NullValueTemplateSelector.cs" />
<Compile Include="Converters\RatioToColorBrushConverter.cs" />
<Compile Include="Pages\ToolboxAutoFixPage.xaml.cs">
<DependentUpon>ToolboxAutoFixPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\ToolboxDanmakuMergerPage.xaml.cs">
<DependentUpon>ToolboxDanmakuMergerPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\ToolboxRemuxPage.xaml.cs">
<DependentUpon>ToolboxRemuxPage.xaml</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="SingleInstance.cs" />
<Compile Include="Properties\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="StreamStartedNotification.cs" />
<Compile Include="Update.cs" />
<Compile Include="WorkDirectoryLoader.cs" />
<Compile Include="WpfLogEventSink.cs" />
<Page Include="Controls\AddRoomCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\AddRoomFailedDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\AutoFixProgressDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\CloseWindowConfirmDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\DeleteRoomConfirmDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\LogPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\PerRoomSettingsDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\RoomCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\SettingWithDefault.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\TaskbarIconControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\WorkDirectorySelectorDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\AboutPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\AnnouncementPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\RootPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DesignTimeResources.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="NewMainWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\LogPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\RoomListPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\AdvancedSettingsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SettingsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\ToolboxAutoFixPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\ToolboxDanmakuMergerPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\ToolboxRemuxPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\ConverterResources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\IconResources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="NewMainWindow.xaml.cs">
<DependentUpon>NewMainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\LogPage.xaml.cs">
<DependentUpon>LogPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\RoomListPage.xaml.cs">
<DependentUpon>RoomListPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\AdvancedSettingsPage.xaml.cs">
<DependentUpon>AdvancedSettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Strings.en.resx" />
<EmbeddedResource Include="Properties\Strings.en-PN.resx" />
<EmbeddedResource Include="Properties\Strings.ja.resx" />
<EmbeddedResource Include="Properties\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Strings.zh-Hant.resx" />
<None Include="lib\miniffmpeg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Properties\app.manifest" />
<Resource Include="ico.ico" /> <Resource Include="ico.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <ProjectReference Include="..\BililiveRecorder.Core\BililiveRecorder.Core.csproj" />
</ItemGroup> <ProjectReference Include="..\BililiveRecorder.Flv\BililiveRecorder.Flv.csproj" />
<ItemGroup> <ProjectReference Include="..\BililiveRecorder.ToolBox\BililiveRecorder.ToolBox.csproj" />
<ProjectReference Include="..\BililiveRecorder.Core\BililiveRecorder.Core.csproj">
<Project>{cb9f2d58-181d-49f7-9560-d35a9b9c1d8c}</Project>
<Name>BililiveRecorder.Core</Name>
</ProjectReference>
<ProjectReference Include="..\BililiveRecorder.Flv\BililiveRecorder.Flv.csproj">
<Project>{7610e19c-d3ab-4cbc-983e-6fda36f4d4b3}</Project>
<Name>BililiveRecorder.Flv</Name>
</ProjectReference>
<ProjectReference Include="..\BililiveRecorder.ToolBox\BililiveRecorder.ToolBox.csproj">
<Project>{4faae8e7-ac4e-4e99-a7d1-53d20ad8a200}</Project>
<Name>BililiveRecorder.ToolBox</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CliWrap"> <PackageReference Include="CliWrap">
@ -335,20 +35,12 @@
<PackageReference Include="Hardcodet.NotifyIcon.Wpf"> <PackageReference Include="Hardcodet.NotifyIcon.Wpf">
<Version>1.1.0</Version> <Version>1.1.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection"> <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications"> <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
<Version>7.1.2</Version> <Version>7.1.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="ModernWpfUI"> <PackageReference Include="ModernWpfUI">
<Version>0.9.4</Version> <Version>0.9.6</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="NuGet.CommandLine"> <PackageReference Include="NuGet.CommandLine">
<Version>6.3.3</Version> <Version>6.3.3</Version>
@ -385,26 +77,24 @@
<PackageReference Include="Serilog.Sinks.File"> <PackageReference Include="Serilog.Sinks.File">
<Version>5.0.0</Version> <Version>5.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Clowd.Squirrel"> <PackageReference Include="Clowd.Squirrel" Version="2.11.1" />
<Version>2.9.42</Version> <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</PackageReference> <PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine"> <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<Version>2.0.0-beta4.22272.1</Version> <PackageReference Include="Microsoft-WindowsAPICodePack-Core" Version="1.1.5" />
</PackageReference> <PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
<PackageReference Include="System.CommandLine.NamingConventionBinder"> <PackageReference Include="WPFLocalizeExtension" Version="3.10.0" />
<Version>2.0.0-beta4.22272.1</Version> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</PackageReference> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="WindowsAPICodePack-Core"> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<Version>1.1.2</Version> <PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</PackageReference> <PackageReference Include="System.ServiceModel.Primitives" Version="6.2.0" />
<PackageReference Include="WindowsAPICodePack-Shell"> <PackageReference Include="System.ServiceModel.Http" Version="6.2.0" />
<Version>1.1.1</Version> <PackageReference Include="System.ServiceModel.Duplex" Version="6.0.0" />
</PackageReference> <PackageReference Include="System.ServiceModel.NetTcp" Version="6.2.0" />
<PackageReference Include="WpfLocalizeExtension"> <PackageReference Include="System.ServiceModel.Security" Version="6.0.0" />
<Version>3.9.4</Version> <PackageReference Include="System.ServiceModel.Federation" Version="6.2.0" />
</PackageReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'"> <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" /> <Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
@ -414,4 +104,4 @@
</PropertyGroup> </PropertyGroup>
<Exec Command="$(PkgNuGet_CommandLine)\tools\NuGet pack BililiveRecorder.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(NupkgReleaseDir) -BasePath $(OutDir) -NonInteractive -ForceEnglishOutput" /> <Exec Command="$(PkgNuGet_CommandLine)\tools\NuGet pack BililiveRecorder.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(NupkgReleaseDir) -BasePath $(OutDir) -NonInteractive -ForceEnglishOutput" />
</Target> </Target>
</Project> </Project>

View File

@ -33,7 +33,7 @@ namespace BililiveRecorder.WPF
this.InitializeComponent(); this.InitializeComponent();
SingleInstance.NotificationReceived += this.SingleInstance_NotificationReceived; // FIXME: SingleInstance.NotificationReceived += this.SingleInstance_NotificationReceived;
} }
private void SingleInstance_NotificationReceived(object sender, EventArgs e) => this.SuperActivateAction(); private void SingleInstance_NotificationReceived(object sender, EventArgs e) => this.SuperActivateAction();
@ -118,7 +118,7 @@ namespace BililiveRecorder.WPF
} }
else else
{ {
SingleInstance.NotificationReceived -= this.SingleInstance_NotificationReceived; // FIXME: SingleInstance.NotificationReceived -= this.SingleInstance_NotificationReceived;
Log.Logger.ForContext<NewMainWindow>().Debug("Window Closing"); Log.Logger.ForContext<NewMainWindow>().Debug("Window Closing");
NativeBeforeWindowClose?.Invoke(this, EventArgs.Empty); NativeBeforeWindowClose?.Invoke(this, EventArgs.Empty);
return; return;

View File

@ -49,6 +49,7 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<!-- TODO: replace with H.NotifyIcon.Wpf -->
<controls:TaskbarIconControl DataContext="{Binding}" d:IsHidden="True"/> <controls:TaskbarIconControl DataContext="{Binding}" d:IsHidden="True"/>
<ui:NavigationView IsBackEnabled="False" IsBackButtonVisible="Collapsed" <ui:NavigationView IsBackEnabled="False" IsBackButtonVisible="Collapsed"
IsSettingsVisible="False" ExpandedModeThresholdWidth="1115" IsSettingsVisible="False" ExpandedModeThresholdWidth="1115"

View File

@ -93,7 +93,7 @@ namespace BililiveRecorder.WPF.Pages
private void RootPage_NativeBeforeWindowClose(object sender, EventArgs e) private void RootPage_NativeBeforeWindowClose(object sender, EventArgs e)
{ {
this.Model.Dispose(); this.Model.Dispose();
SingleInstance.Cleanup(); // FIXME: SingleInstance.Cleanup();
} }
#pragma warning disable VSTHRD100 // Avoid async void methods #pragma warning disable VSTHRD100 // Avoid async void methods
@ -105,7 +105,7 @@ namespace BililiveRecorder.WPF.Pages
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
await Task.Delay(1000); await Task.Delay(1000);
_ = this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => _ = this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, () =>
{ {
MessageBox.Show(Window.GetWindow(this), @"录播姬 安装成功! MessageBox.Show(Window.GetWindow(this), @"录播姬 安装成功!
使 使
@ -115,7 +115,7 @@ BililiveRecorder Installed!
Please use the shortcut on the desktop or Please use the shortcut on the desktop or
in the start menu to launch. in the start menu to launch.
You can uninstall me in system settings.", " Installed", MessageBoxButton.OK, MessageBoxImage.Information); You can uninstall me in system settings.", " Installed", MessageBoxButton.OK, MessageBoxImage.Information);
})); });
}); });
} }
@ -249,12 +249,12 @@ You can uninstall me in system settings.", "安装成功 Installed", MessageBoxB
config.Global.WorkDirectory = path; config.Global.WorkDirectory = path;
// 检查已经在同目录运行的其他进程 // 检查已经在同目录运行的其他进程
if (!SingleInstance.CheckMutex(path)) // FIXME: if (!SingleInstance.CheckMutex(path))
{ //{
// 有已经在其他目录运行的进程,已经通知该进程,本进程退出 // // 有已经在其他目录运行的进程,已经通知该进程,本进程退出
(Application.Current.MainWindow as NewMainWindow)!.CloseWithoutConfirmAction(); // (Application.Current.MainWindow as NewMainWindow)!.CloseWithoutConfirmAction();
return; // return;
} //}
// 无已经在同目录运行的进程 // 无已经在同目录运行的进程
this.serviceProvider = this.BuildServiceProvider(config, logger); this.serviceProvider = this.BuildServiceProvider(config, logger);

View File

@ -4,8 +4,8 @@ using System.CommandLine.NamingConventionBinder;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security; using System.Security;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -23,6 +23,8 @@ using Serilog.Formatting.Compact;
using Serilog.Formatting.Display; using Serilog.Formatting.Display;
using Squirrel; using Squirrel;
[assembly: SupportedOSPlatform("windows")]
#nullable enable #nullable enable
namespace BililiveRecorder.WPF namespace BililiveRecorder.WPF
{ {
@ -337,18 +339,18 @@ namespace BililiveRecorder.WPF
[DllImport("kernel32")] [DllImport("kernel32")]
private static extern bool AttachConsole(int pid); private static extern bool AttachConsole(int pid);
[HandleProcessCorruptedStateExceptions, SecurityCritical] [SecurityCritical]
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{ {
if (e.ExceptionObject is Exception ex) if (e.ExceptionObject is Exception ex)
logger.Fatal(ex, "Unhandled exception from AppDomain.UnhandledException"); logger.Fatal(ex, "Unhandled exception from AppDomain.UnhandledException");
} }
[HandleProcessCorruptedStateExceptions, SecurityCritical] [SecurityCritical]
private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) => private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) =>
logger.Error(e.Exception, "Unobserved exception from TaskScheduler.UnobservedTaskException"); logger.Error(e.Exception, "Unobserved exception from TaskScheduler.UnobservedTaskException");
[HandleProcessCorruptedStateExceptions, SecurityCritical] [SecurityCritical]
private static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) => private static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) =>
logger.Fatal(e.Exception, "Unhandled exception from Application.DispatcherUnhandledException"); logger.Fatal(e.Exception, "Unhandled exception from Application.DispatcherUnhandledException");

View File

@ -1,39 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("mikufans录播姬")]
[assembly: AssemblyDescription("mikufans录播姬 by genteure")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Genteure")]
[assembly: AssemblyProduct("mikufans录播姬")]
[assembly: AssemblyCopyright("Copyright © 2018-2023 Genteure")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -1,19 +1,20 @@
using System; //using System;
using System.Collections.Generic; //using System.Collections.Generic;
using System.Runtime.Remoting; //using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels; //using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc; //using System.Runtime.Remoting.Channels.Ipc;
using System.Runtime.Serialization.Formatters; //using System.Runtime.Serialization.Formatters;
using System.Text; //using System.Text;
using System.Threading; //using System.Threading;
using System.Windows; //using System.Windows;
using System.Windows.Threading; //using System.Windows.Threading;
#nullable enable #nullable enable
namespace BililiveRecorder.WPF namespace BililiveRecorder.WPF
{ {
// FIXME
public static class SingleInstance public static class SingleInstance
{ {/*
private static Mutex? singleInstanceMutex; private static Mutex? singleInstanceMutex;
private static IpcServerChannel? channel; private static IpcServerChannel? channel;
@ -73,5 +74,6 @@ namespace BililiveRecorder.WPF
#pragma warning restore VSTHRD110 // Observe result of async calls #pragma warning restore VSTHRD110 // Observe result of async calls
public override object? InitializeLifetimeService() => null; public override object? InitializeLifetimeService() => null;
} }
*/
} }
} }

View File

@ -17,7 +17,7 @@ namespace BililiveRecorder.WPF
{ {
private static readonly ILogger logger = Log.ForContext(typeof(StreamStartedNotification)); private static readonly ILogger logger = Log.ForContext(typeof(StreamStartedNotification));
private static INotificationApi notificationApi; private static readonly INotificationApi notificationApi;
static StreamStartedNotification() static StreamStartedNotification()
{ {
@ -69,7 +69,8 @@ namespace BililiveRecorder.WPF
public NotificationCenterApi() public NotificationCenterApi()
{ {
_ = ToastNotificationManagerCompat.History; throw new NotImplementedException("TODO: re-support windows notification center");
// FIXME: _ = ToastNotificationManagerCompat.History;
this.tempPath = Path.Combine(Path.GetTempPath(), "brec-notifi", Process.GetCurrentProcess().Id.ToString()); this.tempPath = Path.Combine(Path.GetTempPath(), "brec-notifi", Process.GetCurrentProcess().Id.ToString());
@ -90,7 +91,7 @@ namespace BililiveRecorder.WPF
public void Cleanup() public void Cleanup()
{ {
ToastNotificationManagerCompat.Uninstall(); // FIXME: ToastNotificationManagerCompat.Uninstall();
try try
{ {
@ -169,7 +170,7 @@ namespace BililiveRecorder.WPF
if (cover is not null) if (cover is not null)
builder.AddInlineImage(cover); builder.AddInlineImage(cover);
builder.Show(); // FIXME: builder.Show();
} }
} }
} }

View File

@ -1,4 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2D44A59D-E43
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{623A2ACC-DAC6-4E6F-9242-B4B54381AAE1}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{623A2ACC-DAC6-4E6F-9242-B4B54381AAE1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BililiveRecorder.WPF", "BililiveRecorder.WPF\BililiveRecorder.WPF.csproj", "{0C7D4236-BF43-4944-81FE-E07E05A3F31D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.WPF", "BililiveRecorder.WPF\BililiveRecorder.WPF.csproj", "{0C7D4236-BF43-4944-81FE-E07E05A3F31D}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.Core", "BililiveRecorder.Core\BililiveRecorder.Core.csproj", "{CB9F2D58-181D-49F7-9560-D35A9B9C1D8C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BililiveRecorder.Core", "BililiveRecorder.Core\BililiveRecorder.Core.csproj", "{CB9F2D58-181D-49F7-9560-D35A9B9C1D8C}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject