mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* Add truncate for filesaving If I expose it to content I pretty much always want truncate to be honest. * Update Robust.Client/UserInterface/FileDialogManager.cs --------- Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Robust.Client.UserInterface
|
|
{
|
|
/// <summary>
|
|
/// Manager for opening of file dialogs.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// File dialogs are native to the OS being ran on.
|
|
/// All operations are asynchronous to prevent locking up the main thread while the user makes his pick.
|
|
/// </remarks>
|
|
public interface IFileDialogManager
|
|
{
|
|
/// <summary>
|
|
/// Open a file dialog used for opening a single file.
|
|
/// </summary>
|
|
/// <returns>
|
|
/// The file stream for the file the user opened.
|
|
/// <see langword="null" /> if the user cancelled the action.
|
|
/// </returns>
|
|
Task<Stream?> OpenFile(FileDialogFilters? filters = null);
|
|
|
|
/// <summary>
|
|
/// Open a file dialog used for saving a single file.
|
|
/// </summary>
|
|
/// <returns>
|
|
/// The file stream the user chose to save to, and whether the file already existed.
|
|
/// Null if the user cancelled the action.
|
|
/// </returns>
|
|
/// <param name="truncate">Should we truncate an existing file to 0-size then write or append.</param>
|
|
Task<(Stream fileStream, bool alreadyExisted)?> SaveFile(FileDialogFilters? filters = null, bool truncate = true);
|
|
}
|
|
}
|