Example #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();
            }
        }
Example #2
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());
        }
Example #3
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());
        }