示例#1
0
        private static FileStream OpenHelper(string path, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
        {
            using (var pin = new PinCollection())
            {
#if DotNetCoreClrLinux
                FileStream fs = new FileStream(path, fileMode);
                UpdateFilePermission(path);
                return(fs);
#else
                IntPtr handle;
                NativeCommon.FabricFileOpen(
                    pin.AddBlittable(path),
                    ToNative(fileMode),
                    ToNative(fileAccess),
                    ToNative(fileShare),
                    out handle);
                return(new FileStream(new SafeFileHandle(handle, true), fileAccess));
#endif
            }
        }