Beispiel #1
0
    public static void UnZipScene()
    {
        string text  = SceneZip.unZipPath + "/Scene.bytes";
        int    count = SceneZip.sceneZipReader.ReadInt32();

        byte[]       array        = SceneZip.sceneZipReader.ReadBytes(count);
        MemoryStream memoryStream = new MemoryStream();

        memoryStream.Write(array, 0, array.Length);
        memoryStream.Position = 0L;
        MemoryStream memoryStream2 = new MemoryStream();

        StreamZip.Unzip(memoryStream, memoryStream2);
        string dirName = text.Substring(0, text.LastIndexOf("/"));

        if (!QFileUtils.ExistsDir(dirName))
        {
            QFileUtils.CreateDir(dirName);
        }
        if (!QFileUtils.Exists(text))
        {
            QFileUtils.CreateFile(text);
        }
        QFileUtils.WriteBytes(text, memoryStream2.ToArray());
    }
Beispiel #2
0
    public static void MultiUnzip(byte[] zipbytes, string dir)
    {
        BinaryReader binaryReader = new BinaryReader(new MemoryStream(zipbytes));

        while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
        {
            string       str          = binaryReader.ReadString();
            int          count        = binaryReader.ReadInt32();
            byte[]       array        = binaryReader.ReadBytes(count);
            MemoryStream memoryStream = new MemoryStream();
            memoryStream.Write(array, 0, array.Length);
            memoryStream.Position = 0L;
            MemoryStream memoryStream2 = new MemoryStream();
            StreamZip.Unzip(memoryStream, memoryStream2);
            if (!QFileUtils.ExistsDir(dir))
            {
                QFileUtils.CreateDir(dir);
            }
            string fileName = dir + "//" + str;
            if (!QFileUtils.Exists(fileName))
            {
                QFileUtils.CreateFile(fileName);
            }
            QFileUtils.WriteBytes(fileName, memoryStream2.ToArray());
        }
    }
Beispiel #3
0
 public static void Zip(string scenePath, string zipfilePath)
 {
     SceneZip.zipPath        = scenePath;
     SceneZip.sceneZipStream = new MemoryStream();
     SceneZip.sceneZipWriter = new BinaryWriter(SceneZip.sceneZipStream);
     SceneZip.ZipScene();
     SceneZip.ZipLightmap();
     for (int i = SceneZip.startRegX; i <= SceneZip.endRegX; i++)
     {
         for (int j = SceneZip.startRegY; j <= SceneZip.endRegY; j++)
         {
             SceneZip.ZipRegion(i, j);
         }
     }
     if (!QFileUtils.Exists(zipfilePath))
     {
         QFileUtils.CreateFile(zipfilePath);
     }
     QFileUtils.WriteBytes(zipfilePath, SceneZip.sceneZipStream.ToArray());
 }