コード例 #1
0
ファイル: DLCTests.cs プロジェクト: hochladen/Hacknet
        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);
        }
コード例 #2
0
ファイル: DLCTests.cs プロジェクト: hochladen/Hacknet
        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);
        }