Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateOrOpen() [3/3]

static MemoryMappedFile System.IO.MemoryMappedFiles.MemoryMappedFile.CreateOrOpen ( string mapName,
long capacity,
MemoryMappedFileAccess access,
MemoryMappedFileOptions options,
HandleInheritability inheritability )
inlinestatic

Definition at line 250 of file MemoryMappedFile.cs.

251 {
252 if (mapName == null)
253 {
254 throw new ArgumentNullException("mapName", System.SR.ArgumentNull_MapName);
255 }
256 if (mapName.Length == 0)
257 {
259 }
260 if (capacity <= 0)
261 {
262 throw new ArgumentOutOfRangeException("capacity", System.SR.ArgumentOutOfRange_NeedPositiveNumber);
263 }
264 if (IntPtr.Size == 4 && capacity > uint.MaxValue)
265 {
266 throw new ArgumentOutOfRangeException("capacity", System.SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed);
267 }
268 if (access < MemoryMappedFileAccess.ReadWrite || access > MemoryMappedFileAccess.ReadWriteExecute)
269 {
270 throw new ArgumentOutOfRangeException("access");
271 }
272 if (((uint)options & 0xFBFFFFFFu) != 0)
273 {
274 throw new ArgumentOutOfRangeException("options");
275 }
276 if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable)
277 {
278 throw new ArgumentOutOfRangeException("inheritability");
279 }
280 SafeMemoryMappedFileHandle handle = ((access != MemoryMappedFileAccess.Write) ? CreateOrOpenCore(mapName, inheritability, access, options, capacity) : OpenCore(mapName, inheritability, access, createOrOpen: true));
281 return new MemoryMappedFile(handle);
282 }
static SafeMemoryMappedFileHandle CreateOrOpenCore(string mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, MemoryMappedFileOptions options, long capacity)
static SafeMemoryMappedFileHandle OpenCore(string mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, bool createOrOpen)
MemoryMappedFile(SafeMemoryMappedFileHandle handle)
static string Argument_MapNameEmptyString
Definition SR.cs:38
static string ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed
Definition SR.cs:54
static string ArgumentNull_MapName
Definition SR.cs:50
static string ArgumentOutOfRange_NeedPositiveNumber
Definition SR.cs:56
Definition SR.cs:7

References System.IO.MemoryMappedFiles.MemoryMappedFile.MemoryMappedFile(), System.SR.Argument_MapNameEmptyString, System.SR.ArgumentNull_MapName, System.SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed, System.SR.ArgumentOutOfRange_NeedPositiveNumber, System.capacity, System.IO.MemoryMappedFiles.MemoryMappedFile.CreateOrOpenCore(), System.handle, System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(), System.options, and System.IntPtr.Size.