Exemple #1
0
 void OnGUI()
 {
     sourePath = GUILayout.TextField(sourePath, GUILayout.Width(1000), GUILayout.Height(50));
     if (GUILayout.Button("压缩zip"))
     {
         ZIPTool.CompressDirectory(sourePath, outPath);
     }
     if (GUILayout.Button("解压zip"))
     {
         ZIPTool.DecompressToDirectory(sourePath, outPath);
     }
 }
Exemple #2
0
    static void VersionsDifferenceZipImp(string oldVersionDir, string newVersionDir)
    {
        oldVersionDir = MyFileUtil.DealFilePathSlash(oldVersionDir);
        newVersionDir = MyFileUtil.DealFilePathSlash(newVersionDir);

        List <string> oldFileList = new List <string>();
        List <string> newFileList = new List <string>();

        MyFileUtil.GetFileList(oldVersionDir, ref oldFileList);
        MyFileUtil.GetFileList(newVersionDir, ref newFileList);

        List <string> modificationFileList = new List <string>();

        foreach (string newFilePath in newFileList)
        {
            int index = oldFileList.IndexOf(newFilePath);
            if (index < 0)
            {
                //添加新的文件
                modificationFileList.Add(newFilePath);
            }
            else
            {
                string oldFilePath = oldFileList[index];
                if (MD5Tool.VerifyFile(newFilePath, oldFilePath) == false)
                {
                    //文件改变
                    modificationFileList.Add(newFilePath);
                }
            }
        }

        //string time = System.DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");

        string modificationDir = MyFileUtil.GetParentDir(newVersionDir) + "update_tmp";

        MyFileUtil.DeleteDir(modificationDir);
        MyFileUtil.CreateDir(modificationDir);

        foreach (string filePath in modificationFileList)
        {
            string newFilePath = filePath.Replace(newVersionDir, modificationDir);
            MyFileUtil.CopyFile(filePath, newFilePath);
        }

        string zipFilePath = modificationDir + ".zip";

        ZIPTool.CompressDirectory(modificationDir, zipFilePath, 0, false);

        Debug.Log("");
    }
Exemple #3
0
 static void CompressDirectoryTest()
 {
     ZIPTool.CompressDirectory(Application.dataPath + @"/Tools/ZIPTool/ziptest/zip.txt", Application.persistentDataPath + @"/txttest.zip");
 }