Пример #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());
    }
Пример #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());
        }
    }