Exemplo n.º 1
0
        private static void WriteAnsiStringArray(BinaryWriter writer, string[] strings)
        {
            ushort num = (ushort)strings.Length;

            writer.Write(num);
            for (int i = 0; i < (int)num; i++)
            {
                BlobRecipientParser.WriteAnsiString(writer, strings[i]);
            }
        }
Exemplo n.º 2
0
        private static void WritePropValue(BinaryWriter writer, PropTag ptag, object value)
        {
            PropType propType = ptag.ValueType();

            writer.Write((uint)ptag);
            PropType propType2 = propType;

            if (propType2 <= PropType.String)
            {
                if (propType2 <= PropType.Boolean)
                {
                    switch (propType2)
                    {
                    case PropType.Short:
                        writer.Write((short)value);
                        return;

                    case PropType.Int:
                        break;

                    default:
                        switch (propType2)
                        {
                        case PropType.Error:
                            break;

                        case PropType.Boolean:
                        {
                            ushort value2 = ((bool)value) ? 1 : 0;
                            writer.Write(value2);
                            return;
                        }

                        default:
                            goto IL_13A;
                        }
                        break;
                    }
                }
                else if (propType2 != PropType.Long)
                {
                    switch (propType2)
                    {
                    case PropType.AnsiString:
                        BlobRecipientParser.WriteAnsiString(writer, (string)value);
                        return;

                    case PropType.String:
                        BlobRecipientParser.WriteString(writer, (string)value);
                        return;

                    default:
                        goto IL_13A;
                    }
                }
                writer.Write((int)value);
                return;
            }
            if (propType2 <= PropType.Binary)
            {
                if (propType2 != PropType.SysTime)
                {
                    if (propType2 != PropType.Binary)
                    {
                        goto IL_13A;
                    }
                    BlobRecipientParser.WriteBinary(writer, (byte[])value);
                    return;
                }
                else
                {
                    try
                    {
                        BlobRecipientParser.WriteDateTime(writer, (ExDateTime)value);
                        return;
                    }
                    catch (ArgumentException)
                    {
                        ExTraceGlobals.StorageTracer.TraceError <PropTag>(0L, "BlobRecipientParser::WritePropValue. Skipping bad SysTime property ptag = {0}.", ptag);
                        return;
                    }
                }
            }
            else
            {
                switch (propType2)
                {
                case PropType.AnsiStringArray:
                    break;

                case PropType.StringArray:
                    BlobRecipientParser.WriteStringArray(writer, (string[])value);
                    return;

                default:
                    if (propType2 != PropType.BinaryArray)
                    {
                        goto IL_13A;
                    }
                    BlobRecipientParser.WriteBinaryArray(writer, (byte[][])value);
                    return;
                }
            }
            BlobRecipientParser.WriteAnsiStringArray(writer, (string[])value);
            return;

IL_13A:
            ExTraceGlobals.StorageTracer.TraceError <PropType>(0L, "BlobRecipientParser::WritePropValue. Skipping susupported propType={0}.", propType);
        }