示例#1
0
        public static void DisplayFatalException(ExceptionSituation situation, Exception e, params object[] args)
        {
            // Only log once
            if (loggedExceptions.ContainsKey(e.StackTrace))
            {
                return;
            }

            switch (situation)
            {
            case ExceptionSituation.PARAMETER_SAVE:
                situationString = StringBuilderCache.Format("while saving contract parameter '{1}' in contract '{0}'", args);
                actionString    = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                break;

            case ExceptionSituation.PARAMETER_LOAD:
                situationString = StringBuilderCache.Format("while loading contract parameter '{1}' in contract '{0}'", args);
                actionString    = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                break;

            case ExceptionSituation.CONTRACT_GENERATION:
                situationString = StringBuilderCache.Format("while attempt to generate contract of type '{0}'", args);
                actionString    = "The contract failed to generate, and you may see additional exceptions";
                break;

            case ExceptionSituation.CONTRACT_SAVE:
                situationString = StringBuilderCache.Format("while saving contract '{0}'", args);
                actionString    = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                break;

            case ExceptionSituation.CONTRACT_LOAD:
                situationString = StringBuilderCache.Format("while loading contract '{0}'", args);
                actionString    = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                break;

            case ExceptionSituation.SCENARIO_MODULE_SAVE:
                situationString = StringBuilderCache.Format("while saving ScenarioModule '{0}'", args);
                actionString    = "The ScenarioModule data was not correctly saved - reloading the save may result in further errors.";
                break;

            case ExceptionSituation.SCENARIO_MODULE_LOAD:
                situationString = StringBuilderCache.Format("while loading ScenarioModule '{0}'", args);
                actionString    = "The ScenarioModule data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent save game data loss!";
                break;

            default:
                situationString = "while performing an unspecified operation";
                actionString    = null;
                break;
            }
            displayedException = e;
        }
        public static void DisplayFatalException(ExceptionSituation situation, Exception e, params object[] args)
        {
            // Only log once
            if (loggedExceptions.ContainsKey(e.StackTrace))
            {
                return;
            }

            switch(situation)
            {
                case ExceptionSituation.PARAMETER_SAVE:
                    situationString = String.Format("while saving contract parameter '{1}' in contract '{0}'", args);
                    actionString = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                    break;
                case ExceptionSituation.PARAMETER_LOAD:
                    situationString = String.Format("while loading contract parameter '{1}' in contract '{0}'", args);
                    actionString = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                    break;
                case ExceptionSituation.CONTRACT_GENERATION:
                    situationString = String.Format("while attempt to generate contract of type '{0}'", args);
                    actionString = "The contract failed to generate, and you may see additional exceptions";
                    break;
                case ExceptionSituation.CONTRACT_SAVE:
                    situationString = String.Format("while saving contract '{0}'", args);
                    actionString = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                    break;
                case ExceptionSituation.CONTRACT_LOAD:
                    situationString = String.Format("while loading contract '{0}'", args);
                    actionString = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                    break;
                case ExceptionSituation.SCENARIO_MODULE_SAVE:
                    situationString = String.Format("while saving ScenarioModule '{0}'", args);
                    actionString = "The ScenarioModule data was not correctly saved - reloading the save may result in further errors.";
                    break;
                case ExceptionSituation.SCENARIO_MODULE_LOAD:
                    situationString = String.Format("while loading ScenarioModule '{0}'", args);
                    actionString = "The ScenarioModule data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent save game data loss!";
                    break;
                default:
                    situationString = "while performing an unspecified operation";
                    actionString = null;
                    break;
            }
            displayedException = e;
        }
        public static void DisplayFatalException(ExceptionSituation situation, Exception e, params object[] args)
        {
            switch (situation)
            {
            case ExceptionSituation.PARAMETER_SAVE:
                situationString = String.Format("while saving contract parameter '{1}' in contract '{0}'", args);
                actionString    = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                break;

            case ExceptionSituation.PARAMETER_LOAD:
                situationString = String.Format("while loading contract parameter '{1}' in contract '{0}'", args);
                actionString    = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                break;

            case ExceptionSituation.CONTRACT_SAVE:
                situationString = String.Format("while saving contract contract '{0}'", args);
                actionString    = "The contract data was not correctly saved - reloading the save may result in further errors.  Best case - the contract in question is no longer valid.";
                break;

            case ExceptionSituation.CONTRACT_LOAD:
                situationString = String.Format("while loading contract contract '{0}'", args);
                actionString    = "The contract data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent contract loss!";
                break;

            case ExceptionSituation.SCENARIO_MODULE_SAVE:
                situationString = String.Format("while saving ScenarioModule '{0}'", args);
                actionString    = "The ScenarioModule data was not correctly saved - reloading the save may result in further errors.";
                break;

            case ExceptionSituation.SCENARIO_MODULE_LOAD:
                situationString = String.Format("while loading ScenarioModule '{0}'", args);
                actionString    = "The ScenarioModule data was not correctly loaded.  Avoid saving your game and backup your save file immediately if you wish to prevent save game data loss!";
                break;

            default:
                situationString = "while performing an unspecified operation";
                actionString    = null;
                break;
            }
            displayedException = e;
        }