Avalonia Code OnlyItaliano

API › RAVAL

RFiles class

public static class RFiles

File and folder pickers that answer with a path; text files read and written whole.

Properties

static string LastFolder { get; set; }

The folder where the next picker opens (the folder of the last file chosen).

Methods

static Task<string> OpenAsync(Control owner, string title, params string[] types)

One file to open (null if none chosen); types as «name|*.a;*.b».

static Task<List<string>> OpenManyAsync(Control owner, string title, params string[] types)

Several files to open (empty if none chosen).

static Task<string> SaveAsync(Control owner, string title, string name, params string[] types)

The file to save (null if the user gives up), proposing name. The picker asks before replacing a file; the extension of the first type is added when the user writes none.

static Task<string> FolderAsync(Control owner, string title)

A folder (null if none chosen).

static List<FilePickerFileType> Types(params string[] types)

The types of a picker from texts «name|*.a;*.b»: «CSV|*.csv», «Images|*.png;*.jpg». A text without «|» is a pattern alone, named after itself.

static string ReadText(string path)

A text file read whole (UTF-8, or the encoding of its BOM).

static void WriteText(string path, string text)

A text file written whole in UTF-8 without BOM, through a temporary file then renamed: a crash halfway leaves the old file. The folder is created if missing.