IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ExplodedModuleReader.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Xml.Schema;
5
7{
8
13 {
14
15 readonly string _dir;
16 readonly RuntimeVersion _runtimeVersion;
17
23 public ExplodedModuleReader(string dir, RuntimeVersion runtimeVersion)
24 {
25 _dir = dir ?? throw new ArgumentNullException(nameof(dir));
26 _dir = Path.GetFullPath(_dir);
27 _runtimeVersion = runtimeVersion;
28 }
29
31 public override IEnumerable<string> List()
32 {
33 foreach (var i in Directory.EnumerateFiles(_dir, "*", SearchOption.AllDirectories))
34 if (Resources.ToResourceName(_dir, i) is { } path and { Length: > 0 })
35 yield return path;
36 }
37
39 public override Stream? Open(string name)
40 {
41 var path = Resources.ToFilePath(_dir, name);
42 if (path is null)
43 return null;
44
45 return File.OpenRead(path);
46 }
47
49 public override void Dispose()
50 {
51
52 }
53
54 }
55
56}
A ModuleReader for an exploded module.
ExplodedModuleReader(string dir, RuntimeVersion runtimeVersion)
Initializes a new instance.
override IEnumerable< string > List()
Provides access to the content of a module.
static ? string ToFilePath(string dir, string name)
Returns a file path to a resource in a file tree. If the resource name has a trailing "/" then the fi...
Definition Resources.cs:62
static string ToResourceName(string dir, string file)
Returns a resource name corresponding to the relative file path between dir and file ....
Definition Resources.cs:33