Exemplo n.º 1
0
        public List <string> GetFileList(ZoneCSVFileType type)
        {
            List <string> files       = new List <string>();
            List <string> ignoreFiles = new List <string>();

            foreach (ZoneCSVFile inc in _includes)
            {
                files.AddRange(inc.GetFileList(type));
            }

            foreach (List <string> lineColumns in GetItems())
            {
                if (lineColumns.Count > 0 && lineColumns[0] == type.Type)
                {
                    string file = ZoneCSVFileType.GetType(type).FileGetFunc(lineColumns);
                    if (!String.IsNullOrEmpty(file))
                    {
                        files.Add(file);
                    }
                }
            }

            foreach (ZoneCSVFile ign in _ignores)
            {
                ignoreFiles.AddRange(ign.GetFileList(type));
            }

            return(files.Except(ignoreFiles).ToList());
        }
Exemplo n.º 2
0
        List <string> GetIncludeExcludeFiles(List <string> filePaths, ZoneCSVFileType type)
        {
            List <string> files = new List <string>();

            foreach (string filePath in filePaths)
            {
                if (!File.Exists(filePath))
                {
                    throw new ApplicationException("Could not find '" + filePath + "', check args.");
                }

                string searchDir = Path.GetDirectoryName(filePath);
                string fileName  = Path.GetFileNameWithoutExtension(filePath);

                ZoneCSVFile csvFile = new ZoneCSVFile(searchDir, fileName);
                csvFile.Read();
                files.AddRange(csvFile.GetFileList(type));
            }
            return(files);
        }
Exemplo n.º 3
0
        public static ZoneCSVFileType GetType(ZoneCSVFileType type)
        {
            if (_types == null)
            {
                _types = new List <ZoneCSVFileType>();

                foreach (FieldInfo f in typeof(ZoneCSVFileType).GetFields(BindingFlags.Public | BindingFlags.Static))
                {
                    if (f.FieldType == typeof(ZoneCSVFileType))
                    {
                        _types.Add((ZoneCSVFileType)f.GetValue(null));
                    }
                }
            }

            ZoneCSVFileType foundType = _types.Find(a => a == type);

            if (foundType != null)
            {
                return(foundType);
            }

            throw new ApplicationException("Unsupported zone file type '" + type + "'");
        }