예제 #1
0
        public static SharpZipLibResult ReadWithSharpZipLib(MemoryStream stream)
        {
            stream.Position = 0;

            try
            {
                using (var file = new ICSharpCode.SharpZipLib.Zip.ZipFile(stream))
                {
                    file.IsStreamOwner = false;
                    var data = file
                               .Cast <ICSharpCode.SharpZipLib.Zip.ZipEntry>()
                               .Select(x => new SharpZipLibEntry(x))
                               .ToList();

                    return(new SharpZipLibResult
                    {
                        Success = true,
                        Data = data,
                    });
                }
            }
            catch (Exception e)
            {
                return(new SharpZipLibResult
                {
                    Success = false,
                    Exception = e,
                });
            }
        }