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


C# ZipInputStream.ReadAllBytes方法代码示例

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


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

示例1: EnsureMtnIsExtracted

        public static void EnsureMtnIsExtracted()
        {
            if (!Directory.Exists(MtnPath)) {
                Directory.CreateDirectory(MtnPath);
                Directory.CreateDirectory(FrameGrabsPath);

                string name = "MtnFrameGrabProvider.mtn.zip";
                var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);

                using (var zip = new ZipInputStream(stream)) {

                    ZipEntry entry;
                    while ((entry = zip.GetNextEntry()) != null) {
                        string destination = Path.Combine(MtnPath, entry.Name);
                        File.WriteAllBytes(destination, zip.ReadAllBytes());
                    }
                }
            }
        }
开发者ID:purplecow,项目名称:Media-Browser,代码行数:19,代码来源:Plugin.cs

示例2: EnsureMtnIsExtracted

        public static void EnsureMtnIsExtracted()
        {
            string name = "MtnFrameGrabProvider.mtn.zip";
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
            bool needsToExtractMtn = false;

            /*
            if (!Directory.Exists(MtnPath)) {
                Directory.CreateDirectory(MtnPath);
                //Directory.CreateDirectory(FrameGrabsPath);

                using (var zip = new ZipInputStream(stream)) {

                    ZipEntry entry;
                    while ((entry = zip.GetNextEntry()) != null) {
                        string destination = Path.Combine(MtnPath, entry.Name);
                        File.WriteAllBytes(destination, zip.ReadAllBytes());
                    }
                }
            } else {
                FileVersionInfo mtnVersion = FileVersionInfo.GetVersionInfo(MtnExe);
                Logger.ReportInfo("Using mtn version:{0}", mtnVersion.FileVersion);
                if (mtnVersion.FileVersion == null)
                    Logger.ReportInfo("Using a pre-versioning copy of mtn.");
            }
            */

            if (!Directory.Exists(MtnPath))
            {
                Directory.CreateDirectory(MtnPath);
                needsToExtractMtn = true;
            }
            else
            {
                FileVersionInfo mtnVersion = FileVersionInfo.GetVersionInfo(MtnExe);
                Logger.ReportInfo("Using mtn version:{0}", mtnVersion.FileVersion);

                if (mtnVersion.FileVersion != null)
                {
                    if (mtnVersion.FileVersion.ToString() != includedMtnVersion)
                    {
                        Logger.ReportInfo("mtn too old!");
                        needsToExtractMtn = true;
                    }
                }
                else
                {
                    Logger.ReportInfo("Using pre-versioning copy of mtn!");
                    needsToExtractMtn = true;
                }

            }

            if (needsToExtractMtn)
            {
                using (var zip = new ZipInputStream(stream))
                {
                    ZipEntry entry;
                    while ((entry = zip.GetNextEntry()) != null)
                    {
                        string destination = Path.Combine(MtnPath, entry.Name);
                        File.WriteAllBytes(destination, zip.ReadAllBytes());
                    }
                }
            }
        }
开发者ID:rickbassham,项目名称:videobrowser,代码行数:66,代码来源:Plugin.cs

示例3: AcceptFileBundle

        /// <summary>
        /// Accepts a file bundle containing all data of files.
        /// </summary>
        /// <param name="data">Binary data.</param>
        /// <returns>List of events.</returns>
        public List<FileEvent> AcceptFileBundle(byte[] data)
        {
            using (MemoryStream ms = new MemoryStream(data))
            using (ZipInputStream zip = new ZipInputStream(ms))
            {
                ZipEntry block = zip.GetNextEntry();
                var myPatchList = zip.ReadAllBytes().Deserialize<List<FileEvent>>();

                while (true)
                {
                    block = zip.GetNextEntry();
                    if (block == null)
                    {
                        break;
                    }

                    File.WriteAllBytes(Config.MetaFolderData.File(block.Name), zip.ReadAllBytes());
                }

                // Append versions
                Dictionary<string, FileItem> myFileList = new Dictionary<string, FileItem>();
                foreach (var item in VersionList.AllFiles)
                {
                    myFileList[item.Id] = item;
                }

                foreach (var patch in myPatchList)
                {
                    if (!myFileList.ContainsKey(patch.FileId))
                    {
                        myFileList[patch.FileId] = new FileItem(patch.FileId);
                        VersionList.AllFiles.Add(myFileList[patch.FileId]);
                        VersionList.SetFileByName(patch.Name, myFileList[patch.FileId]);
                    }

                    string oldName = myFileList[patch.FileId].CurrentName;
                    myFileList[patch.FileId].Merge(patch);
                    string currentName = myFileList[patch.FileId].CurrentName;
                    if (oldName != currentName)
                    {
                        VersionList.RemoveFileByName(oldName);
                        VersionList.SetFileByName(patch.Name, myFileList[patch.FileId]);
                    }
                }

                return myPatchList;
            }
        }
开发者ID:hoangvv1409,项目名称:codebase,代码行数:53,代码来源:VersionControl.cs


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