コード例 #1
0
 internal OLEProperty(OLEPropertiesContainer container)
 {
     this.container = container;
 }
コード例 #2
0
        internal OLEPropertiesContainer(CFStream cfStream)
        {
            var pStream = new PropertySetStream();

            this.cfStream = cfStream;
            pStream       = new PropertySetStream();
            pStream.Read(new BinaryReader(new StreamDecorator(cfStream)));

            switch (pStream.FMTID0.ToString("B").ToUpperInvariant())
            {
            case "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}":
                ContainerType = ContainerType.SummaryInfo;
                break;

            case "{D5CDD502-2E9C-101B-9397-08002B2CF9AE}":
                ContainerType = ContainerType.DocumentSummaryInfo;
                break;

            default:
                ContainerType = ContainerType.AppSpecific;
                break;
            }


            PropertyNames = (Dictionary <uint, string>)pStream.PropertySet0.Properties
                            .FirstOrDefault(p => p.PropertyType == PropertyType.DictionaryProperty);

            Context = new PropertyContext
            {
                CodePage = pStream.PropertySet0.PropertyContext.CodePage
            };

            for (var i = 0; i < pStream.PropertySet0.Properties.Count; i++)
            {
                if (pStream.PropertySet0.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 0)
                {
                    continue;
                }
                //if (pStream.PropertySet0.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 1) continue;
                //if (pStream.PropertySet0.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 0x80000000) continue;

                var p   = (ITypedPropertyValue)pStream.PropertySet0.Properties[i];
                var poi = pStream.PropertySet0.PropertyIdentifierAndOffsets[i];

                var op = new OLEProperty(this);

                op.VTType             = p.VTType;
                op.PropertyIdentifier = pStream.PropertySet0.PropertyIdentifierAndOffsets[i].PropertyIdentifier;
                op.Value = p.Value;


                properties.Add(op);
            }

            if (pStream.NumPropertySets == 2)
            {
                UserDefinedProperties =
                    new OLEPropertiesContainer(Context.CodePage, ContainerType.UserDefinedProperties);
                HasUserDefinedProperties = true;

                UserDefinedProperties.ContainerType = ContainerType.UserDefinedProperties;

                for (var i = 0; i < pStream.PropertySet1.Properties.Count; i++)
                {
                    if (pStream.PropertySet1.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 0)
                    {
                        continue;
                    }
                    //if (pStream.PropertySet1.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 1) continue;
                    if (pStream.PropertySet1.PropertyIdentifierAndOffsets[i].PropertyIdentifier == 0x80000000)
                    {
                        continue;
                    }

                    var p   = (ITypedPropertyValue)pStream.PropertySet1.Properties[i];
                    var poi = pStream.PropertySet1.PropertyIdentifierAndOffsets[i];

                    var op = new OLEProperty(UserDefinedProperties);

                    op.VTType             = p.VTType;
                    op.PropertyIdentifier = pStream.PropertySet1.PropertyIdentifierAndOffsets[i].PropertyIdentifier;
                    op.Value = p.Value;

                    UserDefinedProperties.properties.Add(op);
                }

                UserDefinedProperties.PropertyNames = (Dictionary <uint, string>)pStream.PropertySet1.Properties
                                                      .Where(p => p.PropertyType == PropertyType.DictionaryProperty).FirstOrDefault()?.Value;
            }
        }