当前位置: 首页>>代码示例>>C#>>正文


C# BsonWriter.WriteBoolean方法代码示例

本文整理汇总了C#中MongoDB.Bson.IO.BsonWriter.WriteBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# BsonWriter.WriteBoolean方法的具体用法?C# BsonWriter.WriteBoolean怎么用?C# BsonWriter.WriteBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB.Bson.IO.BsonWriter的用法示例。


在下文中一共展示了BsonWriter.WriteBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Serialize

 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     bool serializeIdFirst
 )
 {
     bsonWriter.WriteBoolean((bool) value);
 }
开发者ID:tomthink,项目名称:mongo-csharp-driver,代码行数:9,代码来源:BsonPrimitiveSerializers.cs

示例2: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlTextElement value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlTextElementSerializer.Serialize()");

            OXmlTextElement element = (OXmlTextElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "Text");
            if (element.Text != null)
                bsonWriter.WriteString("Text", element.Text);
            if (element.PreserveSpace)
                bsonWriter.WriteBoolean("PreserveSpace", element.PreserveSpace);
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:16,代码来源:OXmlTextElementSerializer.cs

示例3: Serialize

 /// <summary>
 /// Serializes an object to a BsonWriter.
 /// </summary>
 /// <param name="bsonWriter">The BsonWriter.</param>
 /// <param name="nominalType">The nominal type.</param>
 /// <param name="value">The object.</param>
 /// <param name="options">The serialization options.</param>
 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     IBsonSerializationOptions options)
 {
     if (value == null)
     {
         bsonWriter.WriteNull();
     }
     else
     {
         var cultureInfo = (CultureInfo)value;
         if (cultureInfo.UseUserOverride)
         {
             // the default for UseUserOverride is true so we don't need to serialize it
             bsonWriter.WriteString(cultureInfo.Name);
         }
         else
         {
             bsonWriter.WriteStartDocument();
             bsonWriter.WriteString("Name", cultureInfo.Name);
             bsonWriter.WriteBoolean("UseUserOverride", cultureInfo.UseUserOverride);
             bsonWriter.WriteEndDocument();
         }
     }
 }
开发者ID:abel,项目名称:sinan,代码行数:34,代码来源:NetPrimitiveSerializers.cs

示例4: SerializeMember

        private void SerializeMember(BsonWriter bsonWriter, object obj, BsonMemberMap memberMap)
        {
            var value = memberMap.Getter(obj);

            if (!memberMap.ShouldSerialize(obj, value))
            {
                return; // don't serialize member
            }

            bsonWriter.WriteName(memberMap.ElementName);
            var nominalType = memberMap.MemberType;
            if (value == null && nominalType.IsInterface)
            {
                bsonWriter.WriteNull();
            }
            else if (value == null && memberMap.MemberTypeIsBsonValue)
            {
                bsonWriter.WriteStartDocument();
                bsonWriter.WriteBoolean("_csharpnull", true);
                bsonWriter.WriteEndDocument();
            }
            else
            {
                var actualType = (value == null) ? nominalType : value.GetType();
                var serializer = memberMap.GetSerializer(actualType);
                serializer.Serialize(bsonWriter, nominalType, value, memberMap.SerializationOptions);
            }
        }
开发者ID:robinNode,项目名称:mongo-csharp-driver,代码行数:28,代码来源:BsonClassMapSerializer.cs

示例5: Serialize

        /// <summary>
        /// Serializes an object to a BsonWriter.
        /// </summary>
        /// <param name="bsonWriter">The BsonWriter.</param>
        /// <param name="nominalType">The nominal type.</param>
        /// <param name="value">The object.</param>
        /// <param name="options">The serialization options.</param>
        public override void Serialize(
            BsonWriter bsonWriter,
            Type nominalType,
            object value,
            IBsonSerializationOptions options)
        {
            if (value == null)
            {
                bsonWriter.WriteNull();
            }
            else
            {
                var profileInfo = (SystemProfileInfo)value;

                bsonWriter.WriteStartDocument();
                bsonWriter.WriteDateTime("ts", BsonUtils.ToMillisecondsSinceEpoch(profileInfo.Timestamp));
                if (profileInfo.Info != null)
                {
                    bsonWriter.WriteString("info", profileInfo.Info);
                }
                if (profileInfo.Op != null)
                {
                    bsonWriter.WriteString("op", profileInfo.Op);
                }
                if (profileInfo.Namespace != null)
                {
                    bsonWriter.WriteString("ns", profileInfo.Namespace);
                }
                if (profileInfo.Command != null)
                {
                    bsonWriter.WriteName("command");
                    profileInfo.Command.WriteTo(bsonWriter);
                }
                if (profileInfo.Query != null)
                {
                    bsonWriter.WriteName("query");
                    profileInfo.Query.WriteTo(bsonWriter);
                }
                if (profileInfo.UpdateObject != null)
                {
                    bsonWriter.WriteName("updateobj");
                    profileInfo.UpdateObject.WriteTo(bsonWriter);
                }
                if (profileInfo.CursorId != 0)
                {
                    bsonWriter.WriteInt64("cursorid", profileInfo.CursorId);
                }
                if (profileInfo.NumberToReturn != 0)
                {
                    bsonWriter.WriteInt32("ntoreturn", profileInfo.NumberToReturn);
                }
                if (profileInfo.NumberToSkip != 0)
                {
                    bsonWriter.WriteInt32("ntoskip", profileInfo.NumberToSkip);
                }
                if (profileInfo.Exhaust)
                {
                    bsonWriter.WriteBoolean("exhaust", profileInfo.Exhaust);
                }
                if (profileInfo.NumberScanned != 0)
                {
                    bsonWriter.WriteInt32("nscanned", profileInfo.NumberScanned);
                }
                if (profileInfo.IdHack)
                {
                    bsonWriter.WriteBoolean("idhack", profileInfo.IdHack);
                }
                if (profileInfo.ScanAndOrder)
                {
                    bsonWriter.WriteBoolean("scanAndOrder", profileInfo.ScanAndOrder);
                }
                if (profileInfo.Moved)
                {
                    bsonWriter.WriteBoolean("moved", profileInfo.Moved);
                }
                if (profileInfo.FastMod)
                {
                    bsonWriter.WriteBoolean("fastmod", profileInfo.FastMod);
                }
                if (profileInfo.FastModInsert)
                {
                    bsonWriter.WriteBoolean("fastmodinsert", profileInfo.FastModInsert);
                }
                if (profileInfo.Upsert)
                {
                    bsonWriter.WriteBoolean("upsert", profileInfo.Upsert);
                }
                if (profileInfo.KeyUpdates != 0)
                {
                    bsonWriter.WriteInt32("keyUpdates", profileInfo.KeyUpdates);
                }
                if (profileInfo.Exception != null)
                {
//.........这里部分代码省略.........
开发者ID:abel,项目名称:sinan,代码行数:101,代码来源:SystemProfileInfo.cs

示例6: Serialize

 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     bool serializeIdFirst
 )
 {
     if (value == null) {
         bsonWriter.WriteNull();
     } else {
         bsonWriter.WriteBoolean(((BsonBoolean) value).Value);
     }
 }
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:13,代码来源:BsonValueSerializers.cs

示例7: WriteStyleParagraphProperties

 private static void WriteStyleParagraphProperties(BsonWriter bsonWriter, OXmlStyleParagraphProperties element)
 {
     if (element.AdjustRightIndent != null)
         bsonWriter.WriteBoolean("AdjustRightIndent", (bool)element.AdjustRightIndent);
     if (element.AutoSpaceDE != null)
         bsonWriter.WriteBoolean("AutoSpaceDE", (bool)element.AutoSpaceDE);
     if (element.AutoSpaceDN != null)
         bsonWriter.WriteBoolean("AutoSpaceDN", (bool)element.AutoSpaceDN);
     if (element.BiDi != null)
         bsonWriter.WriteBoolean("BiDi", (bool)element.BiDi);
     if (element.ContextualSpacing != null)
         bsonWriter.WriteBoolean("ContextualSpacing", (bool)element.ContextualSpacing);
     if (element.Justification != null)
         bsonWriter.WriteString("Justification", element.Justification.ToString());
     if (element.KeepLines != null)
         bsonWriter.WriteBoolean("KeepLines", (bool)element.KeepLines);
     if (element.KeepNext != null)
         bsonWriter.WriteBoolean("KeepNext", (bool)element.KeepNext);
     if (element.Kinsoku != null)
         bsonWriter.WriteBoolean("Kinsoku", (bool)element.Kinsoku);
     if (element.MirrorIndents != null)
         bsonWriter.WriteBoolean("MirrorIndents", (bool)element.MirrorIndents);
     if (element.OutlineLevel != null)
         bsonWriter.WriteInt32("OutlineLevel", (int)element.OutlineLevel);
     if (element.OverflowPunctuation != null)
         bsonWriter.WriteBoolean("OverflowPunctuation", (bool)element.OverflowPunctuation);
     if (element.PageBreakBefore != null)
         bsonWriter.WriteBoolean("PageBreakBefore", (bool)element.PageBreakBefore);
     if (element.SnapToGrid != null)
         bsonWriter.WriteBoolean("SnapToGrid", (bool)element.SnapToGrid);
     if (element.SpacingBetweenLines != null)
     {
         bsonWriter.WriteStartDocument("SpacingBetweenLines");
         WriteSpacingBetweenLines(bsonWriter, element.SpacingBetweenLines);
         bsonWriter.WriteEndDocument();
     }
     if (element.SuppressAutoHyphens != null)
         bsonWriter.WriteBoolean("SuppressAutoHyphens", (bool)element.SuppressAutoHyphens);
     if (element.SuppressLineNumbers != null)
         bsonWriter.WriteBoolean("SuppressLineNumbers", (bool)element.SuppressLineNumbers);
     if (element.SuppressOverlap != null)
         bsonWriter.WriteBoolean("SuppressOverlap", (bool)element.SuppressOverlap);
     if (element.Tabs != null)
     {
         bsonWriter.WriteStartArray("Tabs");
         WriteTabs(bsonWriter, element.Tabs);
         bsonWriter.WriteEndArray();
     }
     if (element.TextAlignment != null)
         bsonWriter.WriteString("TextAlignment", element.TextAlignment.ToString());
     if (element.TextBoxTightWrap != null)
         bsonWriter.WriteString("TextBoxTightWrap", element.TextBoxTightWrap.ToString());
     if (element.TextDirection != null)
         bsonWriter.WriteString("TextDirection", element.TextDirection.ToString());
     if (element.TopLinePunctuation != null)
         bsonWriter.WriteBoolean("TopLinePunctuation", (bool)element.TopLinePunctuation);
     if (element.WidowControl != null)
         bsonWriter.WriteBoolean("WidowControl", (bool)element.WidowControl);
     if (element.WordWrap != null)
         bsonWriter.WriteBoolean("WordWrap", (bool)element.WordWrap);
 }
开发者ID:labeuze,项目名称:source,代码行数:61,代码来源:OXmlStyleElementSerializer.cs

示例8:

 void IBsonSerializable.Serialize(BsonWriter bsonWriter, Type nominalType, IBsonSerializationOptions options)
 {
     bsonWriter.WriteStartDocument();
     bsonWriter.WriteDateTime("ts", BsonUtils.ToMillisecondsSinceEpoch(_timestamp));
     if (_info != null)
     {
         bsonWriter.WriteString("info", _info);
     }
     if (_op != null)
     {
         bsonWriter.WriteString("op", _op);
     }
     if (_namespace != null)
     {
         bsonWriter.WriteString("ns", _namespace);
     }
     if (_command != null)
     {
         bsonWriter.WriteName("command");
         _command.WriteTo(bsonWriter);
     }
     if (_query != null)
     {
         bsonWriter.WriteName("query");
         _query.WriteTo(bsonWriter);
     }
     if (_updateObject != null)
     {
         bsonWriter.WriteName("updateobj");
         _updateObject.WriteTo(bsonWriter);
     }
     if (_cursorId != 0)
     {
         bsonWriter.WriteInt64("cursorid", _cursorId);
     }
     if (_numberToReturn != 0)
     {
         bsonWriter.WriteInt32("ntoreturn", _numberToReturn);
     }
     if (_numberToSkip != 0)
     {
         bsonWriter.WriteInt32("ntoskip", _numberToSkip);
     }
     if (_exhaust)
     {
         bsonWriter.WriteBoolean("exhaust", _exhaust);
     }
     if (_numberScanned != 0)
     {
         bsonWriter.WriteInt32("nscanned", _numberScanned);
     }
     if (_idHack)
     {
         bsonWriter.WriteBoolean("idhack", _idHack);
     }
     if (_scanAndOrder)
     {
         bsonWriter.WriteBoolean("scanAndOrder", _scanAndOrder);
     }
     if (_moved)
     {
         bsonWriter.WriteBoolean("moved", _moved);
     }
     if (_fastMod)
     {
         bsonWriter.WriteBoolean("fastmod", _fastMod);
     }
     if (_fastModInsert)
     {
         bsonWriter.WriteBoolean("fastmodinsert", _fastModInsert);
     }
     if (_upsert)
     {
         bsonWriter.WriteBoolean("upsert", _upsert);
     }
     if (_keyUpdates != 0)
     {
         bsonWriter.WriteInt32("keyUpdates", _keyUpdates);
     }
     if (_exception != null)
     {
         bsonWriter.WriteString("exception", _exception);
     }
     if (_exceptionCode != 0)
     {
         bsonWriter.WriteInt32("exceptionCode", _exceptionCode);
     }
     if (_numberReturned != 0)
     {
         bsonWriter.WriteInt32("nreturned", _numberReturned);
     }
     if (_responseLength != 0)
     {
         bsonWriter.WriteInt32("responseLength", _responseLength);
     }
     bsonWriter.WriteDouble("millis", _duration.TotalMilliseconds);
     if (_client != null)
     {
         bsonWriter.WriteString("client", _client);
     }
//.........这里部分代码省略.........
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:101,代码来源:SystemProfileInfo.cs

示例9: SerializePolygon

 private static void SerializePolygon(BsonWriter bsonWriter, OXmlPolygon polygon)
 {
     bsonWriter.WriteStartDocument("Polygon");
     if (polygon.StartPoint != null)
     {
         bsonWriter.WriteInt64("StartPointX", polygon.StartPoint.X);
         bsonWriter.WriteInt64("StartPointY", polygon.StartPoint.Y);
     }
     bsonWriter.WriteStartArray("LinesTo");
     foreach (OXmlPoint2DType lineTo in polygon.LinesTo)
     {
         bsonWriter.WriteStartDocument();
         bsonWriter.WriteInt64("X", lineTo.X);
         bsonWriter.WriteInt64("Y", lineTo.Y);
         bsonWriter.WriteEndDocument();
     }
     bsonWriter.WriteEndArray();
     if (polygon.Edited != null)
         bsonWriter.WriteBoolean("Edited", (bool)polygon.Edited);
     bsonWriter.WriteEndDocument();
 }
开发者ID:labeuze,项目名称:source,代码行数:21,代码来源:OXmlPictureElementSerializer.cs

示例10: Serialize

        public override void Serialize(BsonWriter bsonWriter, Type nominalType, object value, IBsonSerializationOptions options)
        {
            if (value == null)
                throw new PBException("serialize OXmlPictureElement value is null");
            if (_trace)
                pb.Trace.WriteLine("OXmlPictureElementSerializer.Serialize()");

            OXmlPictureElement element = (OXmlPictureElement)value;
            bsonWriter.WriteStartDocument();
            bsonWriter.WriteString("Type", "Picture");
            bsonWriter.WriteString("File", element.File);
            if (element.Name != null)
                bsonWriter.WriteString("Name", element.Name);
            if (element.Description != null)
                bsonWriter.WriteString("Description", element.Description);
            if (element.Width != null)
                bsonWriter.WriteInt32("Width", (int)element.Width);
            if (element.Height != null)
                bsonWriter.WriteInt32("Height", (int)element.Height);
            if (element.Rotation != 0)
                bsonWriter.WriteInt32("Rotation", element.Rotation);
            if (element.HorizontalFlip)
                bsonWriter.WriteBoolean("HorizontalFlip", element.HorizontalFlip);
            if (element.VerticalFlip)
                bsonWriter.WriteBoolean("VerticalFlip", element.VerticalFlip);
            if (element.CompressionState != A.BlipCompressionValues.Print)
                bsonWriter.WriteString("CompressionState", element.CompressionState.ToString());
            if (element.PresetShape != A.ShapeTypeValues.Rectangle)
                bsonWriter.WriteString("PresetShape", element.PresetShape.ToString());
            //bsonWriter.WriteString("DrawingMode", element.PictureDrawing.DrawingMode.ToString());
            bsonWriter.WriteString("DrawingType", element.PictureDrawing.GetDrawingType().ToString());
            if (element.PictureDrawing.DrawingMode == OXmlPictureDrawingMode.Anchor)
            {
                OXmlAnchorPictureDrawing anchor = (OXmlAnchorPictureDrawing)element.PictureDrawing;
                //bsonWriter.WriteString("WrapType", anchor.Wrap.WrapType.ToString());
                bsonWriter.WriteString("HorizontalRelativeFrom", anchor.HorizontalRelativeFrom.ToString());
                if (anchor.HorizontalPositionOffset != null)
                    bsonWriter.WriteInt32("HorizontalPositionOffset", (int)anchor.HorizontalPositionOffset);
                if (anchor.HorizontalAlignment != null)
                    bsonWriter.WriteString("HorizontalAlignment", anchor.HorizontalAlignment);
                bsonWriter.WriteString("VerticalRelativeFrom", anchor.VerticalRelativeFrom.ToString());
                if (anchor.VerticalPositionOffset != null)
                    bsonWriter.WriteInt32("VerticalPositionOffset", (int)anchor.VerticalPositionOffset);
                if (anchor.VerticalAlignment != null)
                    bsonWriter.WriteString("VerticalAlignment", anchor.VerticalAlignment);
                switch (anchor.Wrap.WrapType)
                {
                    case OXmlAnchorWrapType.WrapSquare:
                        SerializeWrapSquare(bsonWriter, (OXmlAnchorWrapSquare)anchor.Wrap);
                        break;
                    case OXmlAnchorWrapType.WrapTight:
                        SerializeWrapTight(bsonWriter, (OXmlAnchorWrapTight)anchor.Wrap);
                        break;
                    case OXmlAnchorWrapType.WrapTopAndBottom:
                        SerializeWrapTopBottom(bsonWriter, (OXmlAnchorWrapTopAndBottom)anchor.Wrap);
                        break;
                    default:
                        throw new PBException($"WrapType {anchor.Wrap.WrapType} serialize not implemented");
                }
            }
            bsonWriter.WriteEndDocument();
        }
开发者ID:labeuze,项目名称:source,代码行数:62,代码来源:OXmlPictureElementSerializer.cs

示例11:

 void IBsonSerializable.Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     IBsonSerializationOptions options
 )
 {
     bsonWriter.WriteStartDocument();
     bsonWriter.WriteDateTime("ts", BsonUtils.ToMillisecondsSinceEpoch(timestamp));
     if (info != null) {
         bsonWriter.WriteString("info", info);
     }
     if (op != null) {
         bsonWriter.WriteString("op", op);
     }
     if (@namespace != null) {
         bsonWriter.WriteString("ns", @namespace);
     }
     if (command != null) {
         bsonWriter.WriteName("command");
         command.WriteTo(bsonWriter);
     }
     if (query != null) {
         bsonWriter.WriteName("query");
         query.WriteTo(bsonWriter);
     }
     if (updateObject != null) {
         bsonWriter.WriteName("updateobj");
         updateObject.WriteTo(bsonWriter);
     }
     if (cursorId != 0) {
         bsonWriter.WriteInt64("cursorid", cursorId);
     }
     if (numberToReturn != 0) {
         bsonWriter.WriteInt32("ntoreturn", numberToReturn);
     }
     if (numberToSkip != 0) {
         bsonWriter.WriteInt32("ntoskip", numberToSkip);
     }
     if (exhaust) {
         bsonWriter.WriteBoolean("exhaust", exhaust);
     }
     if (numberScanned != 0) {
         bsonWriter.WriteInt32("nscanned", numberScanned);
     }
     if (idHack) {
         bsonWriter.WriteBoolean("idhack", idHack);
     }
     if (scanAndOrder) {
         bsonWriter.WriteBoolean("scanAndOrder", scanAndOrder);
     }
     if (moved) {
         bsonWriter.WriteBoolean("moved", moved);
     }
     if (fastMod) {
         bsonWriter.WriteBoolean("fastmod", fastMod);
     }
     if (fastModInsert) {
         bsonWriter.WriteBoolean("fastmodinsert", fastModInsert);
     }
     if (upsert) {
         bsonWriter.WriteBoolean("upsert", upsert);
     }
     if (keyUpdates != 0) {
         bsonWriter.WriteInt32("keyUpdates", keyUpdates);
     }
     if (exception != null) {
         bsonWriter.WriteString("exception", exception);
     }
     if (exceptionCode != 0) {
         bsonWriter.WriteInt32("exceptionCode", exceptionCode);
     }
     if (numberReturned != 0) {
         bsonWriter.WriteInt32("nreturned", numberReturned);
     }
     if (responseLength != 0) {
         bsonWriter.WriteInt32("responseLength", responseLength);
     }
     bsonWriter.WriteDouble("millis", duration.TotalMilliseconds);
     if (client != null) {
         bsonWriter.WriteString("client", client);
     }
     if (user != null) {
         bsonWriter.WriteString("user", user);
     }
     if (error != null) {
         bsonWriter.WriteString("err", error);
     }
     if (abbreviated != null) {
         bsonWriter.WriteString("abbreviated", abbreviated);
     }
     bsonWriter.WriteEndDocument();
 }
开发者ID:vshlos,项目名称:mongo-csharp-driver,代码行数:92,代码来源:SystemProfileInfo.cs

示例12: Serialize

 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     bool serializeIdFirst
 )
 {
     var boolValue = (bool) value;
     switch (representation) {
         case BsonType.Boolean:
             bsonWriter.WriteBoolean(boolValue);
             break;
         case BsonType.Double:
             bsonWriter.WriteDouble(boolValue ? 1.0 : 0.0);
             break;
         case BsonType.Int32:
             bsonWriter.WriteInt32(boolValue ? 1 : 0);
             break;
         case BsonType.Int64:
             bsonWriter.WriteInt64(boolValue ? 1 : 0);
             break;
         case BsonType.String:
             bsonWriter.WriteString(XmlConvert.ToString(boolValue));
             break;
         default:
             var message = string.Format("'{0}' is not a valid representation for type 'Boolean'", representation);
             throw new BsonSerializationException(message);
     }
 }
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:29,代码来源:BsonPrimitiveSerializers.cs

示例13: WriteStyleRunProperties

 private static void WriteStyleRunProperties(BsonWriter bsonWriter, OXmlStyleRunProperties element)
 {
     if (element.Bold != null)
         bsonWriter.WriteBoolean("Bold", (bool)element.Bold);
     if (element.BoldComplexScript != null)
         bsonWriter.WriteBoolean("BoldComplexScript", (bool)element.BoldComplexScript);
     if (element.Caps != null)
         bsonWriter.WriteBoolean("Caps", (bool)element.Caps);
     if (element.CharacterScale != null)
         bsonWriter.WriteInt32("CharacterScale", (int)element.CharacterScale);
     if (element.DoubleStrike != null)
         bsonWriter.WriteBoolean("DoubleStrike", (bool)element.DoubleStrike);
     if (element.Emboss != null)
         bsonWriter.WriteBoolean("Emboss", (bool)element.Emboss);
     if (element.Emphasis != null)
         bsonWriter.WriteString("Emphasis", element.Emphasis.ToString());
     if (element.FontSize != null)
         bsonWriter.WriteString("FontSize", element.FontSize);
     if (element.FontSizeComplexScript != null)
         bsonWriter.WriteString("FontSizeComplexScript", element.FontSizeComplexScript);
     if (element.Imprint != null)
         bsonWriter.WriteBoolean("Imprint", (bool)element.Imprint);
     if (element.Italic != null)
         bsonWriter.WriteBoolean("Italic", (bool)element.Italic);
     if (element.ItalicComplexScript != null)
         bsonWriter.WriteBoolean("ItalicComplexScript", (bool)element.ItalicComplexScript);
     if (element.Kern != null)
         bsonWriter.WriteInt32("Kern", (int)element.Kern);
     if (element.NoProof != null)
         bsonWriter.WriteBoolean("NoProof", (bool)element.NoProof);
     if (element.Outline != null)
         bsonWriter.WriteBoolean("Outline", (bool)element.Outline);
     if (element.Position != null)
         bsonWriter.WriteString("Position", element.Position);
     if (element.RunFonts != null)
     {
         bsonWriter.WriteStartDocument("RunFonts");
         OXmlCommonSerializer.WriteRunFonts(bsonWriter, element.RunFonts);
         bsonWriter.WriteEndDocument();
     }
     if (element.Shadow != null)
         bsonWriter.WriteBoolean("Shadow", (bool)element.Shadow);
     if (element.SmallCaps != null)
         bsonWriter.WriteBoolean("SmallCaps", (bool)element.SmallCaps);
     if (element.SnapToGrid != null)
         bsonWriter.WriteBoolean("SnapToGrid", (bool)element.SnapToGrid);
     if (element.Spacing != null)
         bsonWriter.WriteInt32("Spacing", (int)element.Spacing);
     if (element.SpecVanish != null)
         bsonWriter.WriteBoolean("SpecVanish", (bool)element.SpecVanish);
     if (element.Strike != null)
         bsonWriter.WriteBoolean("Strike", (bool)element.Strike);
     if (element.TextEffect != null)
         bsonWriter.WriteString("TextEffect", element.TextEffect.ToString());
     if (element.Vanish != null)
         bsonWriter.WriteBoolean("Vanish", (bool)element.Vanish);
     if (element.VerticalTextAlignment != null)
         bsonWriter.WriteString("VerticalTextAlignment", element.VerticalTextAlignment.ToString());
     if (element.WebHidden != null)
         bsonWriter.WriteBoolean("WebHidden", (bool)element.WebHidden);
 }
开发者ID:labeuze,项目名称:source,代码行数:61,代码来源:OXmlStyleElementSerializer.cs

示例14: WriteSpacingBetweenLines

 private static void WriteSpacingBetweenLines(BsonWriter bsonWriter, OXmlSpacingBetweenLines element)
 {
     if (element.After != null)
         bsonWriter.WriteString("After", element.After);
     if (element.AfterAutoSpacing != null)
         bsonWriter.WriteBoolean("AfterAutoSpacing", (bool)element.AfterAutoSpacing);
     if (element.AfterLines != null)
         bsonWriter.WriteInt32("AfterLines", (int)element.AfterLines);
     if (element.Before != null)
         bsonWriter.WriteString("Before", element.Before);
     if (element.BeforeAutoSpacing != null)
         bsonWriter.WriteBoolean("BeforeAutoSpacing", (bool)element.BeforeAutoSpacing);
     if (element.BeforeLines != null)
         bsonWriter.WriteInt32("BeforeLines", (int)element.BeforeLines);
     if (element.Line != null)
         bsonWriter.WriteString("Line", element.Line);
     if (element.LineRule != null)
         bsonWriter.WriteString("LineRule", element.LineRule.ToString());
 }
开发者ID:labeuze,项目名称:source,代码行数:19,代码来源:OXmlStyleElementSerializer.cs

示例15: Serialize

 /// <summary>
 /// Serializes an object to a BsonWriter.
 /// </summary>
 /// <param name="bsonWriter">The BsonWriter.</param>
 /// <param name="nominalType">The nominal type.</param>
 /// <param name="value">The object.</param>
 /// <param name="options">The serialization options.</param>
 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     IBsonSerializationOptions options
 ) {
     if (value == null) {
         bsonWriter.WriteStartDocument();
         bsonWriter.WriteBoolean("$csharpnull", true);
         bsonWriter.WriteEndDocument();
     } else {
         bsonWriter.WriteNull();
     }
 }
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:21,代码来源:BsonValueSerializers.cs


注:本文中的MongoDB.Bson.IO.BsonWriter.WriteBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。