Exemple #1
0
        private static FileStream OpenHelper(string path, FileMode fileMode, FileAccess fileAccess, FileShare fileShare, int cacheSize, FileOptions fileOptions)
        {
            using (var pin = new PinCollection())
            {
#if DotNetCoreClrLinux
                FileStream fs = new FileStream(path, fileMode);
                UpdateFilePermission(path);
                return(fs);
#else
                IntPtr handle;
                NativeCommon.FabricFileOpenEx(
                    pin.AddBlittable(path),
                    ToNative(fileMode),
                    ToNative(fileAccess),
                    ToNative(fileShare),
                    ToNative(fileOptions),
                    out handle);
                return(new FileStream(new SafeFileHandle(handle, true), fileAccess, cacheSize, fileOptions.HasFlag(FileOptions.Asynchronous)));
#endif
            }
        }