feat: remove giant dependency
This commit is contained in:
parent
a36eac87fc
commit
1ed03a2a79
|
|
@ -45,8 +45,4 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="..\Kiseki.Launcher\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Syroot.Windows.IO.KnownFolders" Version="1.3.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue