Exemplo n.º 1
0
        // Hook location : OS.loadSaveFile()
        public static bool onLoadSaveFile(OS self, ref Stream stream, ref XmlReader xmlReader)
        {
            var loadSaveFileEvent = new Event.OSLoadSaveFileEvent(self, xmlReader, stream);

            loadSaveFileEvent.CallEvent();
            if (loadSaveFileEvent.IsCancelled)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public static bool onLoadSaveFile(OS self, ref Stream stream)
        {
            /* TODO: Refactor that null out */
            var loadSaveFileEvent = new Event.OSLoadSaveFileEvent(self, null, stream);
            var exceptions        = loadSaveFileEvent.CallEvent();

            if (exceptions.Count > 0)
            {
                MainMenu.AccumErrors = $"Cannot load account {self.SaveGameUserName}: \n";
                foreach (var except in exceptions)
                {
                    MainMenu.AccumErrors += $"{except.Key} threw: ${except.Value}\n";
                }
                /* let Hacknet have an exception */
                throw new FormatException("Pathfinder modifications caused account to fail loading.");
            }
            if (loadSaveFileEvent.IsCancelled)
            {
                return(true);
            }
            return(false);
        }