Skip to content

Commit

Permalink
Only add *.leok files to zip archive when exporting a File Key Store
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxhy committed Apr 11, 2024
1 parent 146808d commit ce9e476
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion KeyManager.Library.KeyStore.File/FileKeyStoreArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ public static void Export(string fileName, FileKeyStore keyStore)
System.IO.File.Delete(fileName);
}

ZipFile.CreateFromDirectory(keyStore.GetFileProperties().Fullpath, fileName);
var filesToAdd = Directory.GetFiles(keyStore.GetFileProperties().Fullpath, "*.leok", SearchOption.TopDirectoryOnly);
using var zipFileStream = new FileStream(fileName, FileMode.Create);
using var archive = new ZipArchive(zipFileStream, ZipArchiveMode.Create);
for (int i = 0; i < filesToAdd.Length; i++)
{
archive.CreateEntryFromFile(filesToAdd[i], Path.GetFileName(filesToAdd[i]));
}
}
}
}

0 comments on commit ce9e476

Please sign in to comment.