本文整理汇总了C#中Ionic.AddFile方法的典型用法代码示例。如果您正苦于以下问题:C# Ionic.AddFile方法的具体用法?C# Ionic.AddFile怎么用?C# Ionic.AddFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ionic
的用法示例。
在下文中一共展示了Ionic.AddFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecursiveArchivate
private static void RecursiveArchivate(string path, Ionic.Zip.ZipFile zip, string relPath, ref DateTime dt)
{
foreach (var file in Directory.GetFiles(path))
{
//if (!CheckFile(file)) continue;
var fdt = File.GetLastWriteTime(file);
if (fdt > dt) dt = File.GetLastWriteTime(file);
zip.AddFile(file, relPath);
}
foreach (string directory in Directory.GetDirectories(path))
{
var dirName = new DirectoryInfo(directory).Name;
RecursiveArchivate(directory, zip, string.Format(@"{0}\{1}", relPath, dirName), ref dt);
}
}
示例2: PackResources
public override void PackResources(Ionic.Zip.ZipFile zip, String archiveTargetPath, IPath sourcePath)
{
RelativePath path = new RelativePath(this.Source, sourcePath);
zip.AddFile(path.AbsolutePath, archiveTargetPath);
}
示例3: AddToZip
private void AddToZip(string dir, int rootLength, Ionic.Zip.ZipFile zip)
{
string[] files = System.IO.Directory.GetFiles(dir);
int len = files.Length;
while (len-- > 0)
{
string file = files[len], path = file;
path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar));
zip.AddFile(file, path.Length > rootLength ? path.Substring(rootLength) : string.Empty);
}
string[] dirs = System.IO.Directory.GetDirectories(dir);
len = dirs.Length;
while (len-- > 0)
{
this.AddToZip(dirs[len], rootLength, zip);
}
}