Ejemplo n.º 1
0
        public static void HandleUpgrade()
        {
            var old = Filesystem.OldStateFile;

            if (File.Exists(old))
            {
                PersistentState state = new PersistentState(old);

                if (!state.HasEliteCmdrName())
                {
                    CheapHackController hack = new CheapHackController(
                        new EliteJournalParser(Filesystem.GuessJournalPath()),
                        state);
                    hack.Run();

                    if (!state.HasEliteCmdrName())
                    {
                        MessageBox.Show("Picard is exiting without saving.");
                        Application.Exit();
                        return;
                    }
                }

                state.StateFile = Filesystem.GetStatePath(
                    state.CurrentState.EliteCmdrName);
                state.Persist();
                File.Delete(old);
                MessageBox.Show("Your Picard state file has been upgraded.", "Multi-Commander Support!!");
            }
        }