コード例 #1
0
 internal Blip(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipSignature blipSignature)
     : base(0, (uint)blipSignature, escherType, (uint)(imageLength + 16 + 1))
 {
     m_rgbUID      = checkSum;
     m_bTag        = byte.MaxValue;
     m_streamIndex = streamIndex;
     m_imageLength = imageLength;
 }
コード例 #2
0
 internal ImageStream(Stream stream, string name, EscherType escherType)
 {
     m_stream = stream;
     m_name   = name;
     if (escherType == EscherType.MSOFBTBLIP_DIB)
     {
         m_offset = 14;
     }
 }
コード例 #3
0
 internal EscherHeader(ushort ver, uint inst, EscherType fbt, uint cbLength)
 {
     if (ver < 16)
     {
         m_escherHeader = ver;
     }
     if (inst < 4096)
     {
         m_escherHeader |= inst << 4;
     }
     if (65535 >= (int)fbt)
     {
         m_escherHeader = ((ushort)m_escherHeader | ((uint)fbt << 16));
     }
     m_cbLength = cbLength;
 }
コード例 #4
0
 private uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature, int workSheetId)
 {
     if (m_clusters.ContainsKey(workSheetId))
     {
         int dgID = m_clusters[workSheetId];
         m_drawingGroup.IncrementShapeCount(dgID);
     }
     else
     {
         m_clusters.Add(workSheetId, (ushort)(m_clusters.Count + 1));
         int dgID = m_clusters.Count;
         m_drawingGroup.AddCluster(dgID);
         m_drawingGroup.IncrementShapeCount(dgID);
     }
     return(m_bStoreContainer.AddImage(checkSum, streamIndex, imageLength, escherType, blipType, blipSignature));
 }
コード例 #5
0
            private void UpdateImageStreamDGC(string name, Stream imageData, EscherType escherType, out int streamIndex)
            {
                if (m_images != null)
                {
                    for (int i = 0; i < m_images.Count; i++)
                    {
                        if (m_images[i].Name.Equals(name))
                        {
                            streamIndex = i;
                            return;
                        }
                    }
                }
                else
                {
                    m_images = new List <ImageStream>();
                }
                ImageStream item = new ImageStream(imageData, name, escherType);

                m_images.Add(item);
                streamIndex = m_images.Count - 1;
            }
コード例 #6
0
            internal uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature)
            {
                if (m_bSEList == null)
                {
                    m_bSEList = new Hashtable();
                }
                string @string = Encoding.ASCII.GetString(checkSum);

                if (m_bSEList.ContainsKey(@string))
                {
                    BlipStoreEntry obj = (BlipStoreEntry)m_bSEList[@string];
                    obj.ReferenceCount++;
                    return(obj.ReferenceIndex);
                }
                if (m_blipList == null)
                {
                    m_blipList = new ArrayList();
                }
                Blip blip = new Blip(checkSum, streamIndex, imageLength, escherType, blipSignature);

                m_blipList.Add(blip);
                base.Instance = (uint)m_blipList.Count;
                BlipStoreEntry value = new BlipStoreEntry(checkSum, blipType, blip.Length, (uint)m_blipList.Count);

                m_bSEList.Add(@string, value);
                m_totalLength += 44 + imageLength + 8 + 16 + 1;
                return((uint)m_blipList.Count);
            }
コード例 #7
0
            internal uint AddImage(Stream imageData, ImageFormat format, string imageName, int workSheetId, out uint startSPID, out ushort dgID)
            {
                EscherType    escherType    = EscherType.MSOFBTUNKNOWN;
                BlipType      blipType      = BlipType.MSOBLIPUNKNOWN;
                BlipSignature blipSignature = BlipSignature.MSOBIUNKNOWN;

                if (format.Equals(ImageFormat.Bmp))
                {
                    escherType    = EscherType.MSOFBTBLIP_DIB;
                    blipType      = BlipType.MSOBLIPDIB;
                    blipSignature = BlipSignature.MSOBIDIB;
                }
                else if (format.Equals(ImageFormat.Jpeg))
                {
                    escherType    = EscherType.MSOFBTBLIP_JPEG;
                    blipType      = BlipType.MSOBLIPJPEG;
                    blipSignature = BlipSignature.MSOBIJFIF;
                }
                else if (format.Equals(ImageFormat.Gif))
                {
                    escherType    = EscherType.MSOFBTBLIP_GIF;
                    blipType      = BlipType.MSOBLIPPNG;
                    blipSignature = BlipSignature.MSOBIPNG;
                }
                else if (format.Equals(ImageFormat.Png))
                {
                    escherType    = EscherType.MSOFBTBLIP_GIF;
                    blipType      = BlipType.MSOBLIPPNG;
                    blipSignature = BlipSignature.MSOBIPNG;
                }
                if (m_clusters == null)
                {
                    m_clusters = new Dictionary <int, ushort>();
                }
                if (m_bStoreContainer == null)
                {
                    m_bStoreContainer = new BlipStoreContainer();
                }
                if (m_imageTable == null)
                {
                    m_imageTable = new Dictionary <string, CheckSumImage>();
                }
                int           num = (int)imageData.Length;
                CheckSumImage checkSumImage;

                if (m_imageTable.ContainsKey(imageName))
                {
                    checkSumImage = m_imageTable[imageName];
                }
                else
                {
                    byte[] checkSum    = CheckSum(imageData);
                    int    streamIndex = m_bStoreContainer.GetStreamPosFromCheckSum(checkSum);
                    if (streamIndex == -1)
                    {
                        UpdateImageStreamDGC(imageName, imageData, escherType, out streamIndex);
                    }
                    checkSumImage = new CheckSumImage(checkSum, streamIndex);
                    m_imageTable.Add(imageName, checkSumImage);
                }
                if (escherType == EscherType.MSOFBTBLIP_DIB)
                {
                    num -= 14;
                    StreamList[checkSumImage.StreamIndex].Offset = 14;
                }
                uint result = AddImage(checkSumImage.CheckSum, checkSumImage.StreamIndex, num, escherType, blipType, blipSignature, workSheetId);

                dgID      = m_clusters[workSheetId];
                startSPID = m_drawingGroup.GetStartingSPID(dgID);
                return(result);
            }