Example #1
0
        public static CFStream GetStream(ref CompoundFile cf, string path, string name)
        {
            List <string> pathList = null;

            if (path != "%Root_Entry%")
            {
                pathList = path.Split(new char[]
                {
                    '/'
                }).ToList <string>();
            }
            CFStorage rootStorage = cf.RootStorage;

            return(CFUtil.GetStorage(pathList, ref rootStorage).GetStream(name));
        }
Example #2
0
 public static CFStorage GetStorage(List <string> pathList, ref CFStorage storage)
 {
     if (pathList == null || pathList[0] == "")
     {
         return(storage);
     }
     if (pathList.Count <string>() > 1)
     {
         int    index       = pathList.Count <string>() - 1;
         string storageName = pathList[index];
         pathList.RemoveAt(index);
         return(CFUtil.GetStorage(pathList, ref storage).GetStorage(storageName));
     }
     return(storage.GetStorage(pathList[0]));
 }
Example #3
0
        /// <summary>
        /// Update the information panel with date from the treenode.
        /// </summary>
        /// <param name="node"></param>
        private void UpdateInfoPanel(TreeNode node)
        {
            CFNode cFNode = (CFNode)node.Tag;

            EnableInfoPanelFields(cFNode.IsFolder);
            txtName.Text         = cFNode.Name;
            txtSize.Text         = cFNode.Size.ToString("N0") + " bytes";
            txtClsID.Text        = ((cFNode.Id != null) ? cFNode.Id : "CLSID_NULL");
            txtCreationDate.Text = cFNode.CreationDate.ToString();
            txtModifyDate.Text   = cFNode.ModifyDate.ToString();
            txtLastAccess.Text   = cFNode.LastAccess.ToString();
            if (cFNode.IsFolder)
            {
                List <string> pathList = null;
                string        text     = cFNode.Path;
                if (text != "%Root_Entry%")
                {
                    if (text != "")
                    {
                        text += "/";
                    }
                    text    += cFNode.Name;
                    pathList = text.Split(new char[]
                    {
                        '/'
                    }).ToList <string>();
                }
                else
                {
                    text = "";
                }
                if (cFNode.ExploreFolder)
                {
                    CompoundFile compoundFile = _listCF[cFNode.CFidx];
                    CFStorage    rootStorage  = compoundFile.RootStorage;
                    CFUtil.AddItemsToTreeViewNode(ref compoundFile, CFUtil.ExploreStorage(CFUtil.GetStorage(pathList, ref rootStorage), text), treeView1, node);
                    cFNode.ExploreFolder = false;
                    node.Tag             = cFNode;
                }
            }
            if (cFNode.IsStream & cFNode.ExploreCFstream)
            {
                List <string> pathList2     = null;
                string        path          = "";
                CompoundFile  compoundFile2 = _listCF[cFNode.CFidx];
                Stream        ms1           = MSUtil.CFtoMStream(CFUtil.GetStream(ref compoundFile2, cFNode.Path, cFNode.Name));
                MemoryStream  memoryStream  = new MemoryStream();
                using (MemoryStream ms2 = MSUtil.UncompressLW77(ms1))
                {
                    ms2.CopyTo(memoryStream);
                }
                if (memoryStream.Length >= ms1.Length)
                {
                    CompoundFile compoundFile3 = new CompoundFile(memoryStream);
                    CFStorage    rootStorage2  = compoundFile3.RootStorage;
                    CFUtil.AddItemsToTreeViewNode(ref compoundFile3, CFUtil.ExploreStorage(CFUtil.GetStorage(pathList2, ref rootStorage2), path), treeView1, node);
                    foreach (TreeNode item in node.Nodes)
                    {
                        ((CFNode)item.Tag).CFidx = _listCF.Count();
                    }
                    _listCF.Add(compoundFile3);
                }
                cFNode.ExploreCFstream = false;
            }
        }