Ejemplo n.º 1
0
        public SkinPack GetFiles(string rootPath, bool allowMultiple = false)
        {
            var reader   = _reader;
            var files    = new SkinPack();
            var pakFiles = GetAllPakFiles(rootPath);

            foreach (var file in pakFiles)
            {
                var relPath = Path.GetRelativePath(rootPath, file.FullName);
                // _logger.LogTrace($"FileService reading {relPath}");
                var useMultiple = allowMultiple || file.Name.Contains("MULTI");
                var readOpts    = new PakReaderOptions {
                    ReadWholeFile      = useMultiple,
                    TreatAsLightweight = System.Text.RegularExpressions.Regex.IsMatch(file.Name, @"[_[(](?:LW|LIGHT)[_\]\)]")
                };
                var idents = reader.ReadFile(file.FullName);
                files.Add(idents.ToList(), relPath);
            }
            var textFiles = Directory.EnumerateFiles(rootPath, "*.txt", SearchOption.TopDirectoryOnly);

            files.ReadmeFiles = textFiles.Count() > 0 ? textFiles.Select(f => Path.GetRelativePath(rootPath, f)).ToList() : new List <string>();
            return(files);
        }
Ejemplo n.º 2
0
 public IEnumerable <Identifier> ReadFile(string filePath, PakReaderOptions readOptions = null)
 {
     return(FindIdents(filePath).Select(match => _parserService.ParseMatch(match, true))
            .Where(ident => ident != null));
 }