Ejemplo n.º 1
0
        /// <summary>
        /// 一般0为Default
        /// </summary>
        /// <param name="tags"></param>
        /// <returns></returns>
        public FileMapSystemTagFindResultHelper FindFileByTags(params int[] tags)
        {
            var helper = FileMapSystemTagFindResultHelper.FindInfos(this, tags);

            return(helper);
        }
Ejemplo n.º 2
0
        public static FileMapSystemTagFindResultHelper FindInfos(FileMapSystem sys, int[] tags)
        {
            var res = new FileMapSystemTagFindResultHelper();

            res.SearchTags = tags;
            var dictDowned = new Dictionary <string, int>();
            var dictMiss   = new Dictionary <string, int>();

            foreach (var info in sys.FileInfo.AllFileMapInfo)
            {
                if (res.ContainsTag(info.FileTag))
                {
                    res.AllInfos.Add(info);
                    var mappedName = info.GetMappedFileName();
                    UnityFileLoaderHelper.eFileLoaderPosType pos;
                    if (UnityFileLoaderHelper.IsFileExist(sys.Dir, mappedName, out pos))
                    {
                        if (!dictDowned.ContainsKey(mappedName))
                        {
                            dictDowned[mappedName] = info.Len;
                        }
                        else
                        {
                            dictDowned[mappedName] = dictDowned[mappedName] + info.Len;
                        }
                    }
                    else
                    {
                        if (!dictMiss.ContainsKey(mappedName))
                        {
                            dictMiss[mappedName] = info.Len;
                        }
                        else
                        {
                            dictMiss[mappedName] = dictMiss[mappedName] + info.Len;
                        }
                    }
                }
            }

            foreach (var info in dictDowned)
            {
                var wd = new WWWFileDownloader.DownloadFileInfo()
                {
                    FileName = info.Key,
                    FileSize = info.Value
                };
                res.Downloaded.Add(wd);
                res.DownloadedSize += info.Value;
            }

            foreach (var info in dictMiss)
            {
                var wd = new WWWFileDownloader.DownloadFileInfo()
                {
                    FileName = info.Key,
                    FileSize = info.Value
                };
                res.Missed.Add(wd);
                res.MissedSize += info.Value;
            }

            return(res);
        }