示例#1
0
        internal void Hibernate(IMemoryFileController fileController, bool saveMemoryBackup = false)
        {
            fileController.WriteToFile(UniqueId, MyMemory, saveMemoryBackup);

            if (!fileController.FileExists(UniqueId))
            {
                throw new RnpcMemoryException(
                          $"An error has prevented memory file for character {MyName} with guid {UniqueId} from being written.");
            }
        }
示例#2
0
        internal void WakeUp(IMemoryFileController fileController, bool useMemoryBackupAsFailsafe = false)
        {
            var memory = fileController.ReadFromFile(UniqueId, useMemoryBackupAsFailsafe);

            if (memory == null)
            {
                throw new RnpcMemoryException("Memory file could not be loaded for character with guid" + UniqueId);
            }

            MyMemory = memory;
        }