Move example to example folder

This commit is contained in:
Speykious committed 2022-03-27 13:27:20 +02:00
1 parent c6ed064ddf
commit 372d1ab2f1
3 files changed
+14 -6

No files matched your search

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\NativeFileDialogs.AutoGen\NativeFileDialogs.AutoGen.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NativeFileDialogs.Net.Runtime" Version="0.1.0-alpha" />
</ItemGroup>
</Project>
@@ -0,0 +1,42 @@
// Copyright (c) Speykious
// This file is part of NativeFileDialogs.NET.
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
using NativeFileDialogs.AutoGen;
unsafe
{
nfd.NFD_Init();
NfdnfilteritemT[] filterItem = new[]
{
new NfdnfilteritemT
{
Name = "Source code",
Spec = "c,cpp,cc",
},
new NfdnfilteritemT
{
Name = "Headers",
Spec = "h,hpp",
},
};
sbyte* outPathPtr;
NfdresultT result = nfd.NFD_OpenDialogN(&outPathPtr, filterItem, (uint)filterItem.Length, null);
switch (result)
{
case NfdresultT.NFD_OKAY:
Console.WriteLine("Success!");
Console.WriteLine(new string(outPathPtr));
break;
case NfdresultT.NFD_CANCEL:
Console.WriteLine("User pressed Cancel.");
break;
default:
Console.WriteLine($"Error: {nfd.NFD_GetError()}");
break;
}
nfd.NFD_Quit();
}