Пример #1
0
        public static GVASSave ReadGVASSave(IO io)
        {
            string header = io.ReadASCII(4);

            if (!header.Equals("GVAS"))
            {
                return(null);
            }
            Console.WriteLine("Header: {0}", header);
            int sgVersion = io.ReadInt32();

            Console.WriteLine("Save Game Version: {0}", sgVersion);
            int pkgVersion = io.ReadInt32();

            Console.WriteLine("Package version: {0}", pkgVersion);
            short major       = io.ReadInt16();
            short minor       = io.ReadInt16();
            short patch       = io.ReadInt16();
            uint  engineBuild = io.ReadUInt32();

            Console.WriteLine("Engine version: {0}.{1}.{2}.{3}", major, minor, patch, engineBuild);

            string buildId = ReadUEString(io);

            Console.WriteLine("Build ID: {0}", buildId);

            int fmtVersion = io.ReadInt32();

            Console.WriteLine("Custom Format Version: {0}", fmtVersion);
            int fmtCount = io.ReadInt32();

            Console.WriteLine("Custom Format Data Count: {0}", fmtCount);
            Dictionary <byte[], int> keyValuePairs = new Dictionary <byte[], int>();

            for (int i = 0; i < fmtCount; i++)
            {
                byte[] guid  = io.ReadBytes(16);
                int    entry = io.ReadInt32();
                keyValuePairs.Add(guid, entry);
            }

            string sgType = ReadUEString(io);

            Console.WriteLine("Save Game Type: {0}", sgType);
            GVASSave saveData = new GVASSave(sgVersion, pkgVersion, major, minor, patch, engineBuild, buildId, fmtVersion, fmtCount, keyValuePairs, sgType);

            return(saveData);
        }
Пример #2
0
 public static void WriteGVASSave(IO io, GVASSave saveData)
 {
     io.WriteASCII("GVAS");
     io.WriteInt32(saveData.sg);
     io.WriteInt32(saveData.pkg);
     io.WriteInt16(saveData.mj);
     io.WriteInt16(saveData.mn);
     io.WriteInt16(saveData.pa);
     io.WriteUInt32(saveData.eng);
     io.WriteUEString(saveData.build);
     io.WriteInt32(saveData.fmt);
     io.WriteInt32(saveData.fmtLength);
     foreach (KeyValuePair <byte[], int> entry in saveData.fmtData)
     {
         io.WriteBytes(entry.Key);
         io.WriteInt32(entry.Value);
     }
     io.WriteUEString(saveData.sgType);
 }