Beispiel #1
0
        private void PerformEnumeration()
        {
            String zipPath = Util.ConvertVirtualPathToZipPath(_virtualPath, false);

            if (zipPath[zipPath.Length - 1] != '/')
            {
                ZipEntry entry = _zipFile[zipPath];
                if (entry != null)
                {
                    _paths.Add(new ZipVirtualFile(zipPath, _zipFile));
                }
                return;
            }
            else
            {
                foreach (ZipEntry entry in _zipFile)
                {
                    Console.WriteLine(entry.FileName);
                    if (entry.FileName == zipPath)
                    {
                        continue;
                    }
                    if (entry.FileName.StartsWith(zipPath))
                    {
                        // if we're looking for files and current entry is a directory, skip it
                        if (_requestType == VirtualPathType.Files && entry.IsDirectory)
                        {
                            continue;
                        }
                        // if we're looking for directories and current entry its not one, skip it
                        if (_requestType == VirtualPathType.Directories && !entry.IsDirectory)
                        {
                            continue;
                        }

                        int pos = entry.FileName.IndexOf('/', zipPath.Length);
                        if (pos != -1)
                        {
                            if (entry.FileName.Length > pos + 1)
                            {
                                continue;
                            }
                        }
                        //    continue;
                        if (entry.IsDirectory)
                        {
                            _paths.Add(new ZipVirtualDirectory(Util.ConvertZipPathToVirtualPath(entry.FileName), _zipFile));
                        }
                        else
                        {
                            _paths.Add(new ZipVirtualFile(Util.ConvertZipPathToVirtualPath(entry.FileName), _zipFile));
                        }
                    }
                }
            }
        }
Beispiel #2
0
		private bool Exists(string virtualPath, bool isFile)
		{
			EnsureCache();

			bool result = false;
			if (fileOrDirectoryCache.TryGetValue(Util.ConvertVirtualPathToZipPath(virtualPath, isFile), out result))
				return result != isFile;

			return false;
		}
Beispiel #3
0
        public override System.IO.Stream Open()
        {
            ZipEntry entry  = _zipFile[Util.ConvertVirtualPathToZipPath(base.VirtualPath, true)];
            var      buffer = new byte[entry.UncompressedSize];

            lock (lockObject)
            {
                entry.OpenReader().Read(buffer, 0, buffer.Length);
            }
            var ms = new MemoryStream(buffer);

            return(ms);
        }
Beispiel #4
0
        public override System.IO.Stream Open()
        {
            ZipEntry entry = _zipFile[Util.ConvertVirtualPathToZipPath(base.VirtualPath, true)];

            return(entry.OpenReader());
        }
Beispiel #5
0
		private ZipEntry GetEntry(string virtualPath, bool isFile)
		{
			string zipPath = Util.ConvertVirtualPathToZipPath(virtualPath, isFile);
			return zipFile[zipPath];
		}