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


C# BsonDocument.zGet方法代码示例

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


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

示例1: HttpArchiveCacheValue

 public HttpArchiveCacheValue(BsonDocument document)
 {
     expires = document.zGet("expires").zAsNullableDateTime();
     lastAccess = document.zGet("lastAccess").zAsNullableDateTime();
     eTag = document.zGet("eTag").zAsString();
     hitCount = document.zGet("hitCount").zAsInt();
 }
开发者ID:labeuze,项目名称:source,代码行数:7,代码来源:HttpArchive.cs

示例2: CreateAnchorWrapTopAndBottom

 private static OXmlAnchorWrapTopAndBottom CreateAnchorWrapTopAndBottom(BsonDocument element)
 {
     OXmlAnchorWrapTopAndBottom wrapTopAndBottom = new OXmlAnchorWrapTopAndBottom();
     wrapTopAndBottom.DistanceFromTop = (uint)element.zGet("DistanceFromTop").zAsInt();
     wrapTopAndBottom.DistanceFromBottom = (uint)element.zGet("DistanceFromBottom").zAsInt();
     wrapTopAndBottom.EffectExtent = CreateEffectExtent(element.zGet("EffectExtent").zAsBsonDocument());
     return wrapTopAndBottom;
 }
开发者ID:labeuze,项目名称:source,代码行数:8,代码来源:OXmlPictureElementCreator.cs

示例3: CreateAnchorPictureDrawing

        private static OXmlAnchorPictureDrawing CreateAnchorPictureDrawing(BsonDocument element, OXmlAnchorWrapType wrapType)
        {
            OXmlAnchorPictureDrawing anchor = new OXmlAnchorPictureDrawing();
            //string wrapType = element.zGet("WrapType").zAsString();
            //switch (wrapType.ToLower())
            //{
            //    //case "wrapnone":
            //    case "wrapsquare":
            //        anchor.Wrap = CreateAnchorWrapSquare(element);
            //        break;
            //    case "wraptight":
            //        anchor.Wrap = CreateAnchorWrapTight(element);
            //        break;
            //    //case "wrapthrough":
            //    case "wraptopandbottom":
            //        anchor.Wrap = CreateAnchorWrapTopAndBottom(element);
            //        break;
            //    default:
            //        throw new PBException($"unknow oxml wrap type \"{wrapType}\"");
            //}
            switch (wrapType)
            {
                //case OXmlAnchorWrapType.WrapNone:
                case OXmlAnchorWrapType.WrapSquare:
                    anchor.Wrap = CreateAnchorWrapSquare(element);
                    break;
                case OXmlAnchorWrapType.WrapTight:
                    anchor.Wrap = CreateAnchorWrapTight(element);
                    break;
                //case OXmlAnchorWrapType.WrapThrough:
                case OXmlAnchorWrapType.WrapTopAndBottom:
                    anchor.Wrap = CreateAnchorWrapTopAndBottom(element);
                    break;
                default:
                    throw new PBException($"wrap type \"{wrapType}\" not implemented");
            }

            // Margin, Page, Column, Character, LeftMargin, RightMargin, InsideMargin, OutsideMargin
            anchor.HorizontalRelativeFrom = element.zGet("HorizontalRelativeFrom").zAsString().zTryParseEnum(DW.HorizontalRelativePositionValues.Margin);
            anchor.HorizontalPositionOffset = element.zGet("HorizontalPositionOffset").zAsNullableInt();
            anchor.HorizontalAlignment = element.zGet("HorizontalAlignment").zAsString();

            anchor.VerticalRelativeFrom = element.zGet("VerticalRelativeFrom").zAsString().zTryParseEnum(DW.VerticalRelativePositionValues.Paragraph);
            anchor.VerticalPositionOffset = element.zGet("VerticalPositionOffset").zAsNullableInt();
            anchor.VerticalAlignment = element.zGet("VerticalAlignment").zAsString();

            return anchor;
        }
开发者ID:labeuze,项目名称:source,代码行数:48,代码来源:OXmlPictureElementCreator.cs

示例4: CreatePictureDrawing

 private static OXmlPictureDrawing CreatePictureDrawing(BsonDocument element)
 {
     //string drawingMode = element.zGet("DrawingMode").zAsString();
     //switch (drawingMode.ToLower())
     //{
     //    case "inline":
     //        return new OXmlInlinePictureDrawing();
     //    case "anchor":
     //        return CreateAnchorPictureDrawing(element);
     //    default:
     //        throw new PBException($"unknow oxml drawing mode \"{drawingMode}\"");
     //}
     OXmlPictureDrawingType drawingType = element.zGet("DrawingType").zAsString().zParseEnum<OXmlPictureDrawingType>(ignoreCase: true);
     OXmlPictureDrawingMode drawingMode;
     OXmlAnchorWrapType wrapType;
     GetDrawingModeAndWrapType(drawingType, out drawingMode, out wrapType);
     switch (drawingMode)
     {
         case OXmlPictureDrawingMode.Inline:
             return new OXmlInlinePictureDrawing();
         case OXmlPictureDrawingMode.Anchor:
             return CreateAnchorPictureDrawing(element, wrapType);
         default:
             throw new PBException($"unknow oxml drawing mode \"{drawingMode}\"");
     }
 }
开发者ID:labeuze,项目名称:source,代码行数:26,代码来源:OXmlPictureElementCreator.cs

示例5: CreatePicture

 public static OXmlElement CreatePicture(BsonDocument document)
 {
     OXmlPictureElement picture = new OXmlPictureElement();
     picture.File = document.zGet("File").zAsString();
     picture.Name = document.zGet("Name").zAsString();
     picture.Description = document.zGet("Description").zAsString();
     picture.Width = document.zGet("Width").zAsNullableInt();
     picture.Height = document.zGet("Height").zAsNullableInt();
     picture.Rotation = document.zGet("Rotation").zAsInt();
     picture.HorizontalFlip = document.zGet("HorizontalFlip").zAsBoolean();
     picture.VerticalFlip = document.zGet("VerticalFlip").zAsBoolean();
     //picture.CompressionState = GetCompressionState(element.zGet("Description").zAsString());
     picture.CompressionState = document.zGet("CompressionState").zAsString().zTryParseEnum(A.BlipCompressionValues.Print);
     picture.PresetShape = document.zGet("PresetShape").zAsString().zTryParseEnum(A.ShapeTypeValues.Rectangle);
     picture.PictureDrawing = CreatePictureDrawing(document);
     return picture;
 }
开发者ID:labeuze,项目名称:source,代码行数:17,代码来源:OXmlPictureElementCreator.cs

示例6: CreatePolygon

 private static OXmlPolygon CreatePolygon(BsonDocument element)
 {
     if (element == null)
         return null;
     OXmlPolygon polygon = new OXmlPolygon
     {
         StartPoint = new OXmlPoint2DType { X = element.zGet("StartPointX").zAsLong(), Y = element.zGet("StartPointY").zAsLong() },
         Edited = element.zGet("Edited").zAsNullableBoolean()
     };
     List<OXmlPoint2DType> linesTo = new List<OXmlPoint2DType>();
     foreach (BsonValue line in element.zGet("LinesTo").zAsBsonArray())
     {
         BsonDocument line2 = line.AsBsonDocument;
         linesTo.Add(new OXmlPoint2DType { X = line2.zGet("X").zAsLong(), Y = line2.zGet("Y").zAsLong() });
     }
     polygon.LinesTo = linesTo.ToArray();
     return polygon;
 }
开发者ID:labeuze,项目名称:source,代码行数:18,代码来源:OXmlPictureElementCreator.cs

示例7: CreateAnchorWrapTight

 private static OXmlAnchorWrapTight CreateAnchorWrapTight(BsonDocument element)
 {
     OXmlAnchorWrapTight wrapTight = new OXmlAnchorWrapTight();
     wrapTight.WrapText = element.zGet("WrapText").zAsString().zTryParseEnum(DW.WrapTextValues.BothSides);
     wrapTight.DistanceFromLeft = (uint)element.zGet("DistanceFromLeft").zAsInt();
     wrapTight.DistanceFromRight = (uint)element.zGet("DistanceFromRight").zAsInt();
     //wrapTight.WrapPolygon = OXmlDoc.CreateWrapPolygon(element.zGet("WrapPolygonHorizontalSize").zAsLong(), element.zGet("WrapPolygonVerticalSize").zAsLong(), element.zGet("WrapPolygonStartPointX").zAsLong(), element.zGet("WrapPolygonStartPointY").zAsLong());
     //wrapTight.WrapPolygon = new OXmlSquare
     //{
     //    StartPointX = element.zGet("WrapPolygonStartPointX").zAsLong(),
     //    StartPointY = element.zGet("WrapPolygonStartPointY").zAsLong(),
     //    HorizontalSize = element.zGet("WrapPolygonHorizontalSize").zAsLong(),
     //    VerticalSize = element.zGet("WrapPolygonVerticalSize").zAsLong()
     //};
     BsonDocument polygon = element.zGet("Polygon").zAsBsonDocument();
     if (polygon != null)
         wrapTight.WrapPolygon = CreatePolygon(polygon);
     else
     {
         polygon = element.zGet("Square").zAsBsonDocument();
         if (polygon != null)
             wrapTight.WrapPolygon = CreateSquare(polygon);
     }
     return wrapTight;
 }
开发者ID:labeuze,项目名称:source,代码行数:25,代码来源:OXmlPictureElementCreator.cs

示例8: HttpArchiveEntry

 public HttpArchiveEntry(BsonDocument document)
 {
     //startedDateTime = DateTime.Parse(document["startedDateTime"].AsString);
     startedDateTime = document.zGet("startedDateTime").zAsNullableDateTime();
     time = document.zGet("time").zAsDouble();
     request = new HttpArchiveRequest(document["request"].AsBsonDocument);
     response = new HttpArchiveResponse(document["response"].AsBsonDocument);
     cache = new HttpArchiveCache(document["cache"].AsBsonDocument);
     timings = new HttpArchiveTimings(document["timings"].AsBsonDocument);
     connection = document.zGet("connection").zAsString();
     pageref = document.zGet("pageref").zAsString();
 }
开发者ID:labeuze,项目名称:source,代码行数:12,代码来源:HttpArchive.cs

示例9: CreateAnchorWrapSquare

 private static OXmlAnchorWrapSquare CreateAnchorWrapSquare(BsonDocument element)
 {
     OXmlAnchorWrapSquare wrapSquare = new OXmlAnchorWrapSquare();
     wrapSquare.WrapText = element.zGet("WrapText").zAsString().zTryParseEnum(DW.WrapTextValues.BothSides);
     wrapSquare.DistanceFromTop = (uint)element.zGet("DistanceFromTop").zAsInt();
     wrapSquare.DistanceFromBottom = (uint)element.zGet("DistanceFromBottom").zAsInt();
     wrapSquare.DistanceFromLeft = (uint)element.zGet("DistanceFromLeft").zAsInt();
     wrapSquare.DistanceFromRight = (uint)element.zGet("DistanceFromRight").zAsInt();
     wrapSquare.EffectExtent = CreateEffectExtent(element.zGet("EffectExtent").zAsBsonDocument());
     return wrapSquare;
 }
开发者ID:labeuze,项目名称:source,代码行数:11,代码来源:OXmlPictureElementCreator.cs

示例10: TransformTopojson

        public static IEnumerable<BsonDocument> TransformTopojson(BsonDocument doc)
        {
            BsonValue geometries = doc.zGet("objects.data.geometries");
            if (geometries == null)
            {
                //Trace.WriteLine("objects.data.geometries not found");
                //yield break;
                throw new PBException("objects.data.geometries not found");
            }
            if (!geometries.IsBsonArray)
            {
                //Trace.WriteLine("objects.data.geometries is not an array");
                //yield break;
                throw new PBException("objects.data.geometries is not an array");
            }

            //Dictionary<int, int> scalerank = new Dictionary<int, int>();
            //Dictionary<string, string> featurecla = new Dictionary<string, string>();
            //Dictionary<int, int> labelrank = new Dictionary<int, int>();
            //Dictionary<int, int> adm0_dif = new Dictionary<int, int>();
            //Dictionary<int, int> level = new Dictionary<int, int>();
            //Dictionary<string, string> type = new Dictionary<string, string>();
            //Dictionary<int, int> su_dif = new Dictionary<int, int>();
            //Dictionary<int, int> brk_diff = new Dictionary<int, int>();
            //Dictionary<int, int> mapcolor7 = new Dictionary<int, int>();
            //Dictionary<int, int> mapcolor8 = new Dictionary<int, int>();
            //Dictionary<int, int> mapcolor9 = new Dictionary<int, int>();
            //Dictionary<int, int> mapcolor13 = new Dictionary<int, int>();

            int count = 0;
            foreach (BsonValue geometry in geometries.AsBsonArray)
            {
                if (!geometry.IsBsonDocument)
                {
                    Trace.WriteLine("geometry is not a document");
                    continue;
                }
                BsonValue properties = geometry.zGet("properties");
                //if (properties.IsBsonDocument)
                //{
                //    BsonDocument propertiesDoc = properties.AsBsonDocument;
                //    int i = propertiesDoc.zGet("scalerank").zAsInt();
                //    scalerank[i] = i;
                //    string text = propertiesDoc.zGet("featurecla").zAsString();
                //    featurecla[text] = text;
                //    i = propertiesDoc.zGet("labelrank").zAsInt();
                //    labelrank[i] = i;
                //    i = propertiesDoc.zGet("adm0_dif").zAsInt();
                //    adm0_dif[i] = i;
                //    i = propertiesDoc.zGet("level").zAsInt();
                //    level[i] = i;
                //    text = propertiesDoc.zGet("type").zAsString();
                //    type[text] = text;
                //    i = propertiesDoc.zGet("su_dif").zAsInt();
                //    su_dif[i] = i;
                //    i = propertiesDoc.zGet("brk_diff").zAsInt();
                //    brk_diff[i] = i;
                //    i = propertiesDoc.zGet("mapcolor7").zAsInt();
                //    mapcolor7[i] = i;
                //    i = propertiesDoc.zGet("mapcolor8").zAsInt();
                //    mapcolor8[i] = i;
                //    i = propertiesDoc.zGet("mapcolor9").zAsInt();
                //    mapcolor9[i] = i;
                //    i = propertiesDoc.zGet("mapcolor13").zAsInt();
                //    mapcolor13[i] = i;
                //}
                yield return new BsonDocument { { "type", geometry .zGet("type") }, { "properties", properties } };
                count++;
            }
            //Trace.WriteLine($"{count} geometries");
            //Trace.WriteLine($"scalerank  {scalerank.Count} : {scalerank.Keys.zToStringValues()}");
            //Trace.WriteLine($"featurecla {featurecla.Count} : {featurecla.Keys.zToStringValues()}");
            //Trace.WriteLine($"labelrank  {labelrank.Count} : {labelrank.Keys.zToStringValues()}");
            //Trace.WriteLine($"adm0_dif   {adm0_dif.Count} : {adm0_dif.Keys.zToStringValues()}");
            //Trace.WriteLine($"level      {level.Count} : {level.Keys.zToStringValues()}");
            //Trace.WriteLine($"type       {type.Count} : {type.Keys.zToStringValues()}");
            //Trace.WriteLine($"su_dif     {su_dif.Count} : {su_dif.Keys.zToStringValues()}");
            //Trace.WriteLine($"brk_diff   {brk_diff.Count} : {brk_diff.Keys.zToStringValues()}");
            //Trace.WriteLine($"mapcolor7  {mapcolor7.Count} : {mapcolor7.Keys.zToStringValues()}");
            //Trace.WriteLine($"mapcolor8  {mapcolor8.Count} : {mapcolor8.Keys.zToStringValues()}");
            //Trace.WriteLine($"mapcolor9  {mapcolor9.Count} : {mapcolor9.Keys.zToStringValues()}");
            //Trace.WriteLine($"mapcolor13 {mapcolor13.Count} : {mapcolor13.Keys.zToStringValues()}");
        }
开发者ID:labeuze,项目名称:source,代码行数:83,代码来源:Test_map_01.cs

示例11: HttpArchiveResponse

        public HttpArchiveResponse(BsonDocument document)
        {
            status = document.zGet("status").zAsInt();
            statusText = document.zGet("statusText").zAsString();
            httpVersion = document.zGet("httpVersion").zAsString();

            List<HttpArchiveHeader> headerList = new List<HttpArchiveHeader>();
            if (document != null)
            {
                foreach (BsonValue value in document["headers"].AsBsonArray)
                    headerList.Add(new HttpArchiveHeader(value.AsBsonDocument));
            }
            headers = headerList.ToArray();

            List<HttpArchiveCookie> cookieList = new List<HttpArchiveCookie>();
            if (document != null)
            {
                foreach (BsonValue value in document["cookies"].AsBsonArray)
                    cookieList.Add(new HttpArchiveCookie(value.AsBsonDocument));
            }
            cookies = cookieList.ToArray();

            content = new HttpArchivePostContent(document.zGet("content").zAsBsonDocument());
            redirectURL = document.zGet("redirectURL").zAsString();
            headersSize = document.zGet("headersSize").zAsInt();
            bodySize = document.zGet("bodySize").zAsInt();
        }
开发者ID:labeuze,项目名称:source,代码行数:27,代码来源:HttpArchive.cs

示例12: HttpArchiveCache

 public HttpArchiveCache(BsonDocument document)
 {
     beforeRequest = new HttpArchiveCacheValue(document.zGet("beforeRequest").zAsBsonDocument());
     afterRequest = new HttpArchiveCacheValue(document.zGet("afterRequest").zAsBsonDocument());
 }
开发者ID:labeuze,项目名称:source,代码行数:5,代码来源:HttpArchive.cs

示例13: HttpArchivePostContent

 public HttpArchivePostContent(BsonDocument document)
 {
     size = document.zGet("size").zAsInt();
     compression = document.zGet("compression").zAsInt();
     mimeType = document.zGet("mimeType").zAsString();
     text = document.zGet("text").zAsString();
 }
开发者ID:labeuze,项目名称:source,代码行数:7,代码来源:HttpArchive.cs

示例14: HttpArchivePostDataParameter

 public HttpArchivePostDataParameter(BsonDocument document)
 {
     name = document.zGet("name").zAsString();
     value = document.zGet("value").zAsString();
     fileName = document.zGet("fileName").zAsString();
     contentType = document.zGet("contentType").zAsString();
 }
开发者ID:labeuze,项目名称:source,代码行数:7,代码来源:HttpArchive.cs

示例15: HttpArchivePostData

 public HttpArchivePostData(BsonDocument document)
 {
     mimeType = document.zGet("mimeType").zAsString();
     List<HttpArchivePostDataParameter> parameterList = new List<HttpArchivePostDataParameter>();
     if (document != null)
     {
         foreach (BsonValue value in document["params"].AsBsonArray)
             parameterList.Add(new HttpArchivePostDataParameter(value.AsBsonDocument));
     }
     parameters = parameterList.ToArray();
     text = document.zGet("text").zAsString();
 }
开发者ID:labeuze,项目名称:source,代码行数:12,代码来源:HttpArchive.cs


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