Ejemplo n.º 1
0
        public static string TestMemorySerialization(ScreenManager screenMan, out int errorsAdded)
        {
            int    errors = 0;
            string ret    = "";

            string[] wildcardUpgradeServerIDs = new string[3] {
                "polarSnakeDest", "naixGateway", "BitWorkServer"
            };
            DLCTests.TestComputersForLoad(screenMan, (Action <Computer, Computer>)((old, current) =>
            {
                if ((old.Memory != null && current.Memory == null || old.Memory == null && current.Memory != null) && !((IEnumerable <string>)wildcardUpgradeServerIDs).Contains <string>(old.idName))
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\n\r\nMemory serialization error: old and current null mismatch";
                }
                if (old.Memory == null || current.Memory == null)
                {
                    return;
                }
                string str = old.Memory.TestEqualsWithErrorReport(current.Memory);
                if (str.Length > 0)
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += str;
                }
            }));
            errorsAdded = errors;
            return(ret);
        }
Ejemplo n.º 2
0
 internal static void TestComputersForLoad(ScreenManager screenMan, Action <Computer, Computer> CompareComputerAfterLoad)
 {
     DLCTests.SetupTestingEnvironment(screenMan, (Action <OS, List <Computer> >)((os, oldComps) =>
     {
         for (int index = 0; index < oldComps.Count; ++index)
         {
             Computer oldComp  = oldComps[index];
             Computer computer = Programs.getComputer(os, oldComp.ip);
             CompareComputerAfterLoad(oldComp, computer);
         }
     }));
 }
Ejemplo n.º 3
0
 private static void CheckAllFiles(Folder f, Action <FileEntry> act)
 {
     for (int index = 0; index < f.files.Count; ++index)
     {
         if (act != null)
         {
             act(f.files[index]);
         }
     }
     for (int index = 0; index < f.folders.Count; ++index)
     {
         DLCTests.CheckAllFiles(f.folders[index], act);
     }
 }
Ejemplo n.º 4
0
        public static string TestDLCFunctionality(ScreenManager screenMan, out int errorsAdded)
        {
            string str1         = "";
            int    errorsAdded1 = 0;
            bool   enableDlc    = Settings.EnableDLC;

            Settings.EnableDLC = true;
            string str2 = str1 + DLCTests.TestCustomPortMapping(screenMan, out errorsAdded1) + DLCTests.TestCustomPortMappingOnLoadedComputer(screenMan, out errorsAdded1) + DLCTests.TestMemorySerialization(screenMan, out errorsAdded1) + DLCTests.TestMemoryOnLoadedComputer(screenMan, out errorsAdded1) + DLCTests.TestMemoryInjectionOnLoadedComputer(screenMan, out errorsAdded1) + DLCTests.TestDLCProgression(screenMan, out errorsAdded1) + DLCTests.TestDLCPasswordsCorrect(screenMan, out errorsAdded1) + DLCTests.TestDLCMiscFilesCorrect(screenMan, out errorsAdded1);

            Settings.EnableDLC = enableDlc;
            string str3 = str2 + (str2.Length > 10 ? (object)"\r\n" : (object)" ") + "Complete - " + (object)errorsAdded1 + " errors found";

            errorsAdded = errorsAdded1;
            return(str3);
        }
Ejemplo n.º 5
0
        public static string TestCustomPortMapping(ScreenManager screenMan, out int errorsAdded)
        {
            int    errors = 0;
            string ret    = "";

            DLCTests.TestComputersForLoad(screenMan, (Action <Computer, Computer>)((old, current) =>
            {
                if (old.PortRemapping == null && current.PortRemapping != null || old.PortRemapping != null && current.PortRemapping == null)
                {
                    ++errors;
                    // ISSUE: variable of a compiler-generated type
                    DLCTests.\u003C\u003Ec__DisplayClass1 cDisplayClass1 = this;
                    // ISSUE: reference to a compiler-generated field
                    string str = cDisplayClass1.ret + "\r\nPort Remapping Failed to load on computer " + current.name;
                    // ISSUE: reference to a compiler-generated field
                    cDisplayClass1.ret = str;
                }
                if (old.PortRemapping == null || current.PortRemapping == null)
                {
                    return;
                }
                foreach (KeyValuePair <int, int> keyValuePair in current.PortRemapping)
                {
                    if (!old.PortRemapping.ContainsKey(keyValuePair.Key))
                    {
                        ++errors;
                        // ISSUE: variable of a compiler-generated type
                        DLCTests.\u003C\u003Ec__DisplayClass1 cDisplayClass1 = this;
                        // ISSUE: reference to a compiler-generated field
                        string str = cDisplayClass1.ret + "\r\n\r\nPort remapping save error on Computer " + current.name + "\r\n" + (object)keyValuePair.Key + " : " + (object)keyValuePair.Value + " has no corresponding value";
                        // ISSUE: reference to a compiler-generated field
                        cDisplayClass1.ret = str;
                    }
                    else if (old.PortRemapping[keyValuePair.Key] != keyValuePair.Value)
                    {
                        ++errors;
                        // ISSUE: variable of a compiler-generated type
                        DLCTests.\u003C\u003Ec__DisplayClass1 cDisplayClass1 = this;
                        // ISSUE: reference to a compiler-generated field
                        string str = cDisplayClass1.ret + "\r\n\r\nPort remapping save error on Computer " + current.name + "\r\nKey " + (object)keyValuePair.Key + " : Current: " + (object)keyValuePair.Value + " Old: " + (object)old.PortRemapping[keyValuePair.Key];
                        // ISSUE: reference to a compiler-generated field
                        cDisplayClass1.ret = str;
                    }
                }
            }));
            errorsAdded = errors;
            return(ret);
        }
Ejemplo n.º 6
0
        public static string TestDLCPasswordsCorrect(ScreenManager screenMan, out int errorsAdded)
        {
            int    num = 0;
            string ret = "";

            DLCTests.SetupTestingEnvironment(screenMan, (Action <OS, List <Computer> >)((os, comps) =>
            {
                // ISSUE: reference to a compiler-generated field
                this.ret += DLCTests.TestPassword(os, "ds4_grave", "fma93dK");
                // ISSUE: reference to a compiler-generated field
                this.ret += DLCTests.TestPassword(os, "dpae_psy_1", "catsarebestpet");
                // ISSUE: reference to a compiler-generated field
                this.ret += DLCTests.TestPassword(os, "dpa_psylance", "1185JACK");
            }));
            errorsAdded = num;
            return(ret);
        }
Ejemplo n.º 7
0
        private static string LoadAndTestOS(ScreenManager screenMan, out int errorsAdded)
        {
            int    errorCount = 0;
            string str1       = "";
            string username   = "******";
            string pass       = "******";

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

            OS.TestingPassOnly = true;
            OS os1 = new OS();

            os1.SaveGameUserName    = fileNameForUsername;
            os1.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os1, new PlayerIndex?(screenMan.controllingPlayer));
            SessionAccelerator.AccelerateSessionToDLCEND((object)os1);
            os1.PreDLCVisibleNodesCache = "123,456,789";
            os1.delayer.RunAllDelayedActions();
            os1.threadedSaveExecute(false);
            List <Computer> nodes = 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;
            if (os2.PreDLCVisibleNodesCache != "123,456,789")
            {
                ++errorCount;
                str1 += "PreDLC Visible Node Cache not saving correctly";
            }
            screenMan.RemoveScreen((GameScreen)os2);
            string str2 = str1 + TestSuite.getTestingReportForLoadComparison((object)os2, nodes, errorCount, out errorCount) + "\r\n" + TestSuite.TestMissions((object)os2);
            string str3 = DLCTests.TestDLCFunctionality(screenMan, out errorsAdded);
            string str4 = str2 + (str3.Length > 30 ? "\r\n" + str3 : "");

            errorsAdded = errorCount;
            return(str4);
        }
Ejemplo n.º 8
0
        private static string TestPassword(OS os, string compID, string passToFind)
        {
            Computer computer = Programs.getComputer(os, compID);

            if (computer == null)
            {
                return("\r\nComputer " + compID + " Not found when searching for password " + passToFind + "\r\n");
            }
            bool hasPass = false;

            DLCTests.CheckAllFiles(computer.files.root, (Action <FileEntry>)(f =>
            {
                if (!f.data.Contains(passToFind))
                {
                    return;
                }
                hasPass = true;
            }));
            if (hasPass)
            {
                return("");
            }
            return("\r\nComputer " + compID + " (" + computer.name + ") Does not contain necessary password: "******"\r\n");
        }
Ejemplo n.º 9
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));
        }
Ejemplo n.º 10
0
        public static string TestDLCProgression(ScreenManager screenMan, out int errorsAdded)
        {
            int    errors = 0;
            string ret    = "";

            DLCTests.SetupTestingEnvironment(screenMan, (Action <OS, List <Computer> >)((os, comps) =>
            {
                Console.WriteLine("Testing DLC Progression in " + Settings.ActiveLocale);
                SessionAccelerator.AccelerateSessionToDLCEND((object)os);
                if (Programs.getComputer(os, "dhsDrop").files.root.searchForFolder("home").searchForFile("p_SQL_399.gz") == null)
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nExpo Grave Mission files not copied over to drop server! Mission Incompletable.";
                }
                if (!Programs.getComputer(os, "ds4_expo").ports.Contains(21))
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nExpo Grave Website does not have port 21 added! Mission Incompletable.";
                }
                Folder folder = Programs.getComputer(os, "ds3_mail").files.root.searchForFolder("mail").searchForFolder("accounts").searchForFolder("cornch1p");
                if (folder == null)
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nMagma Mailbox server for It Follows (set3) does not have account! in file, replace kburnaby with cornch1p to fix.";
                }
                else if (folder.searchForFolder("inbox").files.Count <= 0)
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nMagma Mailbox server for It Follows (set3) does not have emails! in file, replace kburnaby with cornch1p to fix.";
                }
                CustomFaction fromFile = CustomFaction.ParseFromFile("Content/DLC/DLCFaction.xml");
                if (fromFile.idName != "Bibliotheque")
                {
                    ++errors;
                    // ISSUE: variable of a compiler-generated type
                    DLCTests.\u003C\u003Ec__DisplayClass7 cDisplayClass7 = this;
                    // ISSUE: reference to a compiler-generated field
                    string str = cDisplayClass7.ret + "\r\nHub Faction ID Name is wrong: " + fromFile.idName;
                    // ISSUE: reference to a compiler-generated field
                    cDisplayClass7.ret = str;
                }
                CustomFactionAction customAction = fromFile.CustomActions[6];
                for (int index = 0; index < customAction.TriggerActions.Count; ++index)
                {
                    SAAddConditionalActions triggerAction = customAction.TriggerActions[index] as SAAddConditionalActions;
                    if (triggerAction != null && triggerAction.Filepath.Contains("PetsAcceptedActions"))
                    {
                        ++errors;
                        // ISSUE: reference to a compiler-generated field
                        this.ret += "\r\nHub Faction (stage 7) contains PetsAcceptedActions.xml loader - it should be only on the mission itself! Remove it!";
                    }
                }
                if (Programs.getComputer(os, "dPets_MF").name.ToLower().Contains("digipets"))
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nNeopals server rename from DigiPets is not complete in this version! Fix it! Remember to do foldernames too.\r\n";
                }
                bool flag         = false;
                Computer computer = Programs.getComputer(os, "dMF_1_Misc");
                for (int index = 0; index < computer.users.Count; ++index)
                {
                    if (computer.users[index].name == "listen" && computer.users[index].pass == "4TL4S")
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nAtlas server (MemForensics/Atlas) needs user listen w. pass 4TL4S\r\n";
                }
                if (((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Neopals/PetsMission1.xml")).email.body.Contains("DigiPoints"))
                {
                    ++errors;
                    // ISSUE: reference to a compiler-generated field
                    this.ret += "\r\nNeopals missions references DigiPoints, where it should be NeoPoints! Remember to check the goals field!\r\n";
                }
                if (Programs.getComputer(os, "dhsDrop").admin == null)
                {
                    return;
                }
                ++errors;
                // ISSUE: reference to a compiler-generated field
                this.ret += "\r\nDLC Drop server has an admin - remove it with type=none. This stops the player being auto logged out.\r\n";
            }));
            errorsAdded = errors;
            return(ret);
        }