本文整理汇总了C#中ICSharpCode.SharpZipLib.Tar.TarEntry.GetDirectoryEntries方法的典型用法代码示例。如果您正苦于以下问题:C# TarEntry.GetDirectoryEntries方法的具体用法?C# TarEntry.GetDirectoryEntries怎么用?C# TarEntry.GetDirectoryEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Tar.TarEntry
的用法示例。
在下文中一共展示了TarEntry.GetDirectoryEntries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteEntry
//.........这里部分代码省略.........
// if ( mime.getPrimaryType().
// equalsIgnoreCase( "text" ) )
// {
// asciiTrans = true;
// }
// else if ( this.transTyper != null )
// {
// if ( this.transTyper.isAsciiFile( eFile ) )
// {
// asciiTrans = true;
// }
// }
// } catch ( MimeTypeParseException ex )
// {
// // IGNORE THIS ERROR...
// }
//
// if (this.debug) {
// Console.Error.WriteLine("CREATE TRANS? '" + asciiTrans + "' ContentType='" + contentType + "' PrimaryType='" + mime.getPrimaryType()+ "'" );
// }
if (asciiTrans) {
tempFileName = Path.GetTempFileName();
StreamReader inStream = File.OpenText(eFile);
Stream outStream = new BufferedStream(File.Create(tempFileName));
while (true) {
string line = inStream.ReadLine();
if (line == null) {
break;
}
byte[] data = Encoding.ASCII.GetBytes(line);
outStream.Write(data, 0, data.Length);
outStream.WriteByte((byte)'\n');
}
inStream.Close();
outStream.Flush();
outStream.Close();
entry.Size = new FileInfo(tempFileName).Length;
eFile = tempFileName;
}
}
string newName = null;
if (this.rootPath != null) {
if (entry.Name.StartsWith(this.rootPath)) {
newName = entry.Name.Substring(this.rootPath.Length + 1 );
}
}
if (this.pathPrefix != null) {
newName = (newName == null) ? this.pathPrefix + "/" + entry.Name : this.pathPrefix + "/" + newName;
}
if (newName != null) {
entry.Name = newName;
}
this.tarOut.PutNextEntry(entry);
if (entry.IsDirectory) {
if (recurse) {
TarEntry[] list = entry.GetDirectoryEntries();
for (int i = 0; i < list.Length; ++i) {
this.WriteEntry(list[i], recurse);
}
}
}
else {
Stream inputStream = File.OpenRead(eFile);
int numWritten = 0;
byte[] eBuf = new byte[32 * 1024];
while (true) {
int numRead = inputStream.Read(eBuf, 0, eBuf.Length);
if (numRead <=0) {
break;
}
this.tarOut.Write(eBuf, 0, numRead);
numWritten += numRead;
}
// Console.WriteLine("written " + numWritten + " bytes");
inputStream.Close();
if (tempFileName != null && tempFileName.Length > 0) {
File.Delete(tempFileName);
}
this.tarOut.CloseEntry();
}
}