Esempio n. 1
0
        void CompareMD5List(LinkedList <FileMD5Vo> updateFiles, out float fileSize, Dictionary <string, FileMD5Vo> local, Dictionary <string, FileMD5Vo> remote)
        {
            int size = 0;

            foreach (var kvp in remote)
            {
                var       remoteVo   = kvp.Value;
                var       bundleName = remoteVo.path;
                FileMD5Vo localVo;

                if (local.TryGetValue(bundleName, out localVo) == false || remoteVo.md5 != localVo.md5)
                {
                    if (bundleName.IndexOf("platform") != 0)
                    {
                        size += remoteVo.size;
                        updateFiles.AddLast(remoteVo);
                    }
                }
            }

            FileMD5Vo bundleInfo = new FileMD5Vo();

            bundleInfo.path = mBundlesInfoPath;
            updateFiles.AddFirst(bundleInfo);

            var config = remote[mPlatformConfigPath];

            size += config.size;
            updateFiles.AddFirst(config);

            Debug.Log("mTotalFileSize:" + size / (1024 * 1024));

            fileSize = size;
        }
Esempio n. 2
0
        Dictionary <string, FileMD5Vo> ParseMD5Text(string text)
        {
            Dictionary <string, FileMD5Vo> dic = new Dictionary <string, FileMD5Vo>();
            var lineList = text.Split('\n');

            foreach (var line in lineList)
            {
                if (line.Length <= 0)
                {
                    continue;
                }

                var       infoList = line.Split(',');
                FileMD5Vo vo       = new FileMD5Vo();
                vo.path = infoList[0];
                vo.md5  = infoList[1];
                vo.size = int.Parse(infoList[2]);

                dic[vo.path] = vo;
            }
            return(dic);
        }