本文整理汇总了C#中ZipArchive.CreateFolder方法的典型用法代码示例。如果您正苦于以下问题:C# ZipArchive.CreateFolder方法的具体用法?C# ZipArchive.CreateFolder怎么用?C# ZipArchive.CreateFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZipArchive
的用法示例。
在下文中一共展示了ZipArchive.CreateFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteSessionArchive
private static bool WriteSessionArchive(string sFilename, Session[] arrSessions, string sPassword, bool bDisplayErrorMessages)
{
if ((null == arrSessions || (arrSessions.Length < 1)))
{
if (bDisplayErrorMessages)
{
FiddlerApplication.Log.LogString("WriteSessionArchive - No Input. No sessions were provided to save to the archive.");
}
return false;
}
try
{
if (File.Exists(sFilename))
{
File.Delete(sFilename);
}
DiskFile odfZip = new DiskFile(sFilename);
ZipArchive oZip = new ZipArchive(odfZip);
oZip.TempFolder = new MemoryFolder();
oZip.BeginUpdate();
ZippedFolder oZipRawFolder = (ZippedFolder)oZip.CreateFolder("raw");
#region PasswordProtectIfNeeded
if (!String.IsNullOrEmpty(sPassword))
{
if (CONFIG.bUseAESForSAZ)
{
oZip.DefaultEncryptionMethod = EncryptionMethod.WinZipAes; // Use 256bit AES
}
oZip.DefaultEncryptionPassword = sPassword;
}
#endregion PasswordProtectIfNeeded
oZip.Comment = Fiddler.CONFIG.FiddlerVersionInfo + " " + GetZipLibraryInfo() + " Session Archive. See http://www.fiddler2.com";
#region ProcessEachSession
int iFileNumber = 1;
// Our format string must pad all session ids with leading 0s for proper sorting.
string sFileNumberFormatter = ("D" + arrSessions.Length.ToString().Length);
foreach (Session oSession in arrSessions)
{
WriteSessionToSAZ(oSession, odfZip, iFileNumber, sFileNumberFormatter, null, bDisplayErrorMessages);
iFileNumber++;
}
#endregion ProcessEachSession
oZip.EndUpdate();
return true;
}
catch (Exception eX)
{
// TODO: Should close any open handles here.
if (bDisplayErrorMessages)
{
FiddlerApplication.Log.LogString("Failed to save Session Archive.\n\n" + eX.Message);
}
return false;
}
}