コード例 #1
0
        public static IList <string> ListFoldersInFolder(string directorio)
        {
            IList <string> directorios = new List <string>();
            string         folder      = IOHelper.GetDiskLocation(directorio);

            IOHelper.CheckAndCreateFolder(folder);
            directorios = Directory.GetDirectories(folder, "*", SearchOption.AllDirectories).ToList();

            return(directorios.Select(m => "/" + m.Replace(IOHelper.GetRootDisk(), string.Empty).Replace("\\", "/")).ToList());
        }
コード例 #2
0
        public static string SaveFile(string name, byte[] fileContent, string contentType, string directorio, string extension)
        {
            string folder = IOHelper.GetDiskLocation(directorio);

            IOHelper.CheckAndCreateFolder(folder);

            string path = IOHelper.ConbinePath(folder, name + "." + extension);

            FileSystemFile.Save(new Archivo(name, name, fileContent, contentType, extension), path);

            return(path);
        }
コード例 #3
0
        public static IList <string> ListImagesInFolder(string directorio)
        {
            IList <string> archivos = new List <string>();
            string         folder   = IOHelper.GetDiskLocation(directorio);

            IOHelper.CheckAndCreateFolder(folder);
            archivos = Directory.GetFiles(folder, "*.jpg", SearchOption.AllDirectories).ToList();
            foreach (var item in Directory.GetFiles(folder, "*.png", SearchOption.AllDirectories).ToList())
            {
                archivos.Add(item);
            }

            return(archivos.Select(m => m.Replace(HostingEnvironment.MapPath("~/"), string.Empty).Replace("\\", "/")).ToList());
        }
コード例 #4
0
        public static string SaveFile(Ticket ticket, byte[] fileContent, string directorio)
        {
            string folder = IOHelper.GetDiskLocation(directorio);

            IOHelper.CheckAndCreateFolder(folder);

            var    item      = GetFileFromCache(ticket);
            var    aux       = item.Name.Split('.');
            string extension = aux[aux.Length - 1];
            string path      = IOHelper.ConbinePath(folder, ticket.Value + "." + extension);

            string fullPath = directorio + "/" + ticket.Value + "." + extension;

            FileSystemFile.Save(new Archivo(item.Name, item.Description, fileContent, item.ContentType, extension), path);

            return(fullPath);
        }
コード例 #5
0
ファイル: BibliasComponent.cs プロジェクト: emmanuelt88/ibvd
        public static void ImportarBiblia(CacheItem cacheItem)
        {
            string tempFolder = IOHelper.GetDiskLocation(ConfigurationHelper.DirectorioBiblias);

            IOHelper.CheckAndCreateFolder(tempFolder);

            MemoryStream stream = new MemoryStream(cacheItem.Content);

            ZipFile file = ZipFile.Read(stream);

            string fileName = IOHelper.ConbinePath(tempFolder, file.Entries.First().FileName);

            LoggingComponent.LogInfo("Extrayendo biblia en directorio " + tempFolder);
            file.Extract(file.Entries.First().FileName, tempFolder, true);

            LoggingComponent.LogInfo("Comenzando importacion a la base");
            BibliaMapper.ImportarBiblia(fileName);
        }
コード例 #6
0
        public static System.Web.Mvc.FileContentResult GetDirectoryImages(string root)
        {
            string folder = IOHelper.GetDiskLocation(root);

            IOHelper.CheckAndCreateFolder(folder);

            Ionic.Zip.ZipFile fileZip     = new ZipFile();
            string[]          directorios = Directory.GetDirectories(folder);
            MemoryStream      output      = new MemoryStream();

            fileZip.AddDirectory(folder);
            var miniaturas = fileZip.Entries.Where(m => m.FileName.Contains(ConfigurationHelper.ImagenMiniatura)).ToList();

            foreach (var item in miniaturas)
            {
                fileZip.RemoveEntry(item.FileName);
            }
            fileZip.Save(output);
            var result = new System.Web.Mvc.FileContentResult(output.ToArray(), "application/octet-stream");

            result.FileDownloadName = "IBVD_Imagenes.zip";
            return(result);
        }