Beispiel #1
0
        public static string TestDLCLocalizations(ScreenManager screenMan, out int errorsAdded)
        {
            string str1         = "\r\n[";
            int    num          = 0;
            string activeLocale = Settings.ActiveLocale;

            for (int index = 0; index < LocaleActivator.SupportedLanguages.Count; ++index)
            {
                LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[index].Code, Game1.getSingleton().Content);
                int    errorsAdded1 = 0;
                string str2         = DLCLocalizationTests.LoadAndTestOS(screenMan, out errorsAdded1);
                num += errorsAdded1;
                string str3 = str2.Replace(".", "").Trim();
                if (string.IsNullOrWhiteSpace(str3))
                {
                    str1 += "==";
                }
                else
                {
                    str1 = str1 + "\r\n -- " + LocaleActivator.SupportedLanguages[index].Name + ": " + (string.IsNullOrWhiteSpace(str3) ? "Complete\r\n\r\n" : "\r\n" + str3 + "\r\n\r\n");
                }
            }
            LocaleActivator.ActivateLocale(activeLocale, Game1.getSingleton().Content);
            string str4 = str1 + "]\r\nComplete - " + (object)num + " load stopping errors found";

            errorsAdded = num;
            return(str4);
        }
Beispiel #2
0
        public static string TestSaveLoadOnFile(ScreenManager screenMan, bool IsQuicktestMode = false)
        {
            string username = "******";
            string pass     = "******";

            SaveFileManager.AddUser(username, pass);
            string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username);

            OS.TestingPassOnly = true;
            string str1 = "";
            OS     os1  = new OS();

            os1.SaveGameUserName    = fileNameForUsername;
            os1.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os1, new PlayerIndex?(screenMan.controllingPlayer));
            os1.delayer.RunAllDelayedActions();
            os1.threadedSaveExecute(false);
            List <Computer> nodes1 = os1.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os1);
            OS.WillLoadSave = true;
            OS os2 = new OS();

            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os2, new PlayerIndex?(screenMan.controllingPlayer));
            os2.delayer.RunAllDelayedActions();
            Game1.getSingleton().IsMouseVisible = true;
            string str2 = "Serialization and Integrity Test Report:\r\n";

            Console.WriteLine(str2);
            string        str3        = str1 + str2;
            List <string> stringList1 = new List <string>();
            List <string> stringList2 = new List <string>();
            int           errorCount  = 0;
            string        str4        = str3 + TestSuite.getTestingReportForLoadComparison((object)os2, nodes1, errorCount, out errorCount) + "\r\n" + TestSuite.TestMissions((object)os2);
            int           errorsOut   = 0;
            string        str5        = str4 + TestSuite.TestGameProgression((object)os2, out errorsOut);
            int           num         = errorCount + errorsOut;

            for (int index = 0; index < os2.netMap.nodes.Count; ++index)
            {
                TestSuite.DeleteAllFilesRecursivley(os2.netMap.nodes[index].files.root);
            }
            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            os2.threadedSaveExecute(false);
            List <Computer> nodes2 = os2.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os2);
            OS.WillLoadSave = true;
            OS os3 = new OS();

            os3.SaveGameUserName    = fileNameForUsername;
            os3.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os3, new PlayerIndex?(screenMan.controllingPlayer));
            screenMan.RemoveScreen((GameScreen)os3);
            OS.TestingPassOnly = false;
            SaveFileManager.DeleteUser(username);
            int errorsAdded = 0;

            if (!IsQuicktestMode)
            {
                str5 = str5 + "\r\nLocalization Tests: " + LocalizationTests.TestLocalizations(screenMan, out errorsAdded) + "\r\nDLC Localization Tests: " + DLCLocalizationTests.TestDLCLocalizations(screenMan, out errorsAdded);
            }
            string str6 = str5 + "\r\nDLC Tests: " + DLCTests.TestDLCFunctionality(screenMan, out errorsAdded) + "\r\nDLC Extended Tests: " + DLCExtendedTests.TesExtendedFunctionality(screenMan, out errorsAdded) + "\r\nEDU Edition Tests: " + EduEditionTests.TestEDUFunctionality(screenMan, out errorsAdded) + "\r\nMisc Tests: " + TestSuite.TestMiscAndCLRFeatures(screenMan, out errorsAdded);
            string str7 = "\r\nCore Tests: Complete - " + (object)num + " errors found.\r\nTested " + (object)nodes2.Count + " generated nodes vs " + (object)os3.netMap.nodes.Count + " loaded nodes";
            string str8 = str6 + str7;

            Console.WriteLine(str7);
            MusicManager.stop();
            try
            {
                string str9 = "testreport.txt";
                File.Delete(str9);
                Utils.writeToFile(str8, str9);
            }
            catch (Exception ex)
            {
            }
            return(Utils.CleanStringToRenderable(str8));
        }