18#if FIRST_PASS == false
20 static WinNTFileSystemAccessor winNTFileSystemAccessor;
22 static WinNTFileSystemAccessor WinNTFileSystemAccessor =>
JVM.
Internal.BaseAccessors.Get(
ref winNTFileSystemAccessor);
25 delegate IntPtr __jniDelegate__canonicalize0(IntPtr jniEnv, IntPtr
self, IntPtr path);
26 static __jniDelegate__canonicalize0 __jniPtr__canonicalize0;
27 delegate IntPtr __jniDelegate__canonicalizeWithPrefix0(IntPtr jniEnv, IntPtr
self, IntPtr canonicalPrefix, IntPtr pathWithCanonicalPrefix);
28 static __jniDelegate__canonicalizeWithPrefix0 __jniPtr__canonicalizeWithPrefix0;
29 delegate
byte __jniDelegate__delete0(IntPtr jniEnv, IntPtr
self, IntPtr f);
30 static __jniDelegate__delete0 __jniPtr__delete0;
31 delegate
byte __jniDelegate__rename0(IntPtr jniEnv, IntPtr
self, IntPtr f1, IntPtr f2);
32 static __jniDelegate__rename0 __jniPtr__rename0;
33 delegate
int __jniDelegate__getBooleanAttributes(IntPtr jniEnv, IntPtr
self, IntPtr f);
34 static __jniDelegate__getBooleanAttributes __jniPtr__getBooleanAttributes;
35 delegate
byte __jniDelegate__checkAccess(IntPtr jniEnv, IntPtr
self, IntPtr f,
int access);
36 static __jniDelegate__checkAccess __jniPtr__checkAccess;
37 delegate
long __jniDelegate__getLastModifiedTime(IntPtr jniEnv, IntPtr
self, IntPtr f);
38 static __jniDelegate__getLastModifiedTime __jniPtr__getLastModifiedTime;
39 delegate
long __jniDelegate__getLength(IntPtr jniEnv, IntPtr
self, IntPtr f);
40 static __jniDelegate__getLength __jniPtr__getLength;
41 delegate
byte __jniDelegate__setPermission(IntPtr jniEnv, IntPtr
self, IntPtr f,
int access,
byte enable,
byte owneronly);
42 static __jniDelegate__setPermission __jniPtr__setPermission;
43 delegate
byte __jniDelegate__createFileExclusively(IntPtr jniEnv, IntPtr
self, IntPtr path);
44 static __jniDelegate__createFileExclusively __jniPtr__createFileExclusively;
45 delegate IntPtr __jniDelegate__list(IntPtr jniEnv, IntPtr
self, IntPtr f);
46 static __jniDelegate__list __jniPtr__list;
47 delegate
byte __jniDelegate__createDirectory(IntPtr jniEnv, IntPtr
self, IntPtr f);
48 static __jniDelegate__createDirectory __jniPtr__createDirectory;
49 delegate
byte __jniDelegate__setLastModifiedTime(IntPtr jniEnv, IntPtr
self, IntPtr f,
long time);
50 static __jniDelegate__setLastModifiedTime __jniPtr__setLastModifiedTime;
51 delegate
byte __jniDelegate__setReadOnly(IntPtr jniEnv, IntPtr
self, IntPtr f);
52 static __jniDelegate__setReadOnly __jniPtr__setReadOnly;
61 static string CanonicalizePath(
string path)
64 throw new NotImplementedException();
69 var parent = Path.GetDirectoryName(path);
73 return path.Length > 1 && path[1] ==
':' ? $
"{char.ToUpper(path[0])}:{Path.DirectorySeparatorChar}" : path;
75 parent = CanonicalizePath(parent);
78 var name = Path.GetFileName(path);
79 if (name ==
"" || name ==
".")
82 return Path.GetDirectoryName(parent);
86 if (
JVM.Vfs.IsPath(path) ==
false)
89 var all = Directory.EnumerateFileSystemEntries(parent, name);
90 if (all.FirstOrDefault() is
string one)
91 name = Path.GetFileName(one);
94 catch (UnauthorizedAccessException)
103 return Path.Combine(parent, name);
105 catch (UnauthorizedAccessException)
113 catch (SecurityException)
117 catch (NotSupportedException)
136 throw new NotImplementedException();
138 if (
JVM.Vfs.IsPath(path))
140 return CanonicalizePath(Path.IsPathRooted(path) ==
false ? Path.GetFullPath(path) : path);
144 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
145 __jniPtr__canonicalize0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__canonicalize0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
canonicalize0),
"(Ljava/lang/String;)Ljava/lang/String;"));
147 var jniEnv = jniFrm.Enter(__callerID);
150 return (
string)jniFrm.UnwrapLocalRef(__jniPtr__canonicalize0(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(path)));
154 System.Console.WriteLine(
"*** exception in native code ***");
155 System.Console.WriteLine(ex);
177 throw new NotImplementedException();
179 if (
JVM.Vfs.IsPath(pathWithCanonicalPrefix))
181 return CanonicalizePath(Path.IsPathRooted(pathWithCanonicalPrefix) ==
false ? Path.GetFullPath(pathWithCanonicalPrefix) : pathWithCanonicalPrefix);
185 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
186 __jniPtr__canonicalizeWithPrefix0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__canonicalizeWithPrefix0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
canonicalizeWithPrefix0),
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"));
188 var jniEnv = jniFrm.Enter(__callerID);
191 return (
string)jniFrm.UnwrapLocalRef(__jniPtr__canonicalizeWithPrefix0(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(canonicalPrefix), jniFrm.MakeLocalRef(pathWithCanonicalPrefix)));
195 System.Console.WriteLine(
"*** exception in native code ***");
196 System.Console.WriteLine(ex);
214 public static bool delete0(
object self,
object f)
217 throw new NotImplementedException();
219 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
221 throw new NotImplementedException();
225 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
226 __jniPtr__delete0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__delete0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
delete0),
"(Ljava/io/File;)Z"));
228 var jniEnv = jniFrm.Enter(__callerID);
231 return __jniPtr__delete0(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f)) != 0;
235 System.Console.WriteLine(
"*** exception in native code ***");
236 System.Console.WriteLine(ex);
255 public static bool rename0(
object self,
object f1,
object f2)
258 throw new NotImplementedException();
260 if (
JVM.Vfs.IsPath(((global::java.io.File)f1).getPath()) ||
JVM.Vfs.IsPath(((global::java.io.File)f2).getPath()))
262 throw new NotImplementedException();
266 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
267 __jniPtr__rename0 ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__rename0>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
rename0),
"(Ljava/io/File;Ljava/io/File;)Z"));
269 var jniEnv = jniFrm.Enter(__callerID);
272 return __jniPtr__rename0(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f1), jniFrm.MakeLocalRef(f2)) != 0;
276 System.Console.WriteLine(
"*** exception in native code ***");
277 System.Console.WriteLine(ex);
297 throw new NotImplementedException();
299 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
301 return JVM.Vfs.GetBooleanAttributes(((global::java.io.File)f).getPath());
305 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
306 __jniPtr__getBooleanAttributes ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__getBooleanAttributes>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
getBooleanAttributes),
"(Ljava/io/File;)I"));
308 var jniEnv = jniFrm.Enter(__callerID);
311 return __jniPtr__getBooleanAttributes(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f));
315 System.Console.WriteLine(
"*** exception in native code ***");
316 System.Console.WriteLine(ex);
337 throw new NotImplementedException();
339 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
341 const int ACCESS_READ = 0x04;
342 return JVM.Vfs.GetEntry(((global::java.io.File)f).getPath())
switch
344 VfsFile file => access == ACCESS_READ && file.CanOpen(FileMode.Open, FileAccess.Read),
345 VfsDirectory =>
true,
351 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
352 __jniPtr__checkAccess ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__checkAccess>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
checkAccess),
"(Ljava/io/File;I)Z"));
354 var jniEnv = jniFrm.Enter(__callerID);
357 return __jniPtr__checkAccess(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f), access) != 0;
361 System.Console.WriteLine(
"*** exception in native code ***");
362 System.Console.WriteLine(ex);
382 throw new NotImplementedException();
384 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
390 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
391 __jniPtr__getLastModifiedTime ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__getLastModifiedTime>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
getLastModifiedTime),
"(Ljava/io/File;)J"));
393 var jniEnv = jniFrm.Enter(__callerID);
396 return __jniPtr__getLastModifiedTime(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f));
400 System.Console.WriteLine(
"*** exception in native code ***");
401 System.Console.WriteLine(ex);
421 throw new NotImplementedException();
423 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
425 return JVM.Vfs.GetEntry(((global::java.io.File)f).getPath()) is VfsFile file ? file.Size : 0;
429 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
430 __jniPtr__getLength ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__getLength>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
getLength),
"(Ljava/io/File;)J"));
432 var jniEnv = jniFrm.Enter(__callerID);
435 return __jniPtr__getLength(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f));
439 System.Console.WriteLine(
"*** exception in native code ***");
440 System.Console.WriteLine(ex);
460 public static bool setPermission(
object self,
object f,
int access,
bool enable,
bool owneronly)
463 throw new NotImplementedException();
465 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
471 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
472 __jniPtr__setPermission ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__setPermission>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
setPermission),
"(Ljava/io/File;IZZ)Z"));
474 var jniEnv = jniFrm.Enter(__callerID);
477 return __jniPtr__setPermission(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f), access, enable ? (
byte)1 : (
byte)0, owneronly ? (
byte)1 : (
byte)0) != 0;
481 System.Console.WriteLine(
"*** exception in native code ***");
482 System.Console.WriteLine(ex);
502 throw new NotImplementedException();
504 if (
JVM.Vfs.IsPath(path))
510 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
511 __jniPtr__createFileExclusively ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__createFileExclusively>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
createFileExclusively),
"(Ljava/lang/String;)Z"));
513 var jniEnv = jniFrm.Enter(__callerID);
516 return __jniPtr__createFileExclusively(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(path)) != 0;
520 System.Console.WriteLine(
"*** exception in native code ***");
521 System.Console.WriteLine(ex);
538 public static string[]
list(
object self,
object f)
541 throw new NotImplementedException();
543 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
545 if (
JVM.Vfs.GetEntry(((global::java.io.File)f).getPath()) is VfsDirectory vfs)
552 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
553 __jniPtr__list ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__list>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
list),
"(Ljava/io/File;)[Ljava/lang/String;"));
555 var jniEnv = jniFrm.Enter(__callerID);
558 return (
string[])jniFrm.UnwrapLocalRef(__jniPtr__list(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f)));
562 System.Console.WriteLine(
"*** exception in native code ***");
563 System.Console.WriteLine(ex);
583 throw new NotImplementedException();
585 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
591 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
592 __jniPtr__createDirectory ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__createDirectory>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
createDirectory),
"(Ljava/io/File;)Z"));
594 var jniEnv = jniFrm.Enter(__callerID);
597 return __jniPtr__createDirectory(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f)) != 0;
601 System.Console.WriteLine(
"*** exception in native code ***");
602 System.Console.WriteLine(ex);
623 throw new NotImplementedException();
625 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
631 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
632 __jniPtr__setLastModifiedTime ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__setLastModifiedTime>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
setLastModifiedTime),
"(Ljava/io/File;J)Z"));
634 var jniEnv = jniFrm.Enter(__callerID);
637 return __jniPtr__setLastModifiedTime(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f), time) != 0;
641 System.Console.WriteLine(
"*** exception in native code ***");
642 System.Console.WriteLine(ex);
662 throw new NotImplementedException();
664 if (
JVM.Vfs.IsPath(((global::java.io.File)f).getPath()))
670 __callerID ??= global::ikvm.@
internal.CallerID.create(WinNTFileSystemAccessor.Type.TypeHandle);
671 __jniPtr__setReadOnly ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__setReadOnly>(
JNIFrame.
GetFuncPtr(__callerID,
"java/io/WinNTFileSystem", nameof(
setReadOnly),
"(Ljava/io/File;)Z"));
673 var jniEnv = jniFrm.Enter(__callerID);
676 return __jniPtr__setReadOnly(jniEnv, jniFrm.MakeLocalRef(
self), jniFrm.MakeLocalRef(f)) != 0;
680 System.Console.WriteLine(
"*** exception in native code ***");
681 System.Console.WriteLine(ex);