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


C# ErrorLogger.ToString方法代码示例

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


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

示例1: Process


//.........这里部分代码省略.........
                tileRect.Height = Math.Max(y1, y2) - tileRect.Y;

                SectorMap map = SectorMap.FromName(SectorMap.DefaultSetting, resourceManager);
                selector = new RectSelector(map, resourceManager, tileRect);
                selector.Slop = false;

                tileRect.Offset(-1, -1);
                tileRect.Width += 1;
                tileRect.Height += 1;

                // Account for jagged hexes
                tileRect.Height += 0.5f;
                tileRect.Inflate(0.25f, 0.10f);
                if (style == Stylesheet.Style.Candy)
                    tileRect.Width += 0.75f;

                clipOutsectorBorders = true;
            }
            else
            {
                // Sector - either POSTed or specified by name
                Sector sector = null;
                options = options & ~MapOptions.SectorGrid;

                if (context.Request.HttpMethod == "POST")
                {
                    try
                    {
                        bool lint = GetBoolOption(context, "lint", defaultValue: false);
                        ErrorLogger errors = new ErrorLogger();
                        sector = GetPostedSector(context.Request, errors);
                        if (lint && !errors.Empty)
                        {
                            SendError(context.Response, 400, "Bad Request", errors.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        SendError(context.Response, 400, "Bad Request", ex.Message);
                        return;
                    }

                    if (sector == null)
                    {
                        SendError(context.Response, 400, "Bad Request", "Either file or data must be supplied in the POST data.");
                        return;
                    }

                    title = "User Data";

                    // TODO: Suppress all OTU rendering.
                    options = options & ~MapOptions.WorldsHomeworlds & ~MapOptions.WorldsCapitals;
                }
                else
                {
                    string sectorName = GetStringOption(context, "sector");
                    if (sectorName == null)
                    {
                        SendError(context.Response, 400, "Bad Request", "No sector specified.");
                        return;
                    }

                    SectorMap map = SectorMap.FromName(SectorMap.DefaultSetting, resourceManager);

                    sector = map.FromName(sectorName);
                    if (sector == null)
开发者ID:Matt--,项目名称:travellermap,代码行数:67,代码来源:PosterHandler.cs

示例2: Process

        public override void Process(System.Web.HttpContext context)
        {
            // NOTE: This (re)initializes a static data structure used for
            // resolving names into sector locations, so needs to be run
            // before any other objects (e.g. Worlds) are loaded.
            ResourceManager resourceManager = new ResourceManager(context.Server, context.Cache);

            //
            // Jump
            //
            int jump = Util.Clamp(GetIntOption(context, "jump", 6), 0, 12);

            //
            // Content & Coordinates
            //
            Selector selector;
            Location loc;
            if (context.Request.HttpMethod == "POST")
            {
                Sector sector;
                try
                {
                    bool lint = GetBoolOption(context, "lint", defaultValue: false);
                    ErrorLogger errors = new ErrorLogger();
                    sector = GetPostedSector(context.Request, errors);
                    if (lint && !errors.Empty)
                    {
                        SendError(context.Response, 400, "Bad Request", errors.ToString());
                    }
                }
                catch (Exception ex)
                {
                    SendError(context.Response, 400, "Bad Request", ex.Message);
                    return;
                }

                if (sector == null)
                {
                    SendError(context.Response, 400, "Bad Request", "Either file or data must be supplied in the POST data.");
                    return;
                }

                int hex = GetIntOption(context, "hex", Astrometrics.SectorCentralHex);
                loc = new Location(new Point(0, 0), hex);
                selector = new HexSectorSelector(resourceManager, sector, loc.HexLocation, jump);
            }
            else
            {
                SectorMap map = SectorMap.FromName(SectorMap.DefaultSetting, resourceManager);

                if (HasOption(context, "sector") && HasOption(context, "hex"))
                {
                    string sectorName = GetStringOption(context, "sector");
                    int hex = GetIntOption(context, "hex", 0);
                    Sector sector = map.FromName(sectorName);
                    if (sector == null)
                    {
                        SendError(context.Response, 404, "Not Found", String.Format("The specified sector '{0}' was not found.", sectorName));
                        return;
                    }

                    loc = new Location(sector.Location, hex);
                }
                else if (HasOption(context, "sx") && HasOption(context, "sy") && HasOption(context, "hx") && HasOption(context, "hy"))
                {
                    int sx = GetIntOption(context, "sx", 0);
                    int sy = GetIntOption(context, "sy", 0);
                    int hx = GetIntOption(context, "hx", 0);
                    int hy = GetIntOption(context, "hy", 0);
                    loc = new Location(map.FromLocation(sx, sy).Location, hx * 100 + hy);
                }
                else if (HasOption(context, "x") && HasOption(context, "y"))
                {
                    loc = Astrometrics.CoordinatesToLocation(GetIntOption(context, "x", 0), GetIntOption(context, "y", 0));
                }
                else
                {
                    loc = new Location(map.FromName("Spinward Marches").Location, 1910);
                }
                selector = new HexSelector(map, resourceManager, loc, jump);
            }

            //
            // Scale
            //
            double scale = Util.Clamp(GetDoubleOption(context, "scale", 64), MinScale, MaxScale);

            //
            // Options & Style
            //
            MapOptions options = MapOptions.BordersMajor | MapOptions.BordersMinor | MapOptions.ForceHexes;
            Stylesheet.Style style = Stylesheet.Style.Poster;
            ParseOptions(context, ref options, ref style);

            //
            // Border
            //
            bool border = GetBoolOption(context, "border", defaultValue: true);

            //
//.........这里部分代码省略.........
开发者ID:Matt--,项目名称:travellermap,代码行数:101,代码来源:JumpMapHandler.cs


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