Exemple #1
0
        /// <summary>
        /// Load data in Image tab.
        /// </summary>
        /// <param name="tempNode"></param>
        private void LoadImage(CFNode tempNode)
        {
            ImageViewer.Image  = null;
            TxtDimensions.Text = "Dimensions: ???";
            TxtResolution.Text = "Resolution: ???";
            CompoundFile compoundFile = _listCF[tempNode.CFidx];
            CFStream     stream       = CFUtil.GetStream(ref compoundFile, tempNode.Path, tempNode.Name);
            int          num          = MSUtil.VerifyIfImage(stream);

            if (num > 0)
            {
                MemoryStream memoryStream = new MemoryStream();
                if (num == 1)
                {
                    memoryStream = MSUtil.UncompressLW77(MSUtil.CFtoMStream(stream));
                }
                if (num == 2)
                {
                    memoryStream = MSUtil.RemoveTrailingSegment(MSUtil.CFtoMStream(stream), 8);
                }
                if (memoryStream != null & memoryStream.Length != 0L)
                {
                    ImageViewer.Image = null;
                    ImageViewer.Image = Image.FromStream(memoryStream);
                    //TxtDimensions.Text = string.Format("Dimensions: {0}px x {1}px", ImageViewer.Image.Width, ImageViewer.Image.Height);
                    //TxtResolution.Text = string.Format("Resolution: {0}dpi x {1}dpi", ImageViewer.Image.HorizontalResolution, ImageViewer.Image.VerticalResolution);
                    TxtDimensions.Text = $"Dimensions: {ImageViewer.Image.Width}px x {ImageViewer.Image.Height}px";
                    TxtResolution.Text = $"Resolution: {ImageViewer.Image.HorizontalResolution}dpi x {ImageViewer.Image.VerticalResolution}dpi";
                }
                memoryStream.Dispose();
            }
        }
Exemple #2
0
        private void TreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            CFNode cFNode = (CFNode)e.Node.Tag;

            if (cFNode.IsStream & cFNode.ExploreCFstream)
            {
                CompoundFile compoundFile = _listCF[cFNode.CFidx];
                Stream       arg_50_0     = MSUtil.CFtoMStream(CFUtil.GetStream(ref compoundFile, cFNode.Path, cFNode.Name));
                MemoryStream memoryStream = new MemoryStream();
                using (MemoryStream memoryStream2 = MSUtil.UncompressLW77(arg_50_0))
                {
                    memoryStream2.CopyTo(memoryStream);
                }
                new CompoundFile(memoryStream);
            }
        }
Exemple #3
0
        public static string GetText(ref CompoundFile cf, CFNode nodo)
        {
            string       a      = Path.GetExtension(nodo.Name).ToLower();
            CFStream     stream = CFUtil.GetStream(ref cf, nodo.Path, nodo.Name);
            MemoryStream input  = MSUtil.CFtoMStream(stream);
            MemoryStream stream2;

            if (a == "")
            {
                stream2 = MSUtil.RemoveTrailingSegment(input, 12);
            }
            else if (MSUtil.IsCompressedWithLW77(stream))
            {
                stream2 = MSUtil.UncompressLW77(input);
            }
            else
            {
                stream2 = MSUtil.RemoveTrailingSegment(input, 8);
            }
            return(new StreamReader(stream2, (a == ".csv") ? Encoding.ASCII : Encoding.Unicode).ReadToEnd());
        }
Exemple #4
0
        public static void AddItemsToTreeViewNode(ref CompoundFile cf, List <CFNode> list, TreeView treeview, TreeNode parentNode = null)
        {
            var orderedList = from x in list
                              orderby !x.IsFolder, x.Name
            select x;

            foreach (CFNode currentNode in orderedList)
            {
                int num = currentNode.IsFolder ? 2 : 4;
                if (currentNode.IsStream && MSUtil.IsCompoundFile(MSUtil.CFtoMStream(CFUtil.GetStream(ref cf, currentNode.Path, currentNode.Name))))
                {
                    num = 1;
                    currentNode.ExploreCFstream = true;
                    currentNode.Type            = "Container";
                }
                if (currentNode.IsStream)
                {
                    currentNode.Type = "File";
                }
                currentNode.CFidx = ((CFNode)parentNode.Tag).CFidx;
                TreeNode node = new TreeNode
                {
                    Text               = currentNode.Name,
                    ImageIndex         = num,
                    SelectedImageIndex = num,
                    Tag = currentNode
                };
                if (parentNode == null)
                {
                    treeview.Nodes.Add(node);
                }
                else
                {
                    parentNode.Nodes.Add(node);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Load data in Text tab.
        /// </summary>
        /// <param name="nodo"></param>
        /// <param name="ext"></param>
        private void LoadText(CFNode nodo, string ext)
        {
            CompoundFile compoundFile = _listCF[nodo.CFidx];
            CFStream     stream       = CFUtil.GetStream(ref compoundFile, nodo.Path, nodo.Name);
            MemoryStream memoryStream = MSUtil.CFtoMStream(stream);
            MemoryStream stream2;

            if (ext == "")
            {
                stream2 = MSUtil.RemoveTrailingSegment(memoryStream, 12);
            }
            else if (MSUtil.IsCompressedWithLW77(stream))
            {
                stream2 = MSUtil.UncompressLW77(memoryStream);
            }
            else
            {
                stream2 = MSUtil.RemoveTrailingSegment(memoryStream, 8);
            }
            StreamReader streamReader = new StreamReader(stream2, (ext == ".csv") ? Encoding.ASCII : Encoding.Unicode);

            RtfViewer.Text = streamReader.ReadToEnd();
            byteViewer.SetBytes(memoryStream.ToArray());
        }
Exemple #6
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;
            }
        }
Exemple #7
0
        /// <summary>
        /// Load data in Hexadecimal tab
        /// </summary>
        /// <param name="tempNode"></param>
        private void LoadHexDump(CFNode tempNode)
        {
            CompoundFile compoundFile = _listCF[tempNode.CFidx];

            byteViewer.SetBytes(MSUtil.CFtoMStream(CFUtil.GetStream(ref compoundFile, tempNode.Path, tempNode.Name)).ToArray());
        }