mirror of
https://github.com/AssetRipper/NativeFileDialogs.NET.git
synced 2026-11-13 20:05:46 -10:00
41 lines
838 B
C#
41 lines
838 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 NativeFileDialogs.AutoGen;
|
|
|
|
namespace NativeFileDialogs.Net;
|
|
|
|
internal class NfdManager
|
|
{
|
|
private uint counter = 0;
|
|
|
|
public NfdStatus PushDialog()
|
|
{
|
|
lock (this)
|
|
{
|
|
NfdStatus status = NfdStatus.Ok;
|
|
if (counter == 0)
|
|
status = nfd.NFD_Init().ToNfdStatus();
|
|
|
|
counter++;
|
|
return status;
|
|
}
|
|
}
|
|
|
|
public NfdStatus PullDialog()
|
|
{
|
|
lock (this)
|
|
{
|
|
if (counter == 0)
|
|
return NfdStatus.Cancelled;
|
|
|
|
counter--;
|
|
if (counter == 0)
|
|
nfd.NFD_Quit();
|
|
|
|
return NfdStatus.Ok;
|
|
}
|
|
}
|
|
}
|