3using System.Threading.Tasks;
6using Newtonsoft.Json.Linq;
18 fs.ImportZip(file, root);
31 fs.ImportZip(stream, root);
45 fs.SetCurrentDirectory(root);
47 var fp = Path.GetFullPath(dir);
48 if (!fp.EndsWith(Path.DirectorySeparatorChar))
50 fp += Path.DirectorySeparatorChar;
53 foreach (var file
in Directory.GetFiles(fp,
"*", SearchOption.AllDirectories))
55 var relFile = file.Replace(fp,
"");
56 using var s = File.OpenRead(file);
57 using var d = fs.OpenWrite(relFile,
BadWriteMode.CreateNew);
71 using var http =
new HttpClient();
72 return stack.FromZip(await http.GetStreamAsync(url), root, name ?? $
"WebArchive({url})");
static BadFileSystemStack FromDirectory(this BadFileSystemStack stack, string dir, string root="/", string? name=null)
static BadFileSystemStack FromZip(this BadFileSystemStack stack, Stream stream, string root="/", string? name=null)
static BadFileSystemStack FromZip(this BadFileSystemStack stack, string file, string root="/", string? name=null)
static async Task< BadFileSystemStack > FromWebArchive(this BadFileSystemStack stack, string url, string root="/", string? name=null)
BadFileSystemStack ConfigureLayer(Func< BadLayeredFileSystemLayer > config)
static BadLayeredFileSystemLayer Create(string name, BadVirtualFileSystem fs, JObject? metaData=null)
Virtual File System Implementation for the BadScript Engine.
Contains the Implementation of the BadScript Virtual File System.
Contains IO Implementation for the BadScript2 Runtime.
BadWriteMode
The Write Modes of the File System Abstraction.