mirror of
https://github.com/AssetRipper/NativeFileDialogs.NET.git
synced 2026-11-13 20:05:46 -10:00
44 lines
1010 B
C#
44 lines
1010 B
C#
// Copyright (c) Speykious
|
|
// This file is part of NativeFileDialogs.NET.
|
|
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
|
|
|
|
using System;
|
|
using NativeFileDialogs.AutoGen;
|
|
|
|
unsafe
|
|
{
|
|
nfd.Init();
|
|
|
|
FilterItemU8[] filterItem = new[]
|
|
{
|
|
new FilterItemU8
|
|
{
|
|
Name = "Source code",
|
|
Spec = "c,cpp,cc",
|
|
},
|
|
new FilterItemU8
|
|
{
|
|
Name = "Headers",
|
|
Spec = "h,hpp",
|
|
},
|
|
};
|
|
|
|
sbyte* outPathPtr;
|
|
Result result = nfd.OpenDialogU8(&outPathPtr, filterItem, (uint)filterItem.Length, null);
|
|
switch (result)
|
|
{
|
|
case Result.Okay:
|
|
Console.WriteLine("Success!");
|
|
Console.WriteLine(new string(outPathPtr));
|
|
break;
|
|
case Result.Cancel:
|
|
Console.WriteLine("User pressed Cancel.");
|
|
break;
|
|
default:
|
|
Console.WriteLine($"Error: {nfd.GetError()}");
|
|
break;
|
|
}
|
|
|
|
nfd.Quit();
|
|
}
|