feat: remove giant dependency

This commit is contained in:
rjindael 2023-07-31 05:41:06 -07:00
parent a36eac87fc
commit 1ed03a2a79
No known key found for this signature in database
GPG Key ID: D069369C906CCF31
3 changed files with 17 additions and 7 deletions

View File

@ -45,8 +45,4 @@
<ItemGroup>
<Compile Include="..\Kiseki.Launcher\**\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Syroot.Windows.IO.KnownFolders" Version="1.3.0" />
</ItemGroup>
</Project>

View File

@ -2,8 +2,6 @@ using System.Reflection;
using Microsoft.Win32;
using Syroot.Windows.IO;
namespace Kiseki.Launcher.Windows
{
public class Launcher : ILauncher
@ -58,7 +56,7 @@ namespace Kiseki.Launcher.Windows
{
Title = "Select your license file",
Filter = "License files (*.bin)|*.bin",
InitialDirectory = KnownFolders.Downloads.Path
InitialDirectory = Win32.GetDownloadsPath()
};
if (dialog.ShowDialog() == DialogResult.OK)

View File

@ -0,0 +1,16 @@
using System.Runtime.InteropServices;
namespace Kiseki.Launcher.Windows
{
public static class Win32
{
[DllImport("shell32", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false)]
private static extern string SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, nint hToken = default);
// https://www.codeproject.com/Articles/878605/Getting-All-Special-Folders-in-NET
public static string GetDownloadsPath()
{
return SHGetKnownFolderPath(new("374DE290-123F-4565-9164-39C4925E467B"), 0);
}
}
}