public OXmlSimpleFieldElement _Deserialize(BsonReader bsonReader, IBsonSerializationOptions options)
 {
     OXmlSimpleFieldElement element = new OXmlSimpleFieldElement();
     while (true)
     {
         BsonType bsonType = bsonReader.ReadBsonType();
         if (bsonType == BsonType.EndOfDocument)
             break;
         string name = bsonReader.ReadName();
         switch (name.ToLower())
         {
             case "type":
                 if (bsonType != BsonType.String)
                     throw new PBException($"wrong type value {bsonType}");
                 string type = bsonReader.ReadString();
                 if (type.ToLower() != "simplefield")
                     throw new PBException($"invalid Type {type} when deserialize OXmlSimpleFieldElement");
                 break;
             case "instruction":
                 if (bsonType == BsonType.Null)
                     break;
                 if (bsonType != BsonType.String)
                     throw new PBException($"wrong Instruction value {bsonType}");
                 element.Instruction = bsonReader.ReadString();
                 break;
             default:
                 throw new PBException($"unknow SimpleField value \"{name}\"");
         }
     }
     return element;
 }
Пример #2
0
 private void AddSimpleField(OXmlSimpleFieldElement element)
 {
     //if (_paragraph == null)
     //    AddParagraph();
     AddParagraph();
     _paragraph.AppendChild(new SimpleField {
         Instruction = element.Instruction
     });
     //_run = _paragraph.AppendChild(new Run());
     _run = null;
 }
Пример #3
0
 private void AddSimpleField(OXmlSimpleFieldElement element)
 {
     //if (_paragraph == null)
     //    AddParagraph();
     AddParagraph();
     _paragraph.AppendChild(new SimpleField { Instruction = element.Instruction });
     //_run = _paragraph.AppendChild(new Run());
     _run = null;
 }