A folder (directory) node of the filesystem tree.
Inheritance: FileSystemNode, IFolder
Exemple #1
0
 public void View(IDataStream stream)
 {
     foreach (PictureControl old in flowLayoutPanel1.Controls) {
         old.Dispose();
     }
     flowLayoutPanel1.Controls.Clear();
     m_Folder = stream as Folder;
     if (m_Folder != null) {
         PictureControl previous = null;
         PictureControl first = null;
         foreach (FileSystemNode f in m_Folder.GetChildren()) {
             if (f is File && FileTypes.IsPicture(f)) {
                 PictureControl control = new PictureControl();
                 flowLayoutPanel1.Controls.Add(control);
                 control.SetDataStream(f);
                 if (previous != null) {
                     previous.SetNextPictureControl(control);
                 }
                 previous = control;
                 if (first == null) {
                     first = control;
                 }
             }
         }
         if (first != null) {
             first.ViewDataStream();
         }
     }
 }
        public ExplorerHistoryFile(File file, Folder parent, ExplorerHistoryType type)
        {
            m_Records = new List<ExplorerHistoryRecord>();
            Path = file.Path;
            Stream = file;
            if (file != null) {
                string headerStr = Util.GetASCIIString(file, 0, HEADER_SIZE);
                if (headerStr == "Client UrlCache MMF Ver 5.2") {
                    Type = type;

                    // Read cache directories
                    List<Folder> cachedirs = new List<Folder>();
                    ulong cache_offset = 0x50;
                    string cache = Util.GetASCIIString(file, cache_offset, Util.StrLen(file, cache_offset, 8));
                    while (cache != "") {
                        foreach (FileSystemNode node in parent.GetChildren(cache)) {
                            if (node is Folder) {
                                cachedirs.Add(node as Folder);
                                break;
                            }
                        }
                        cache_offset += 12;
                        cache = Util.GetASCIIString(file, cache_offset, Util.StrLen(file, cache_offset, 8));
                    }

                    ulong offset = 0x4000;
                    while (offset < file.StreamLength) {
                        uint numBlocks = 1;
                        if (Util.GetASCIIString(file, offset, 4) == "URL ") {
                            numBlocks = Util.GetUInt32(file, offset + 4);
                            uint desc_offset = Util.GetUInt32(file, offset + 0x34);
                            uint cachedname_offset = Util.GetUInt32(file, offset + 0x3C);
                            DateTime lastAccessed;
                            DateTime lastModified;
                            GetDateTimeFields(out lastAccessed, out lastModified, file, offset + 8);
                            string desc = Util.GetASCIIString(file, offset + desc_offset, Util.StrLen(file, offset + desc_offset, 0x4000));
                            string cachedname = Util.GetASCIIString(file, offset + cachedname_offset, Util.StrLen(file, offset + cachedname_offset, 0x4000));
                            int cachenum = Util.GetByte(file, offset + 0x38);
                            if (cachedirs.Count > cachenum) {
                                m_Records.Add(new ExplorerHistoryRecord(desc, lastAccessed, lastModified, cachedirs[cachenum], cachedname));
                            } else {
                                m_Records.Add(new ExplorerHistoryRecord(desc, lastAccessed, lastModified, file.FileSystem));
                            }
                        }
                        offset += numBlocks * BLOCK_SIZE;
                    }
                }
            }
        }
 public ExplorerHistoryRecord(string desc, DateTime lastAccessed, DateTime lastModified, Folder folder, string filename)
 {
     Description = desc;
     LastAccessedUTC = lastAccessed;
     LastModifiedUTC = lastModified;
     if (LastAccessedUTC.Kind != DateTimeKind.Utc) Debugger.Break();
     if (LastModifiedUTC.Kind != DateTimeKind.Utc) Debugger.Break();
     m_Folder = folder;
     m_Filename = filename;
 }