Exemplo n.º 1
0
        public async Task <IEnumerable <IFileModel> > GetDirFiles(string sourcePath, string targetPath)
        {
            List <string> files = new List <string>();

            if (Directory.Exists(sourcePath))
            {
                var tmp        = Directory.GetFiles(sourcePath).ToList();
                var extensions = (await ReadWriter.GetInstance().Read()).ToList();

                foreach (var file in tmp)
                {
                    if (extensions.FirstOrDefault(x => Path.GetExtension(file).Substring(1) == x) != default)
                    {
                        files.Add(file);
                    }
                }
            }

            return(GetModelList(files, sourcePath, targetPath));
        }
Exemplo n.º 2
0
        public static ReadWriter GetInstance()
        {
            Instance = Instance == null ? new ReadWriter() : Instance;

            return(Instance);
        }