本文整理汇总了C#中ZipFile.GetEntry方法的典型用法代码示例。如果您正苦于以下问题:C# ZipFile.GetEntry方法的具体用法?C# ZipFile.GetEntry怎么用?C# ZipFile.GetEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZipFile
的用法示例。
在下文中一共展示了ZipFile.GetEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessFile
private static void ProcessFile(File effDocFile, File outFile)
{
if (!effDocFile.exists())
{
throw new RuntimeException("file '" + effDocFile.GetAbsolutePath() + "' does not exist");
}
OutputStream os;
try
{
os = new FileOutputStream(outFile);
}
catch (FileNotFoundException e)
{
throw new RuntimeException(e);
}
os = new SimpleAsciiOutputStream(os);
PrintStream ps;
try
{
ps = new PrintStream(os, true, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException(e);
}
outputLicenseHeader(ps);
Type genClass = typeof(ExcelFileFormatDocFunctionExtractor);
ps.println("# Created by (" + genClass.Name + ")");
// identify the source file
ps.print("# from source file '" + SOURCE_DOC_FILE_NAME + "'");
ps.println(" (size=" + effDocFile.Length + ", md5=" + GetFileMD5(effDocFile) + ")");
ps.println("#");
ps.println("#Columns: (index, name, minParams, maxParams, returnClass, paramClasses, isVolatile, hasFootnote )");
ps.println("");
try
{
ZipFile zf = new ZipFile(effDocFile);
InputStream is1 = zf.GetInputStream(zf.GetEntry("content.xml"));
extractFunctionData(new FunctionDataCollector(ps), is1);
zf.Close();
}
catch (ZipException e)
{
throw new RuntimeException(e);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
ps.Close();
String canonicalOutputFileName;
try
{
canonicalOutputFileName = outFile.GetCanonicalPath();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
Console.WriteLine("Successfully output to '" + canonicalOutputFileName + "'");
}