示例#1
0
        private void _GetFileVersion(ref int version)
        {
            try
            {
                var fullPath = PathTools.GetExportPath(localPath);

                var fileInfo = new System.IO.FileInfo(fullPath);
                var key      = fileInfo.Length * fileInfo.CreationTime.ToFileTime();
                var bytes    = System.BitConverter.GetBytes(key);
                var md5      = Md5sum.Instance.GetAssetDigest(bytes);
                version = Convert.ToInt32(md5, 16);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("[ACacheItem._GetFileDigest] ex = {0}", ex.ToStringEx());
            }
        }
示例#2
0
        public MappingInfo GetMappingInfo(string localPath)
        {
            localPath = localPath ?? string.Empty;
            MappingInfo info;

            if (!_mappingDB.TryGetMappingInfo(localPath, out info) && os.isEditor)
            {
                var localPathWithDigest = localPath;
                var fullPath            = PathTools.GetExportPath(localPath);

                info = new MappingInfo()
                {
                    localPath             = localPath
                    , localPathWithDigest = localPathWithDigest
                    , selfSize            = os.path.getsize(fullPath)
                    , totalSize           = 0
                    , loadType            = LoadType.Disk
                };

                _mappingDB.AddToDB(localPath, info);
            }

            return(info);
        }