Esempio n. 1
0
        public static string GetDescription(this PropertyIdentifiersSummaryInfo identifier)
        {
            switch (identifier)
            {
            case PropertyIdentifiersSummaryInfo.CodePageString:
                return("CodePage");

            case PropertyIdentifiersSummaryInfo.PidsiTitle:
                return("Title");

            case PropertyIdentifiersSummaryInfo.PidsiSubject:
                return("Subject");

            case PropertyIdentifiersSummaryInfo.PidsiAuthor:
                return("Author");

            case PropertyIdentifiersSummaryInfo.PidsiLastauthor:
                return("Last Author");

            case PropertyIdentifiersSummaryInfo.PidsiAppname:
                return("Application Name");

            case PropertyIdentifiersSummaryInfo.PidsiCreateDtm:
                return("Create Time");

            case PropertyIdentifiersSummaryInfo.PidsiLastsaveDtm:
                return("Last Modified Time");

            case PropertyIdentifiersSummaryInfo.PidsiKeywords:
                return("Keywords");

            case PropertyIdentifiersSummaryInfo.PidsiDocSecurity:
                return("Document Security");

            default: return(string.Empty);
            }
        }
        public static String GetDescription(this PropertyIdentifiersSummaryInfo identifier)
        {
            switch (identifier)
            {
            case PropertyIdentifiersSummaryInfo.CodePageString:
                return("CodePage");

            case PropertyIdentifiersSummaryInfo.PIDSI_TITLE:
                return("Title");

            case PropertyIdentifiersSummaryInfo.PIDSI_SUBJECT:
                return("Subject");

            case PropertyIdentifiersSummaryInfo.PIDSI_AUTHOR:
                return("Author");

            case PropertyIdentifiersSummaryInfo.PIDSI_LASTAUTHOR:
                return("Last Author");

            case PropertyIdentifiersSummaryInfo.PIDSI_APPNAME:
                return("Application Name");

            case PropertyIdentifiersSummaryInfo.PIDSI_CREATE_DTM:
                return("Create Time");

            case PropertyIdentifiersSummaryInfo.PIDSI_LASTSAVE_DTM:
                return("Last Modified Time");

            case PropertyIdentifiersSummaryInfo.PIDSI_KEYWORDS:
                return("Keywords");

            case PropertyIdentifiersSummaryInfo.PIDSI_DOC_SECURITY:
                return("Document Security");

            default: return(String.Empty);
            }
        }
Esempio n. 3
0
        public List <ITypedPropertyValue> ReadProperty(PropertyIdentifiersSummaryInfo propertyIdentifier, BinaryReader br)
        {
            List <ITypedPropertyValue> res = new List <ITypedPropertyValue>();
            bool isVariant         = false;
            PropertyDimensions dim = PropertyDimensions.IsScalar;

            UInt16 pVal = br.ReadUInt16();

            VTPropertyType vType = (VTPropertyType)(pVal & 0x00FF);

            if ((pVal & 0x1000) != 0)
            {
                dim = PropertyDimensions.IsVector;
            }
            else if ((pVal & 0x2000) != 0)
            {
                dim = PropertyDimensions.IsArray;
            }

            isVariant = ((pVal & 0x00FF) == 0x000C);

            br.ReadUInt16(); // Ushort Padding

            switch (dim)
            {
            case PropertyDimensions.IsVector:

                ITypedPropertyValue vectorHeader = factory.NewProperty(VTPropertyType.VT_VECTOR_HEADER, ctx);
                vectorHeader.Read(br);

                uint nItems = (uint)vectorHeader.PropertyValue;

                for (int i = 0; i < nItems; i++)
                {
                    VTPropertyType vTypeItem = VTPropertyType.VT_EMPTY;

                    if (isVariant)
                    {
                        UInt16 pValItem = br.ReadUInt16();
                        vTypeItem = (VTPropertyType)(pValItem & 0x00FF);
                        br.ReadUInt16();     // Ushort Padding
                    }
                    else
                    {
                        vTypeItem = vType;
                    }

                    var p = factory.NewProperty(vTypeItem, ctx);

                    p.Read(br);
                    res.Add(p);
                }

                break;

            default:

                //Scalar property
                ITypedPropertyValue pr = factory.NewProperty(vType, ctx);

                pr.Read(br);

                if (propertyIdentifier == PropertyIdentifiersSummaryInfo.CodePageString)
                {
                    this.ctx.CodePage = (short)pr.PropertyValue;
                }

                res.Add(pr);
                break;
            }

            return(res);
        }
Esempio n. 4
0
        public List <ITypedPropertyValue> ReadProperty(PropertyIdentifiersSummaryInfo propertyIdentifier,
                                                       BinaryReader br)
        {
            var res = new List <ITypedPropertyValue>();
            var dim = PropertyDimensions.IsScalar;

            var pVal = br.ReadUInt16();

            var vType = (VtPropertyType)(pVal & 0x00FF);

            if ((pVal & 0x1000) != 0)
            {
                dim = PropertyDimensions.IsVector;
            }
            else if ((pVal & 0x2000) != 0)
            {
                dim = PropertyDimensions.IsArray;
            }

            var isVariant = ((pVal & 0x00FF) == 0x000C);

            br.ReadUInt16(); // Ushort Padding

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (dim)
            {
            case PropertyDimensions.IsVector:

                var vectorHeader = _factory.NewProperty(VtPropertyType.VtVectorHeader, _ctx);
                vectorHeader.Read(br);

                var nItems = (uint)vectorHeader.PropertyValue;

                for (var i = 0; i < nItems; i++)
                {
                    VtPropertyType vTypeItem;

                    if (isVariant)
                    {
                        var pValItem = br.ReadUInt16();
                        vTypeItem = (VtPropertyType)(pValItem & 0x00FF);
                        br.ReadUInt16();     // Ushort Padding
                    }
                    else
                    {
                        vTypeItem = vType;
                    }

                    var p = _factory.NewProperty(vTypeItem, _ctx);

                    p.Read(br);
                    res.Add(p);
                }

                break;

            //Scalar property
            default:
                var pr = _factory.NewProperty(vType, _ctx);

                pr.Read(br);

                if (propertyIdentifier == PropertyIdentifiersSummaryInfo.CodePageString)
                {
                    _ctx.CodePage = (short)pr.PropertyValue;
                }

                res.Add(pr);
                break;
            }

            return(res);
        }