本文整理汇总了C#中ErrorLogger.Warning方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorLogger.Warning方法的具体用法?C# ErrorLogger.Warning怎么用?C# ErrorLogger.Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorLogger
的用法示例。
在下文中一共展示了ErrorLogger.Warning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseWorld
private static void ParseWorld(WorldCollection worlds, string line, int lineNumber, ErrorLogger errors)
{
if (!uwpRegex.IsMatch(line))
{
if (errors != null)
errors.Warning("Ignoring non-UWP data", lineNumber, line);
return;
}
Match match = worldRegex.Match(line);
if (!match.Success)
{
if (errors != null)
errors.Error("SEC Parse", lineNumber, line);
return;
}
try
{
World world = new World();
// Allegiance may affect interpretation of other values, e.g. bases, zones
world.Allegiance = match.Groups["allegiance"].Value.Trim();
// Crack the RegExpr data
world.Name = nameFixupRegex.Replace(match.Groups["name"].Value.Trim(), "");
world.Hex = match.Groups["hex"].Value.Trim();
world.UWP = match.Groups["uwp"].Value.Trim();
world.LegacyBaseCode = EmptyIfDash(match.Groups["base"].Value.Trim());
world.Remarks = match.Groups["codes"].Value.Trim();
world.Zone = EmptyIfDash(match.Groups["zone"].Value);
world.PBG = match.Groups["pbg"].Value.Trim();
// Cleanup known placeholders
if (world.Name == match.Groups["hex"].Value || placeholderNameRegex.IsMatch(world.Name))
world.Name = "";
if (world.Name == world.Name.ToUpperInvariant() && world.IsHi)
world.Name = Util.FixCapitalization(world.Name);
worlds[world.X, world.Y] = world;
string rest = match.Groups["rest"].Value;
if (!String.IsNullOrEmpty(rest))
ParseRest(rest, worlds, lineNumber, line, world, errors);
}
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));
}
}
示例2: ParseRest
private static void ParseRest(string rest, WorldCollection worlds, int lineNumber, string line, World world, ErrorLogger errors)
{
// Assume stellar data, try to parse it
try
{
world.Stellar = StellarDataParser.Parse(rest, StellarDataParser.OutputFormat.Compact);
}
catch (StellarDataParser.InvalidSystemException)
{
if (errors != null)
errors.Warning(String.Format("Invalid stellar data: '{0}'", rest), lineNumber, line);
}
}