Esempio n. 1
0
    IEnumerator RunUnZipFile()
    {
        yield return(new WaitForEndOfFrame());

        configLoading.SetDescribe(Core.Data.stringManager.getString(9028));
        configLoading.ShowLoading(0);
        string ConfigPath = System.IO.Path.Combine(DeviceInfo.PersistRootPath, "Config.zip");

        MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);

        string[] FileProperties = new string[2];
        //待解压的文件
        FileProperties[0] = ConfigPath;
        //解压后放置的目标目录
        FileProperties[1] = DeviceInfo.PersistRootPath;
        UnZipClass UnZc = new UnZipClass();

        UnZc.UnZip(FileProperties);

        yield return(new WaitForEndOfFrame());

        configLoading.ShowLoading(1);

        yield return(new WaitForEndOfFrame());

        configLoading.gameObject.SetActive(false);
        //解压完成以后读表
        readLocalConfig();
    }
Esempio n. 2
0
    //检查更新配表
    void checkConfig()
    {
                #if UNITY_ANDROID
        if (step == LoginStep.Download_ERROR || step == LoginStep.None || step == LoginStep.Prepare_Config)
        {
                #else
        if (step == LoginStep.Download_ERROR || step == LoginStep.None)
        {
                #endif
            MobilePhoneInfo PhoneInfo = Core.Data.extensionManager.iPhoneInfo;
            if (PhoneInfo != null)
            {
                /*
                 * Debug.Log("appCurName="+PhoneInfo.appCurName);
                 * Debug.Log("PhoneInfo="+PhoneInfo.appCurVersion);
                 * Debug.Log("appCurVersionNum="+PhoneInfo.appCurVersionNum);
                 * Debug.Log("deviceName="+PhoneInfo.deviceName);
                 * Debug.Log("identifierNumber="+PhoneInfo.identifierNumber);
                 * Debug.Log("phoneVersion="+PhoneInfo.phoneVersion);
                 * Debug.Log("phoneModel="+PhoneInfo.phoneModel);
                 * Debug.Log("userPhoneName="+PhoneInfo.userPhoneName);
                 * Debug.Log("localPhoneModel="+PhoneInfo.localPhoneModel);
                 * Debug.Log("appCurVersionNum="+PhoneInfo.appCurVersionNum);
                 */
            }

            //开始检测要不要下载
            step = LoginStep.CheckConfig_Start;

            //MD5  --> config.zip
            string ConfigMD5  = "";
            string ConfigPath = System.IO.Path.Combine(DeviceInfo.PersistRootPath, "Config.zip");
            if (System.IO.File.Exists(ConfigPath))
            {
                ConfigMD5 = MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);
            }

            ConsoleEx.DebugLog(" ZIPFILE Path= " + ConfigPath + " md5= " + ConfigMD5);

            CMSHttpTask task = new CMSHttpTask(ThreadType.MainThread, TaskResponse.Default_Response);
            task.AppendCommonParam(RequestType.UPDATE_RESOURCES, new CheckConfig((int)RequestType.UPDATE_RESOURCES, ConfigMD5, SoftwareInfo.VersionCode.ToString()), "http://114.215.183.29/gs/ms/index.php/configure/check");
            task.ErrorOccured   += HttpResp_Error;
            task.afterCompleted += HttpResp_UI;
            //then you should dispatch to a real handler
            task.DispatchToRealHandler();
        }
        else if (step == LoginStep.ReadConfig_OK)
        {
            readCompleted();
        }
    }
Esempio n. 3
0
        static void ZipMD5()
        {
            string ConfigPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Config.zip");
            //string ConfigPath = System.IO.Path.Combine(DeviceInfo.PersistRootPath,"Config.zip");
            string ConfigMD5 = MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);

            if (string.IsNullOrEmpty(ConfigMD5))
            {
                EditorUtility.DisplayDialog("Config.zip MD5", "can't find Config.zip", "OK");
            }
            else
            {
                EditorUtility.DisplayDialog("Config.zip MD5", ConfigMD5, "OK");
            }
        }
Esempio n. 4
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(400, 130, 100, 50), "ZipClass"))
        {
            string [] FileProperties = new string[2];
            //待压缩文件目录
            FileProperties[0] = @"/Users/jiangcheng/Desktop/ziptest";
            //压缩后的目标文件
            FileProperties[1] = @"/Users/jiangcheng/Desktop/a.zip";
            ZipClass Zc = new ZipClass();
            Zc.ZipFileMain(FileProperties);

            //Debug.Log(DeviceInfo.StreamingPath);
//			ZipClass Zc=new ZipClass();
//			Zc.ZipFile(@"/Users/jiangcheng/Desktop/ziptest",@"/Users/jiangcheng/Desktop/a.zip",6,2048);
        }

        if (GUI.Button(new Rect(400, 200, 100, 50), "UnZipClass"))
        {
            string ConfigPath = System.IO.Path.Combine(DeviceInfo.StreamingPath, "Config.zip");
            //string ConfigMD5 = MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);
            Debug.Log(Core.Data.guideManger.getBasePath());

            string [] FileProperties = new string[2];
            //待解压的文件
            FileProperties[0] = ConfigPath;
            //解压后放置的目标目录
            FileProperties[1] = Core.Data.guideManger.getBasePath();
            UnZipClass UnZc = new UnZipClass();
            UnZc.UnZip(FileProperties);
        }

        if (GUI.Button(new Rect(400, 270, 100, 50), "GetMD5"))
        {
            string ConfigPath = System.IO.Path.Combine(DeviceInfo.StreamingPath, "Config.zip");
            string ConfigMD5  = MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);
            Debug.Log(ConfigMD5);
        }

        if (GUI.Button(new Rect(400, 340, 100, 50), "DownLoad"))
        {
            string ConfigPath = System.IO.Path.Combine(DeviceInfo.StreamingPath, "Config.zip");
            string ConfigMD5  = MessageDigest_Algorithm.getFileMd5Hash(ConfigPath);
            test_DownloadResource(ConfigMD5);
        }
    }
Esempio n. 5
0
 //获取文件MD5码
 public static string GetMD5(string filePath)
 {
     return(MessageDigest_Algorithm.getFileMd5Hash(filePath));
 }