Beispiel #1
0
        void IPersistable.Recover(IPersistableReader reader)
        {
            DeleteAll();

            var cnt = reader.ReadInt();

            for (var i = 0; i < cnt; i++)
            {
                var key = reader.ReadString();
                _boolDict[key] = reader.ReadBool();
            }

            cnt = reader.ReadInt();
            for (var i = 0; i < cnt; i++)
            {
                var key = reader.ReadString();
                _intDict[key] = reader.ReadInt();
            }

            cnt = reader.ReadInt();
            for (var i = 0; i < cnt; i++)
            {
                var key = reader.ReadString();
                _floatDict[key] = reader.ReadFloat();
            }

            cnt = reader.ReadInt();
            for (var i = 0; i < cnt; i++)
            {
                var key = reader.ReadString();
                _stringDict[key] = reader.ReadString();
            }
        }
Beispiel #2
0
 void ReadPrimitives(IPersistableReader reader)
 {
     Assert.AreEqual(reader.ReadString(), TestValues.aString);
     Assert.AreEqual(reader.ReadInt(), TestValues.aInt);
     Assert.AreEqual(reader.ReadUInt(), TestValues.aUint);
     Assert.AreEqual(reader.ReadFloat(), TestValues.aFloat);
     Assert.AreEqual(reader.ReadDouble(), TestValues.aDouble);
     Assert.AreEqual(reader.ReadBool(), TestValues.aBool);
 }
Beispiel #3
0
        public static string[] ReadStringArray(this IPersistableReader self)
        {
            var cnt = self.ReadInt();
            var arr = new string[cnt];

            for (var i = 0; i < cnt; i++)
            {
                arr[i] = self.ReadString();
            }
            return(arr);
        }
Beispiel #4
0
        public static WingData readWing(this IPersistableReader r)
        {
            var wd = new WingData();

            wd.uid       = r.ReadLong();
            wd.name      = r.ReadString();
            wd.wingClass = (Wing.WingClass)r.ReadInt();
            wd.energy    = r.ReadFloat();
            wd.ply       = r.readPersonality();
            wd.armed     = r.ReadBool();
            return(wd);
        }
Beispiel #5
0
        public static void ReadStringListInto(this IPersistableReader self, List <string> list, bool clearList = true)
        {
            if (clearList)
            {
                list.Clear();
            }

            var cnt = self.ReadInt();

            for (var i = 0; i < cnt; i++)
            {
                list.Add(self.ReadString());
            }
        }