using System; using Bridge; using Bridge.Html5; [External] public class FileSystem { /// /// Converts a major and minor number into a single unique integer. /// This is used as an id to represent the device. /// /// Major number. /// Minor number. internal int makedev(int ma, int mi) { throw new NotImplementedException(); } /// /// Registers the specified device driver with a set of callbacks. /// /// The specific device driver id, created using makedev(). /// The set of callbacks required by the device. /// For an example, see the NODEFS default callbacks /// https://github.com/kripken/emscripten/blob/1.29.12/src/library_nodefs.js#L213 internal void registerDevice(int dev, object ops) { throw new NotImplementedException(); } /// /// Sets up standard I/O devices for stdin, stdout, and stderr. /// The devices are set up using the following (optional) callbacks. /// If any of the callbacks throw an exception, /// it will be caught and handled as if the device malfunctioned. /// /// Input callback. This will be called with /// no parameters whenever the program attempts to read from stdin. /// It should return an ASCII character code when data is available, /// or null when it isn’t. /// Output callback. This will be called with /// an ASCII character code whenever the program writes to stdout. /// It may also be called with null to flush the output. /// Error callback. This is similar to output, /// except it is called when data is written to stderr. /// internal object init(Delegate input, Delegate output, Delegate error) { throw new NotImplementedException(); } /// /// Mounts the FS object specified by type to the directory /// specified by mountpoint. The opts object is specific /// to each file system type. /// /// The file system type: MEMFS, NODEFS, IDBFS or WORKERFS. /// A generic settings object used by the underlying file system. /// A path to an existing local Emscripten directory /// where the file system is to be mounted. It can be either an absolute path, /// or something relative to the current directory. internal void mount(object type, object opts, string mountpoint) { throw new NotImplementedException(); } /// /// Unmounts the specified mountpoint. /// /// The directory to unmount. internal void unmount(string mountpoint) { throw new NotImplementedException(); } /// /// Responsible for iterating and synchronizing all mounted file systems /// in an asynchronous fashion. /// /// true to initialize Emscripten’s file system data /// with the data from the file system’s persistent source, /// and false to save Emscripten`s file system data /// to the file system’s persistent source. /// A notification callback function /// that is invoked on completion of the synchronization. /// If an error occurred, it will be provided as a parameter to this function. internal void syncfs(bool populate, Delegate callback) { } /// /// Creates a new directory node in the file system. /// /// The path name for the new directory node. /// File permissions for the new node. /// The default setting (in octal numeric notation) is 0777. internal void mkdir(string path, int mode) { throw new NotImplementedException(); } /// /// Creates a new device node in the file system referencing /// the registered device driver (FS.registerDevice()) for dev. /// /// The path name for the new device node. /// File permissions for the new node. /// The default setting (in octal numeric notation) is 0777. /// The registered device driver. internal void mkdev(string path, int mode, int dev) { throw new NotImplementedException(); } /// /// Creates a symlink node at newpath linking to oldpath. /// /// The path name of the file to link to. /// The path to the new symlink node, that points to oldpath. internal void symlink(string oldpath, string newpath) { throw new NotImplementedException(); } internal Stat stat(string path) { return new Stat(); } internal File open(string path, string flag) { return new File(); } internal void close(File stream) { } internal void read(File stream, Uint8Array buffer, int offset, int length, int position) { } /// /// Writes the entire contents of data to the file at path. /// The value of opts determines whether data is treated /// either as a string (encoding = utf8), or as an ArrayBufferView(encoding = binary). /// /// The file to which to write data. /// The data to write. /// /// encoding(string) /// binary | utf8.The default is utf8 /// flags(string) /// Write flags, as defined in FS.open(). The default is ‘w’. /// internal void writeFile(string path, object data, object opts = null) { throw new NotImplementedException(); } /// /// Preloads a file asynchronously, and uses preload plugins to prepare its content. /// You should call this in preRun, run() will be delayed until all preloaded files are ready. /// This is how the preload-file option works in emcc /// when --use-preload-plugins has been specified (if you use this method by itself, /// you will need to build the program with that option). /// /// The parent folder, either as a path (e.g. ‘/usr/lib’) or /// an object previously returned from a FS.createFolder() or FS.createPath() call. /// The name of the new file. /// In the browser, this is the URL whose contents will be returned /// when the file is accessed. In a command line engine, /// this will be the local (real) file system path the contents /// will be loaded from. Note that writes to this file are virtual. /// Whether the file should have read permissions set /// from the program’s point of view. /// Whether the file should have write permissions set /// from the program’s point of view. internal void createPreloadedFile(string parent, string name, string url, bool canRead, bool canWrite) { throw new NotImplementedException(); } internal void createFolder(string parent, string name, bool canRead, bool canWrite) { throw new NotImplementedException(); } } [External] class Stat { internal int size = 0; } [External] class File { }