Ejemplo n.º 1
0
        public static void AddMetadata(this ZipArchive archive, CSVMapping mapping)
        {
            var metadataEntry = archive.CreateEntry(MetadataJson);

            using (var stream = metadataEntry.Open())
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    var serializedMapping = CSVMappingHelper.Save(mapping);
                    writer.Write(serializedMapping);
                }
        }
Ejemplo n.º 2
0
        public static async Task <CSVMapping> RestoreMetadata(this ZipArchive archive)
        {
            var metadataEntry = archive.GetEntry(MetadataJson);

            using (var stream = metadataEntry.Open())
                using (var reader = new StreamReader(stream))
                {
                    var serializedMapping = await reader.ReadToEndAsync();

                    return(CSVMappingHelper.Load(serializedMapping));
                }
        }