internal virtual ZipFileInfo GetZipFileInfo(string path)
		{
			lock (this)
			{
				ZipFileInfo retval;

				if (!zipFileInfos.TryGetValue(path, out retval))
				{
					retval = new ZipFileInfo(null) { AbsolutePath = path };


					zipFileInfos[path] = retval;
				}

				return retval;
			}
		}
        internal virtual ZipFileInfo GetZipFileInfo(string path)
        {
            lock (this)
            {
                ZipFileInfo retval;

                if (!zipFileInfos.TryGetValue(path, out retval))
                {
                    retval = new ZipFileInfo(null);

                    retval.AbsolutePath = path;

                    zipFileInfos[path] = retval;
                }

                return(retval);
            }
        }
		private void RefreshNodeInfos()
		{	
			lock (this)
			{
				if (zipFileInfos != null)
				{
					foreach (var zipFileInfo in this.zipFileInfos.Values.Where(c => c.ShadowFile != null))
					{
						try
						{
							zipFileInfo.ShadowFile.Delete();
						}
						catch
						{
						}
					}
				}

				zipFileInfos.Clear();
				zipDirectoryInfos.Clear();

				var directories = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);

				directories.Add("/");

				var zipEntriesByDirectory = new Dictionary<string, ZLib.ZipEntry>();

				foreach (ZLib.ZipEntry zipEntry in zipFile)
				{
					if (zipEntry.IsDirectory)
					{
						var s = "/" + zipEntry.Name.TrimRight('/');

						directories.Add(s);

						zipEntriesByDirectory[s] = zipEntry;
					}
					else
					{
						var zipFileInfo = new ZipFileInfo(zipEntry);

						var x = zipEntry.Name.LastIndexOf('/');

						if (x > 0)
						{
							var path = zipEntry.Name.Substring(0, x);

							directories.Add("/" + path);
						}

						zipFileInfo.AbsolutePath = "/" + zipEntry.Name;

						zipFileInfos[zipFileInfo.AbsolutePath] = zipFileInfo;
					}
				}

				foreach (var directoryPath in directories)
				{
					ZLib.ZipEntry zipEntry; 
					var zipDirectoryInfo = new ZipDirectoryInfo(true);

					if (zipEntriesByDirectory.TryGetValue(directoryPath, out zipEntry))
					{
						zipDirectoryInfo.ZipEntry = zipEntry;
					}

					zipDirectoryInfo.AbsolutePath = directoryPath;
					zipDirectoryInfos[zipDirectoryInfo.AbsolutePath] = zipDirectoryInfo;
				}
			}
		}
示例#4
0
        private void RefreshNodeInfos()
        {
            lock (this)
            {
                if (zipFileInfos != null)
                {
                    foreach (var zipFileInfo in this.zipFileInfos.Values.Where(c => c.ShadowFile != null))
                    {
                        try
                        {
                            zipFileInfo.ShadowFile.Delete();
                        }
                        catch
                        {
                        }
                    }
                }

                zipFileInfos.Clear();
                zipDirectoryInfos.Clear();

                var directories = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase)
                {
                    "/"
                };


                var zipEntriesByDirectory = new Dictionary <string, ZLib.ZipEntry>();

                foreach (ZLib.ZipEntry zipEntry in zipFile)
                {
                    if (zipEntry.IsDirectory)
                    {
                        var s = "/" + zipEntry.Name.TrimRight('/');

                        directories.Add(s);

                        zipEntriesByDirectory[s] = zipEntry;
                    }
                    else
                    {
                        var zipFileInfo = new ZipFileInfo(zipEntry);

                        var x = zipEntry.Name.LastIndexOf('/');

                        if (x > 0)
                        {
                            var path = zipEntry.Name.Substring(0, x);

                            directories.Add("/" + path);
                        }

                        zipFileInfo.AbsolutePath = "/" + zipEntry.Name;

                        zipFileInfos[zipFileInfo.AbsolutePath] = zipFileInfo;
                    }
                }

                foreach (var directoryPath in directories)
                {
                    ZLib.ZipEntry zipEntry;
                    var           zipDirectoryInfo = new ZipDirectoryInfo(true);

                    if (zipEntriesByDirectory.TryGetValue(directoryPath, out zipEntry))
                    {
                        zipDirectoryInfo.ZipEntry = zipEntry;
                    }

                    zipDirectoryInfo.AbsolutePath = directoryPath;
                    zipDirectoryInfos[zipDirectoryInfo.AbsolutePath] = zipDirectoryInfo;
                }
            }
        }