Stream IZMachineIO.OpenAuxiliaryFile(string name, int size, bool writing) { frefid_t file = Glk.glk_fileref_create_by_name( FileUsage.Data | FileUsage.BinaryMode, name, 0); return(OpenStream(file, writing ? FileMode.Write : FileMode.Read)); }
Stream IZMachineIO.OpenRestoreFile() { frefid_t file = Glk.glk_fileref_create_by_prompt( FileUsage.SavedGame | FileUsage.BinaryMode, FileMode.Read, 0); return(OpenStream(file, FileMode.Read)); }
Stream IZMachineIO.OpenSaveFile(int size) { frefid_t file = Glk.glk_fileref_create_by_prompt( FileUsage.SavedGame | FileUsage.BinaryMode, FileMode.Write, 0); return(OpenStream(file, FileMode.Write)); }
Stream IZMachineIO.OpenCommandFile(bool writing) { FileMode mode = writing ? FileMode.Write : FileMode.Read; frefid_t file = Glk.glk_fileref_create_by_prompt( FileUsage.InputRecord | FileUsage.TextMode, mode, 0); return(OpenStream(file, mode)); }
private Stream OpenStream(frefid_t fileref, FileMode mode) { if (fileref.IsNull) { return(null); } strid_t gstr = Glk.glk_stream_open_file(fileref, mode, 0); if (gstr.IsNull) { return(null); } return(new GlkStream(gstr)); }
public static extern bool glk_fileref_does_file_exist(frefid_t fref);
public static extern void glk_fileref_delete_file(frefid_t fref);
public static extern uint glk_fileref_get_rock(frefid_t fref);
public static extern frefid_t glk_fileref_iterate(frefid_t fref, out uint rockptr);
public static extern void glk_fileref_destroy(frefid_t fref);
public static extern frefid_t glk_fileref_create_from_fileref(FileUsage usage, frefid_t fref, uint rock);
public static extern strid_t glk_stream_open_file_uni(frefid_t fileref, FileMode fmode, uint rock);