Example #1
0
        public ITypedPropertyValue NewProperty(VTPropertyType vType, PropertyContext ctx)
        {
            ITypedPropertyValue pr = null;

            switch (vType)
            {
            case VTPropertyType.VT_I2:
                pr = new VT_I2_Property(vType);
                break;

            case VTPropertyType.VT_I4:
                pr = new VT_I4_Property(vType);
                break;

            case VTPropertyType.VT_R4:
                pr = new VT_R4_Property(vType);
                break;

            case VTPropertyType.VT_LPSTR:
                pr = new VT_LPSTR_Property(vType, ctx.CodePage);
                break;

            case VTPropertyType.VT_FILETIME:
                pr = new VT_FILETIME_Property(vType);
                break;

            case VTPropertyType.VT_DECIMAL:
                pr = new VT_DECIMAL_Property(vType);
                break;

            case VTPropertyType.VT_BOOL:
                pr = new VT_BOOL_Property(vType);
                break;

            case VTPropertyType.VT_VECTOR_HEADER:
                pr = new VT_VectorHeader(vType);
                break;

            case VTPropertyType.VT_EMPTY:
                pr = new VT_EMPTY_Property(vType);
                break;

            default:
                throw new Exception("Unrecognized property type");
            }

            return(pr);
        }
Example #2
0
        public ITypedPropertyValue NewProperty(VTPropertyType vType, int codePage, bool isVariant = false)
        {
            ITypedPropertyValue pr = null;

            switch ((VTPropertyType)((ushort)vType & 0x00FF))
            {
            case VTPropertyType.VT_I1:
                pr = new VT_I1_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_I2:
                pr = new VT_I2_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_I4:
                pr = new VT_I4_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_R4:
                pr = new VT_R4_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_R8:
                pr = new VT_R8_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_CY:
                pr = new VT_CY_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_DATE:
                pr = new VT_DATE_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_INT:
                pr = new VT_INT_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_UINT:
                pr = new VT_UINT_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_UI1:
                pr = new VT_UI1_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_UI2:
                pr = new VT_UI2_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_UI4:
                pr = new VT_UI4_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_UI8:
                pr = new VT_UI8_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_BSTR:
            case VTPropertyType.VT_LPSTR:
                pr = new VT_LPSTR_Property(vType, codePage, isVariant);
                break;

            case VTPropertyType.VT_LPWSTR:
                pr = new VT_LPWSTR_Property(vType, codePage, isVariant);
                break;

            case VTPropertyType.VT_FILETIME:
                pr = new VT_FILETIME_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_DECIMAL:
                pr = new VT_DECIMAL_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_BOOL:
                pr = new VT_BOOL_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_EMPTY:
                pr = new VT_EMPTY_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_VARIANT_VECTOR:
                pr = new VT_VariantVector(vType, codePage, isVariant);
                break;

            case VTPropertyType.VT_CF:
                pr = new VT_CF_Property(vType, isVariant);
                break;

            case VTPropertyType.VT_BLOB_OBJECT:
            case VTPropertyType.VT_BLOB:
                pr = new VT_BLOB_Property(vType, isVariant);
                break;

            default:
                throw new Exception("Unrecognized property type");
            }

            return(pr);
        }