private LooseArchive(string dirPath)
        {
            _fileDict = new Dictionary<string, LooseArchiveEntry>(StringComparer.InvariantCultureIgnoreCase);
            _extDict = new Dictionary<string, List<string>>(StringComparer.InvariantCultureIgnoreCase);

            foreach (var file in Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)) {
                var ext = Path.GetExtension(file);

                if (!_sValidExtensions.Contains(ext)) continue;

                var entry = new LooseArchiveEntry(file);

                if (_fileDict.ContainsKey(entry.Name)) {
                    Debug.LogWarningFormat("Already loaded {0}", entry.Name);
                    continue;
                }

                _fileDict.Add(entry.Name, entry);

                if (ext == null) continue;

                if (!_extDict.ContainsKey(ext)) {
                    _extDict.Add(ext, new List<string>());
                }

                _extDict[ext].Add(entry.Name);
            }
        }
Esempio n. 2
0
        private LooseArchive(string dirPath)
        {
            Debug.Log("Loading loose archive: " + dirPath);

            _fileDict = new Dictionary <string, LooseArchiveEntry>(StringComparer.InvariantCultureIgnoreCase);
            _extDict  = new Dictionary <string, List <string> >(StringComparer.InvariantCultureIgnoreCase);

            foreach (var file in Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories))
            {
                var ext = Path.GetExtension(file);

                ext = ext.ToLower();

                if (!_sValidExtensions.Contains(ext))
                {
                    continue;
                }

                var entry = new LooseArchiveEntry(file);

                if (_fileDict.ContainsKey(entry.Name))
                {
                    Debug.LogWarningFormat("Already loaded {0}", entry.Name);
                    continue;
                }

                //Debug.Log ("Adding loose archive entry: " + entry.FilePath);

                _fileDict.Add(entry.Name, entry);

                if (ext == null)
                {
                    continue;
                }

                if (!_extDict.ContainsKey(ext))
                {
                    _extDict.Add(ext, new List <string>());
                }

                _extDict[ext].Add(entry.Name);
            }
        }