本文整理汇总了C#中IRuntime.Error方法的典型用法代码示例。如果您正苦于以下问题:C# IRuntime.Error方法的具体用法?C# IRuntime.Error怎么用?C# IRuntime.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRuntime
的用法示例。
在下文中一共展示了IRuntime.Error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGenerator
private static LanguageGenerator GetGenerator(string language, string knockoutPrefix, IRuntime runtime)
{
switch (language)
{
case TypeScriptGenerator.Id:
return new TypeScriptGenerator();
case KnockoutMappingGenerator.Id:
return new KnockoutMappingGenerator(knockoutPrefix);
default:
runtime.Error("Unknown language: {0}", language);
System.Environment.Exit(-1);
return (LanguageGenerator)null;
}
}
示例2: TryLoadTypes
private bool TryLoadTypes(string filePath, int lineNumber, string assemblyNameAndNamespaceReference, IRuntime runtime, out Type[] types)
{
if (string.IsNullOrWhiteSpace(assemblyNameAndNamespaceReference))
{
types = new Type[0];
return true;
}
try
{
runtime.Log("Parsing " + assemblyNameAndNamespaceReference);
var parts = Regex.Split(assemblyNameAndNamespaceReference, "::");
if (parts.Length != 2)
{
var error = string.Format("Unrecognised format: use AssemblyName::Namespace) in '{0}'", assemblyNameAndNamespaceReference);
runtime.ErrorInFile(filePath, lineNumber, error);
System.Environment.Exit(-1);
}
var assemblyName = parts[0];
var namespaceName = parts[1];
var assembly = assemblyLoader.Load(assemblyName);
runtime.Log(string.Format("Generating from assembly {0}, namespace {1}", assemblyName, namespaceName ));
types = assembly
.GetTypes()
.Where(TypeExtensions.IsExportableType)
.Where(t => t.Namespace.StartsWith(namespaceName))
.ToArray();
runtime.Log("Loaded " + types.Length.ToString() + " types");
return true;
}
catch (ReflectionTypeLoadException ex)
{
runtime.Error(ex.ToString());
foreach (var loaderException in ex.LoaderExceptions)
{
runtime.Error(loaderException.ToString());
}
types = new Type[0];
return false;
}
catch (Exception ex)
{
runtime.Error(ex.ToString());
types = new Type[0];
return false;
}
}