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


C# ErrorLogger.Error方法代码示例

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


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

示例1: ParseWorld

        protected static void ParseWorld(WorldCollection worlds, StringDictionary dict, string line, int lineNumber, ErrorLogger errors)
        {
            try
            {
                FieldChecker checker = new FieldChecker(dict, errors, lineNumber, line);
                World world = new World();
                world.Hex = checker.Check("Hex", HEX_REGEX);
                world.Name = dict["Name"];
                world.UWP = checker.Check("UWP", UWP_REGEX);
                world.Remarks = checker.Check(new string[] { "Remarks", "Trade Codes", "Comments" });
                world.Importance = checker.Check(new string[] { "{Ix}", "{ Ix }", "Ix" });
                world.Economic = checker.Check(new string[] { "(Ex)", "( Ex )", "Ex" });
                world.Cultural = checker.Check(new string[] { "[Cx]", "[ Cx ]", "Cx" });
                world.Nobility = checker.Check(new string[] { "N", "Nobility" }, NOBILITY_REGEX, CheckOptions.EmptyIfDash);
                world.Bases = checker.Check(new string[] { "B", "Bases" }, BASES_REGEX, CheckOptions.EmptyIfDash);
                world.Zone = checker.Check(new string[] { "Z", "Zone" }, ZONE_REGEX, CheckOptions.EmptyIfDash);
                world.PBG = checker.Check("PBG", PBG_REGEX);
                world.Allegiance = checker.Check(new string[] { "A", "Al", "Allegiance" },
                    // TODO: Allow unofficial sectors to have locally declared allegiances.
                    a => a.Length != 4 || SecondSurvey.IsKnownT5Allegiance(a));
                world.Stellar = checker.Check(new string[] { "Stellar", "Stars", "Stellar Data" }, STARS_REGEX, CheckOptions.Warning);

                int w;
                if (Int32.TryParse(checker.Check(new string[] { "W", "Worlds" }), NumberStyles.Integer, CultureInfo.InvariantCulture, out w))
                    world.Worlds = w;

                int ru;
                if (Int32.TryParse(dict["RU"], NumberStyles.Integer | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out ru))
                    world.ResourceUnits = ru;

                // Cleanup known placeholders
                if (world.Name == world.Name.ToUpperInvariant() && world.IsHi)
                    world.Name = Util.FixCapitalization(world.Name);

                if (worlds[world.X, world.Y] != null && errors != null)
                    errors.Warning("Duplicate World", lineNumber, line);

                if (!checker.HadError)
                {
                    worlds[world.X, world.Y] = world;
                }
            }
            catch (Exception e)
            {
                errors.Error("Parse Error: " + e.Message, lineNumber, line);
                //throw new Exception(String.Format("UWP Parse Error in line {0}:\n{1}\n{2}", lineNumber, e.Message, line));
            }
        }
开发者ID:Matt--,项目名称:travellermap,代码行数:48,代码来源:SectorParser.cs


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