Пример #1
0
    private bool UnCommonZip(string path)
    {
        //Debuger.LogError ("zys UnCommonZip fun");
        //		string spriteDir = Application.persistentDataPath + "/Data";
        if (!File.Exists(path))
        {
            Debuger.LogError("zys error zip null");
            return(true);
        }
        try
        {
            //Debuger.LogError ("zys start lzmu unCompose ==  "+ path);
            string assetbundlePath = Application.persistentDataPath + "/Data";
            string outFilePath     = Application.persistentDataPath + "";
            bool   isOk            = LzmaTools.DecompressLzma(assetbundlePath, "Data." + LzmaTools.zipName, outFilePath);

#if UNITY_EDITOR
#else
            if (File.Exists(path))
            {
                File.Delete(path);
            }
#endif
        }
        catch (System.Exception e)
        {
            Debuger.LogError("unZIp  error " + e);

            return(false);
        }

        return(true);
    }
Пример #2
0
    /// <summary>
    /// decompress lzma file
    /// </summary>
    private static void DecompressLzma()
    {
        string assetbundlePath = Application.streamingAssetsPath + "/Data";
        string tarPath         = Application.streamingAssetsPath + "";

        string destFolderPath = assetbundlePath + "/Data." + LzmaTools.zipName;
        string saveZipPath    = Application.persistentDataPath + "/Data/Data." + LzmaTools.zipName;

                #if UNITY_STANDALONE_WIN || UNITY_EDITOR
        if (!Directory.Exists(Application.persistentDataPath + "/Data"))
        {
            Directory.CreateDirectory(Application.persistentDataPath + "/Data");
        }
        if (File.Exists(saveZipPath))
        {
            File.Delete(saveZipPath);
        }
        File.Copy(destFolderPath, saveZipPath, true);
//		yield return null;
//		#else
//		Debuger.LogError ("zys  start  CopZIPFile "+ destFolderPath);
//		WWW www = new WWW(destFolderPath);
////		yield return www;
//
//		FileStream oneZip = File.Create (saveZipPath);
//
//		oneZip.Write (www.bytes, 0, www.bytes.Length);
//		oneZip.Close ();
//		Debuger.LogError ("zys  get  CopZIPFile");
                #endif


        LzmaTools.DecompressLzma(Application.persistentDataPath + "/Data", "Data." + LzmaTools.zipName, tarPath);
        Debug.Log("success  Decompress");
    }