public static void Run() { string dataDir = RunExamples.GetDataDir_Data(); //ExStart: EntriesWithDifferentPasswords using (FileStream sevenZipFile = File.Open("archive.7z", FileMode.Create)) { FileInfo fi1 = new FileInfo("data1.bin"); FileInfo fi2 = new FileInfo("data2.bin"); FileInfo fi3 = new FileInfo("data3.bin"); using (var archive = new SevenZipArchive()) { archive.CreateEntry("entry1.bin", fi1, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test1"))); archive.CreateEntry("entry2.bin", fi2, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test2"))); archive.CreateEntry("entry3.bin", fi3, false, new SevenZipEntrySettings(new SevenZipStoreCompressionSettings(), new SevenZipAESEncryptionSettings("test3"))); archive.Save(sevenZipFile); } } //ExEnd: EntriesWithDifferentPasswords Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings"); }
public static void Run() { string dataDir = RunExamples.GetDataDir_Data(); //ExStart: AESEncryptionSettings using (var archive = new SevenZipArchive(new SevenZipEntrySettings(null, new SevenZipAESEncryptionSettings("p@s$")))) { archive.CreateEntry("data.bin", new MemoryStream(new byte[] { 0x00, 0xFF })); archive.Save("archive.7z"); } //ExEnd: AESEncryptionSettings Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings"); }
public static void Run() { string dataDir = RunExamples.GetDataDir_Data(); //ExStart: CreateSevenZipEntry using (FileStream sevenZipFile = File.Open("archive.7z", FileMode.Create)) { using (var archive = new SevenZipArchive()) { archive.CreateEntry("data.bin", "file.dat"); archive.Save(sevenZipFile); } } //ExEnd: CreateSevenZipEntry Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings"); }
public static void Run() { string dataDir = RunExamples.GetDataDir_Data(); //ExStart: ArchiveWithEncryptedEntry using (FileStream sevenZipFile = File.Open("archive.7z", FileMode.Create)) { using (var archive = new SevenZipArchive()) { archive.CreateEntry("entry1.bin", new MemoryStream(new byte[] { 0x00, 0xFF }), new SevenZipEntrySettings(new SevenZipLZMACompressionSettings(), new SevenZipAESEncryptionSettings("test1")), new FileInfo("data1.bin")); archive.Save(sevenZipFile); } } //ExEnd: ArchiveWithEncryptedEntry Console.WriteLine("Successfully Created a Seven Zip File with AES Encryption Settings"); }