Esempio n. 1
0
        public static List <FileDTO> GetFilesInPath(string path)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            //string[] dirs = Directory.GetDirectories(directoryInfo.FullName);
            //string[] files_dir = Directory.GetFiles(path);

            files.Clear();
            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                FileDTO fileDTO = new FileDTO();
                fileDTO.FileActualName = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                fileDTO.FileUniqueName = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                fileDTO.FileExt        = file.Extension;
                fileDTO.ContentType    = GetContentType(file.Name);

                files.Add(fileDTO);
            }

            return(files);
        }
Esempio n. 2
0
 public static void SaveFileInDB(FileDTO dto)
 {
     files.Add(dto);
 }