Exemplo n.º 1
0
        internal static void Init()
        {
            Game.LogTrivialDebug($"[Spotlight.PluginState] Init from '{System.AppDomain.CurrentDomain.FriendlyName}'");
            Game.LogTrivialDebug($"[Spotlight.PluginState] sizeof(PluginStateData) = '{sizeof(PluginStateData)}'");

            mappedFile         = MemoryMappedFile.CreateOrOpen(MappedFileName, sizeof(PluginStateData));
            mappedFileAccessor = mappedFile.CreateViewAccessor(0, sizeof(PluginStateData));
            byte *ptr = null;

            mappedFileAccessor.SafeMemoryMappedViewHandle.AcquirePointer(ref ptr);

            data = (PluginStateData *)ptr;
        }
Exemplo n.º 2
0
        internal static void Shutdown()
        {
            Game.LogTrivialDebug($"[Spotlight.PluginState] Shutdown from '{System.AppDomain.CurrentDomain.FriendlyName}'");

            if (mappedFileAccessor != null)
            {
                data = null;
                mappedFileAccessor.SafeMemoryMappedViewHandle.ReleasePointer();
                mappedFileAccessor.Dispose();
            }

            if (mappedFile != null)
            {
                mappedFile.Dispose();
            }
        }