Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MemoryMapLightUp.cs
Go to the documentation of this file.
1using System.IO;
4
6
7internal static class MemoryMapLightUp
8{
9 internal static bool IsAvailable => true;
10
12 {
14 }
15
16 internal static IDisposable CreateViewAccessor(object memoryMap, long start, int size)
17 {
18 try
19 {
20 return ((MemoryMappedFile)memoryMap).CreateViewAccessor(start, size, MemoryMappedFileAccess.Read);
21 }
23 {
24 throw new IOException(ex.Message, ex);
25 }
26 }
27
28 internal static bool TryGetSafeBufferAndPointerOffset(object accessor, out SafeBuffer safeBuffer, out long offset)
29 {
30 MemoryMappedViewAccessor memoryMappedViewAccessor = (MemoryMappedViewAccessor)accessor;
31 safeBuffer = memoryMappedViewAccessor.SafeMemoryMappedViewHandle;
32 offset = memoryMappedViewAccessor.PointerOffset;
33 return true;
34 }
35}
virtual string Message
Definition Exception.cs:100
static MemoryMappedFile CreateFromFile(string path)
static IDisposable CreateMemoryMap(Stream stream)
static bool TryGetSafeBufferAndPointerOffset(object accessor, out SafeBuffer safeBuffer, out long offset)
static IDisposable CreateViewAccessor(object memoryMap, long start, int size)