当前位置: 首页>>代码示例>>C#>>正文


C# ZipEntry.OpenReader方法代码示例

本文整理汇总了C#中Ionic.Zip.ZipEntry.OpenReader方法的典型用法代码示例。如果您正苦于以下问题:C# ZipEntry.OpenReader方法的具体用法?C# ZipEntry.OpenReader怎么用?C# ZipEntry.OpenReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ionic.Zip.ZipEntry的用法示例。


在下文中一共展示了ZipEntry.OpenReader方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ContentSection

 public ContentSection(ZipEntry entry)
 {
     Id = Path.GetFileNameWithoutExtension(entry.FileName);
     ArchivePath = entry.FileName;
     using (Stream s = entry.OpenReader())
     {
         using (StreamReader sr = new StreamReader(s))
         {
             Content = sr.ReadToEnd();
         }
     }
 }
开发者ID:sashaMilka,项目名称:MultiReader,代码行数:12,代码来源:ContentSection.cs

示例2: OpfMetadataFile

 public OpfMetadataFile(ZipEntry file, string password)
 {
     try
     {
         using (Stream s = (String.IsNullOrEmpty(password) ? file.OpenReader() : file.OpenReader(password)))
         {
             using (StreamReader sr = new StreamReader(s))
             {
                 try
                 {
                     content = XDocument.Parse(sr.ReadToEnd());
                 }
                 catch (Exception ex)
                 {
                     throw new MetadataParseException(ex, "Nie można było otworzyć pliku z metadanymi. Może to być spowodowane uszkodzeniem jego struktury XMLowej, niewłaściwym kodowaniem, albo brakiem dostępu.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw new EpubFileException(ex, "Błąd w rozpakowywaniu pliku ePub. Może to być spowodowane uszkodzeniem pliku, brakiem plików z metadanymi bądź brakiem dostępu.");
     }
 }
开发者ID:sashaMilka,项目名称:MultiReader,代码行数:24,代码来源:OpfMetadataFile.cs

示例3: GetStringFile

        public static string GetStringFile(ZipEntry zipEntry)
        {
            if (zipEntry != null)
            {
                using (var stream = zipEntry.OpenReader())
                {
                    using (StreamReader sr = new StreamReader(stream, KPGenericUtil.GetDefaultEncoding()))
                    {
                        string fileString = sr.ReadToEnd();
                        return fileString;
                    }
                }
            }

            return String.Empty;
        }
开发者ID:NumericTechnology,项目名称:Platanum.Net,代码行数:16,代码来源:ZipUtil.cs

示例4: Save

        private static void Save(ZipEntry entry, string outputFilePath)
        {
            using (var input = entry.OpenReader())
            {
                var folderPath = Path.GetDirectoryName(outputFilePath);
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                using (Stream output = File.OpenWrite(outputFilePath))
                {
                    CopyStream(input, output);
                }
            }
        }
开发者ID:SaintSkeeta,项目名称:Sitecore-Nuget-Package-Discoverer,代码行数:16,代码来源:Program.cs

示例5: IterateOverCSVZipEntry

 protected void IterateOverCSVZipEntry(ZipEntry entry, Func<GenericParserAdapter, bool> func)
 {
     using (var reader = new StreamReader(entry.OpenReader())) {
         using (var parser = new GenericParserAdapter(reader)) {
             parser.ColumnDelimiter = ',';
             parser.FirstRowHasHeader = true;
             parser.TextQualifier = '\"';
             parser.FirstRowSetsExpectedColumnCount = true;
             while (parser.Read()) {
                 if (func != null) {
                     if (!func(parser)) {
                         return;
                     }
                 }
             }
         }
     }
 }
开发者ID:kehh,项目名称:biolink,代码行数:18,代码来源:BVPImportSourceBuilder.cs

示例6: Input2String

        /// <summary>
        /// Provide Entry Content
        /// </summary>
        /// <param name="ze"></param>
        /// <returns></returns>
        private List<string> Input2String(ZipEntry ze)
        {
            List<string> result = new List<string>();
            try
            {
                using (var s = ze.OpenReader())
                {
                    var sr = new StreamReader(s);
                    string line = sr.ReadLine();
                    while (line != null)
                    {
                        result.Add(line);
                        line = sr.ReadLine();
                    }
                    
                }
                //using (var ms = new MemoryStream())
                //{
                //    int n;
                //    var buffer = new byte[1024];
                //    while ((n = s.Read(buffer, 0, buffer.Length)) > 0)
                //        ms.Write(buffer, 0, n);
                //    ms.Seek(0, SeekOrigin.Begin);

                //    var sr = new StreamReader(ms);
                //    result = sr.ReadToEnd();

                //    sr.Close();
                //    sr.Dispose();
                //}
            }
            catch (Exception ex)
            { throw ex; }

            return result;
        }
开发者ID:DaHao,项目名称:RSPdf,代码行数:41,代码来源:EmlParser.cs

示例7: ExtractTestStepIndex

 private void ExtractTestStepIndex(ZipEntry entry)
 {
     using (var reader = new StreamReader(entry.OpenReader()))
     {
         var text = reader.ReadToEnd();
         TestStepIndex = int.Parse(text);
     }
 }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:8,代码来源:TestStepPackage.cs

示例8: ErrorLog

 static ErrorLog ErrorLog(ZipEntry entry)
 {
     using(var reader = entry.OpenReader())
     using(var stream = new StreamReader(reader))
         return (ErrorLog) serializer.Deserialize(stream);
 }
开发者ID:stevenbey,项目名称:elfar,代码行数:6,代码来源:ZipErrorLogProvider.cs

示例9: ExtractEnvironmentName

 private void ExtractEnvironmentName(ZipEntry entry)
 {
     using (var reader = new StreamReader(entry.OpenReader()))
     {
         Environment = reader.ReadToEnd();
     }
 }
开发者ID:pvandervelde,项目名称:Sherlock,代码行数:7,代码来源:TestEnvironmentPackage.cs

示例10: UpdateXmlEntity

		private static void UpdateXmlEntity(ZipEntry entry, string selector, Action<XElement> update, ZipFile zip, IXmlNamespaceResolver nsResolver)
		{
			var output = new MemoryStream();
			using (var entryStream = entry.OpenReader())
			{
				var xml = XDocument.Load(entryStream);
				update(xml.XPathSelectElement(selector, nsResolver));
				xml.Save(output);
			}
			zip.UpdateEntry(entry.FileName, output.GetBuffer());
			zip.Save();
		}
开发者ID:andgein,项目名称:uLearn,代码行数:12,代码来源:CourseManager.cs

示例11: UpdateCsFiles

		private static void UpdateCsFiles(ZipEntry entry, string slideId, ZipFile zip)
		{
			string code;
			using (var entryStream = entry.OpenReader())
			{
				code = new StreamReader(entryStream).ReadToEnd();
			}
			code = Regex.Replace(code, "(?<=\\[Slide\\(\".*\",\\s*\").+(?=\"\\)\\])", slideId);
			zip.UpdateEntry(entry.FileName, code, Encoding.UTF8);
			zip.Save();
		}
开发者ID:andgein,项目名称:uLearn,代码行数:11,代码来源:CourseManager.cs

示例12: AddModFile

 public void AddModFile(ZipEntry ModFile)
 {
     AddModFile(ModFile.OpenReader(), ModFile.FileName);
 }
开发者ID:wischi-chr,项目名称:Wischis-Minecraft-Launcher,代码行数:4,代码来源:Class1.cs

示例13: CopyFileInZipToLocation

		private void CopyFileInZipToLocation(ZipEntry entry)
		{
			string targetFilePath = CreateTargetPathForZipEntry(entry);
			if (File.Exists(targetFilePath))
				return;
			using (var stream = entry.OpenReader())
			using (var memoryStream = new MemoryStream())
			{
				stream.CopyTo(memoryStream);
				File.WriteAllBytes(targetFilePath, memoryStream.ToArray());
			}
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:12,代码来源:ProjectCreator.cs


注:本文中的Ionic.Zip.ZipEntry.OpenReader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。