예제 #1
0
        public void TestSfoWriteRead()
        {
            var sfo = new ParamSfo();

            sfo.SetValue("KEY1", SfoEntryType.Integer, "1234");
            sfo.SetValue("KEY2", SfoEntryType.Utf8, "This is the title", 32);
            sfo.SetValue("KEY3", SfoEntryType.Utf8Special, "This is a special string", 32);
            sfo.SetValue("KEY4", SfoEntryType.Integer, "0x1234");

            using (var ms = new MemoryStream())
            {
                sfo.Write(ms);
                ms.Seek(0, SeekOrigin.Begin);
                var sfo2 = ParamSfo.FromStream(ms);
                Assert.AreEqual((sfo2["KEY1"] as IntegerValue).Value, 1234);
                Assert.AreEqual((sfo2["KEY2"] as Utf8Value).Value, "This is the title");
                Assert.AreEqual((sfo2["KEY3"] as Utf8SpecialValue).Value, "This is a special string");
                Assert.AreEqual((sfo2["KEY4"] as IntegerValue).Value, 0x1234);
            }
        }
예제 #2
0
        public void TestSfoValueAddRemove()
        {
            var sfo = new ParamSfo();

            sfo.SetValue("TestKey", SfoEntryType.Integer, "1234");

            Assert.IsNotNull(sfo["TestKey"]);

            sfo["TestKey"] = null;
            Assert.IsNull(sfo["TestKey"]);
            Assert.AreEqual(0, sfo.Values.Count);
        }