Catrobat.IDE.Core.Services.Common.ZipService.UnzipCatrobatPackageIntoIsolatedStorage C# (CSharp) Method

UnzipCatrobatPackageIntoIsolatedStorage() public method

public UnzipCatrobatPackageIntoIsolatedStorage ( Stream zipStream, string localStoragePath ) : System.Threading.Tasks.Task
zipStream Stream
localStoragePath string
return System.Threading.Tasks.Task
        public async Task UnzipCatrobatPackageIntoIsolatedStorage(Stream zipStream, string localStoragePath)
        {
            using (var storage = StorageSystem.GetStorage())
            {
                using (var archive = new ZipArchive(zipStream, ZipArchiveMode.Read))
                {
                    foreach (var entry in archive.Entries)
                    {
                        using (var stream = entry.Open())
                        {
                            var skipFile = false;
                            foreach (var ending in SkipedEndings)
                                if (entry.Name.EndsWith(ending))
                                    skipFile = true;

                            if (skipFile)
                                continue;

                            var filePath = Path.Combine(localStoragePath, entry.FullName);

                            if (Path.GetFileName(filePath) == "") continue;

                            var outStream = await storage.OpenFileAsync(filePath,
                                StorageFileMode.CreateNew, StorageFileAccess.Write);

                            await stream.CopyToAsync(outStream);
                            outStream.Dispose();
                            stream.Dispose();
                        }
                    }
                }
            }
        }