本文整理汇总了C#中Lookup.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# Lookup.GetName方法的具体用法?C# Lookup.GetName怎么用?C# Lookup.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup.GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReportLookupError
public override void ReportLookupError(Lookup lookup, Type fail_type)
{
Dirty = true;
if (fail_type == null) {
Console.Error.WriteLine("Undefined name “{0}”. Lookup was as follows:", lookup.Name);
} else {
Console.Error.WriteLine("Non-frame type {1} while resolving name “{0}”. Lookup was as follows:",
lookup.Name, fail_type);
}
var col_width = Math.Max((int) Math.Log(lookup.FrameCount, 10) + 1, 3);
for (var name_it = 0; name_it < lookup.NameCount; name_it++) {
col_width = Math.Max(col_width, lookup.GetName(name_it).Length);
}
for (var name_it = 0; name_it < lookup.NameCount; name_it++) {
Console.Error.Write("│ {0}", lookup.GetName(name_it).PadRight(col_width, ' '));
}
Console.Error.WriteLine("│");
for (var name_it = 0; name_it < lookup.NameCount; name_it++) {
Console.Error.Write(name_it == 0 ? "├" : "┼");
for (var s = 0; s <= col_width; s++) {
Console.Error.Write("─");
}
}
Console.Error.WriteLine("┤");
var seen = new Dictionary<SourceReference, bool>();
var known_frames = new Dictionary<Frame, string>();
var frame_list = new List<Frame>();
var null_text = "│ ".PadRight(col_width + 2, ' ');
for (var frame_it = 0; frame_it < lookup.FrameCount; frame_it++) {
for (var name_it = 0; name_it < lookup.NameCount; name_it++) {
var frame = lookup[name_it, frame_it];
if (frame == null) {
Console.Error.Write(null_text);
continue;
}
if (!known_frames.ContainsKey(frame)) {
frame_list.Add(frame);
known_frames[frame] = frame_list.Count.ToString().PadRight(col_width, ' ');
}
Console.Error.Write("│ {0}", known_frames[frame]);
}
Console.Error.WriteLine("│");
}
for (var it = 0; it < frame_list.Count; it++) {
Console.Error.WriteLine("Frame {0} defined:", it + 1);
frame_list[it].SourceReference.Write(Console.Error, " ", seen);
}
Console.Error.WriteLine("Lookup happened here:");
lookup.SourceReference.Write(Console.Error, " ", seen);
}