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

◆ CreateNew() [3/3]

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

Definition at line 197 of file MemoryMappedFile.cs.

198 {
199 if (mapName != null && mapName.Length == 0)
200 {
202 }
203 if (capacity <= 0)
204 {
205 throw new ArgumentOutOfRangeException("capacity", System.SR.ArgumentOutOfRange_NeedPositiveNumber);
206 }
207 if (IntPtr.Size == 4 && capacity > uint.MaxValue)
208 {
209 throw new ArgumentOutOfRangeException("capacity", System.SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed);
210 }
211 switch (access)
212 {
213 default:
214 throw new ArgumentOutOfRangeException("access");
215 case MemoryMappedFileAccess.Write:
217 case MemoryMappedFileAccess.ReadWrite:
218 case MemoryMappedFileAccess.Read:
219 case MemoryMappedFileAccess.CopyOnWrite:
220 case MemoryMappedFileAccess.ReadExecute:
221 case MemoryMappedFileAccess.ReadWriteExecute:
222 {
223 if (((uint)options & 0xFBFFFFFFu) != 0)
224 {
225 throw new ArgumentOutOfRangeException("options");
226 }
227 if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable)
228 {
229 throw new ArgumentOutOfRangeException("inheritability");
230 }
231 SafeMemoryMappedFileHandle handle = CreateCore(null, mapName, inheritability, access, options, capacity);
232 return new MemoryMappedFile(handle);
233 }
234 }
235 }
MemoryMappedFile(SafeMemoryMappedFileHandle handle)
static SafeMemoryMappedFileHandle CreateCore(FileStream fileStream, string mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, MemoryMappedFileOptions options, long capacity)
static string Argument_NewMMFWriteAccessNotAllowed
Definition SR.cs:42
static string Argument_MapNameEmptyString
Definition SR.cs:38
static string ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed
Definition SR.cs:54
static string ArgumentOutOfRange_NeedPositiveNumber
Definition SR.cs:56
Definition SR.cs:7

References System.IO.MemoryMappedFiles.MemoryMappedFile.MemoryMappedFile(), System.SR.Argument_MapNameEmptyString, System.SR.Argument_NewMMFWriteAccessNotAllowed, System.SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed, System.SR.ArgumentOutOfRange_NeedPositiveNumber, System.capacity, System.IO.MemoryMappedFiles.MemoryMappedFile.CreateCore(), System.handle, System.options, and System.IntPtr.Size.