Exemplo n.º 1
0
        private void RefreshAssetList()
        {
            _assetList.Clear();
            foreach (var path in _assetFolderList)
            {
                string key      = XPathTools.SubRelativePath(_assetFolderPath, path);
                string fileName = Path.GetFileName(path);
                if (_configDict != null)
                {
                    if (_configDict.ContainsKey(key))
                    {
                        continue;
                    }
                }

                string searchKey = _srcSearchTextField.GetText();
                if (!string.IsNullOrEmpty(searchKey))
                {
                    if (fileName.IndexOf(searchKey) < 0)
                    {
                        continue;
                    }
                }
                var item = new AssetItem();
                item.path = path;
                _assetList.Add(item);
            }
        }
Exemplo n.º 2
0
        private Dictionary <string, Item> _dictByMd5;  //字典

        public AssetUpdateAssetList Scan(string assetFolder)
        {
            if (string.IsNullOrEmpty(assetFolder))
            {
                return(this);
            }

            var assetFolderLow = assetFolder.ToLower();
            var fileList       = new List <Item>();

            XFolderTools.TraverseFiles(assetFolder, (fullPath) =>
            {
                var assetPath = XPathTools.GetRelativePath(fullPath);
                var relaPath  = XPathTools.SubRelativePath(assetFolder, assetPath);

                var updateItem      = new Item();
                updateItem.filePath = relaPath.ToLower();
                updateItem.fileMd5  = XFileTools.GetMD5(assetPath);
                updateItem.fileSize = XFileTools.GetLength(assetPath);

                fileList.Add(updateItem);
            }, true);

            path      = assetFolder;
            fileItems = fileList.ToArray();
            return(this);
        }
Exemplo n.º 3
0
        private void AddConfig(string fullPath)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                return;
            }

            string relaPath = XPathTools.SubRelativePath(_assetFolderPath, fullPath);

            _configDict = _configDict ?? new Dictionary <string, ConfigItem>();
            ConfigItem newItem = new ConfigItem();

            newItem.path = relaPath;

            _configDict[relaPath] = newItem;
        }