Beispiel #1
0
        /// <summary>
        /// Remove the resource represented by the entry.
        /// <param name="entry">Entry of the resource to delete.</param>
        /// </summary>
        /// <returns>
        /// Size of deleted file if successfully deleted, -1 otherwise.
        /// </returns>
        public long Remove(IEntry entry)
        {
            // It should be one entry return by us :)
            EntryImpl          entryImpl = (EntryImpl)entry;
            FileBinaryResource resource  = (FileBinaryResource)entryImpl.Resource;

            return(DoRemove(resource.File));
        }
Beispiel #2
0
 private void Register(Int32 index, EntryImpl e)
 {
     if (Contains(e.Name))
     {
         throw new ArgumentException("Other filter is using the same name: " + e.Name);
     }
     _entries.Insert(index, e);
 }
Beispiel #3
0
 /// <summary>
 /// Replace the filter with the specified name with the specified new filter.
 /// </summary>
 /// <param name="name">the name of the filter to replace</param>
 /// <param name="newFilter">the new filter</param>
 /// <returns>the old filter</returns>
 public IoFilter Replace(String name, IoFilter newFilter)
 {
     lock (_syncRoot)
     {
         CheckBaseName(name);
         EntryImpl e         = (EntryImpl)GetEntry(name);
         IoFilter  oldFilter = e.Filter;
         e.Filter = newFilter;
         return(oldFilter);
     }
 }
Beispiel #4
0
        private DiskDumpInfoEntry DumpCacheEntry(IEntry entry)
        {
            EntryImpl entryImpl = (EntryImpl)entry;
            string    firstBits = "";

            byte[] bytes = entryImpl.Resource.Read();
            string type  = TypeOfBytes(bytes);

            if (type.Equals("undefined") && bytes.Length >= 4)
            {
                firstBits = string.Format(
                    "0x{0:X} 0x{1:X} 0x{2:X} 0x{3:X}", bytes[0], bytes[1], bytes[2], bytes[3]);
            }

            string path = ((FileBinaryResource)entryImpl.Resource).File.FullName;

            return(new DiskDumpInfoEntry(path, type, entryImpl.GetSize(), firstBits));
        }
Beispiel #5
0
        /// <summary>
        /// Removes the filter with the specified name from this chain.
        /// </summary>
        /// <param name="name">the name of the filter to remove</param>
        /// <returns>the removed filter</returns>
        public IoFilter Remove(String name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            lock (_syncRoot)
            {
                EntryImpl entry = _entries.Find(e => e.Name.Equals(name));
                if (entry != null)
                {
                    _entries.Remove(entry);
                    return(entry.Filter);
                }
            }

            throw new ArgumentException("Unknown filter name: " + name);
        }