示例#1
0
        public void TestLoadOldProtobuf1CompiledScript()
        {
            CompiledScript cs;

            using (var file = System.IO.File.OpenRead("StateTests\\v1script.plx"))
            {
                SerializedScript deser = ProtoBuf.Serializer.Deserialize <SerializedScript>(file);
                cs = deser.ToCompiledScript();
            }

            Assert.AreEqual(cs.AssetId, UUID.Parse("e6225f55-5051-4949-95a4-688e86dec5e5"));
        }
示例#2
0
        private static void SaveScript(CompiledScript script)
        {
            SerializedScript serScript = SerializedScript.FromCompiledScript(script);

            using (var file = File.Create("script.plx"))
            {
                ProtoBuf.Serializer.Serialize(file, serScript);
            }

            using (var file = File.OpenRead("script.plx"))
            {
                SerializedScript readscript = ProtoBuf.Serializer.Deserialize <SerializedScript>(file);
                CompiledScript   compiled   = readscript.ToCompiledScript();
            }
        }