コード例 #1
0
ファイル: UpdateManager.cs プロジェクト: 10gsxu/ABFramework
    IEnumerator CheckResourceFile()
    {
        WWW www = new WWW(UpdateConfig.Instance.serverUrl + resourceFile);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.Log(www.error);
            EndUpdateResource();
            yield break;
        }
        remoteResult       = www.text;
        remoteResourceData = new ResourceData();
        remoteResourceData.InitData(remoteResult);
        localResourceData = new ResourceData();
        localResourceData.InitDataFromFile(PathTools.DataPath + resourceFile);

        downloadList.Clear();
        int dataRow = remoteResourceData.GetDataRow();

        for (int i = 1; i <= dataRow; ++i)
        {
            string bundleName = remoteResourceData.GetBundleName(i);
            string remoteMd5  = remoteResourceData.GetMd5(i);
            string localMd5   = localResourceData.GetMd5ByBundleName(bundleName);
            //Debug.Log(remoteMd5 + " : " + localMd5);
            if (remoteMd5.CompareTo(localMd5) != 0)
            {
                downloadList.Add(bundleName);
            }
        }

        downloadFileIndex  = 0;
        downloadRetryCount = 0;
        totalFileCount     = downloadList.Count;
        finishFileSize     = 0;
        GetTotalFileSize();
        DownloadNextFile();
    }