本文整理汇总了C#中ErrorReporter类的典型用法代码示例。如果您正苦于以下问题:C# ErrorReporter类的具体用法?C# ErrorReporter怎么用?C# ErrorReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorReporter类属于命名空间,在下文中一共展示了ErrorReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VerifyDocumentUrl
/// <summary>
/// Verifies that the document represents a Url that matches the page metadata.
/// </summary>
/// <remarks>
/// <para>
/// The default implementation uses information from the associated <see cref="T:WatiN.Core.PageMetadata"/>
/// to validate the <paramref name="url"/>.
/// </para>
/// <para>
/// Subclasses can override this method to customize how document Url verification takes place.
/// </para>
/// </remarks>
/// <param name="url">The document url to verify, not null</param><param name="errorReporter">The error reporter to invoke is the document's properties fail verification</param>
protected override void VerifyDocumentUrl(string url, ErrorReporter errorReporter)
{
if (!url.EndsWith("Dinners"))
{
errorReporter("This isn't the home page");
}
}
开发者ID:dennisdoomen,项目名称:specflowdemo,代码行数:20,代码来源:DinnersPage.cs
示例2: VerifyDocumentUrl
/// <summary>
/// Verifies that the document represents a Url that matches the page metadata.
/// </summary>
/// <remarks>
/// <para>
/// The default implementation uses information from the associated <see cref="T:WatiN.Core.PageMetadata"/>
/// to validate the <paramref name="url"/>.
/// </para>
/// <para>
/// Subclasses can override this method to customize how document Url verification takes place.
/// </para>
/// </remarks>
/// <param name="url">The document url to verify, not null</param><param name="errorReporter">The error reporter to invoke is the document's properties fail verification</param>
protected override void VerifyDocumentUrl(string url, ErrorReporter errorReporter)
{
if (!url.ToLower().Contains("/logon"))
{
errorReporter("This isn't the home page");
}
}
开发者ID:dennisdoomen,项目名称:specflowdemo,代码行数:20,代码来源:LogOnPage.cs
示例3: Main
static void Main()
{
var userInterface = new EmptyUserInterface {Flow = ExecutionFlow.BreakExecution};
var settings = new DefaultSettings {HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface};
settings.Sender = new LocalSender();
//Adding screenshot plugin
settings.Plugins.Add(new ScreenShotWriter());
var reporter = new ErrorReporter(settings);
reporter.HandleExceptions = true;
// Sample NCrash configuration for console applications
AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;
Console.WriteLine("Press E for current thread exception, T for task exception, X for exit");
ConsoleKey key;
do
{
key = Console.ReadKey().Key;
Console.WriteLine();
if (key == ConsoleKey.E)
{
Console.WriteLine("Throwing exception in current thread");
throw new Exception("Test exception in main thread");
}
if (key == ConsoleKey.T)
{
Console.WriteLine("Throwing exception in task thread");
var task = new Task(MakeExceptionInTask);
task.Start();
task.Wait();
}
} while (key != ConsoleKey.X);
}
开发者ID:mgnslndh,项目名称:NCrash,代码行数:34,代码来源:Program.cs
示例4: OsloCodeGeneratorInfo
public OsloCodeGeneratorInfo(string fileName, TextReader fileContent, bool ignoreIncludes, ErrorReporter errorReporter)
{
this.CodeParser = OsloCodeGeneratorLanguages.GetOsloCodeGeneratorParser();
this.TemplateParser = OsloCodeGeneratorLanguages.GetOsloCodeGeneratorTemplateParser();
this.CodePrinter = null;
this.ErrorReporter = errorReporter;
this.References = new SortedSet<string>();
this.Usings = new SortedSet<string>();
this.Imports = new SortedSet<string>();
this.Includes = new List<OsloCodeGeneratorInfo>();
//this.IgnoreIncludes = ignoreIncludes;
this.IgnoreIncludes = false;
if (fileName != null)
{
this.FileName = Path.GetFullPath(fileName);
if (!File.Exists(this.FileName))
{
this.ErrorReporter.Error("File not found: {0}", fileName);
}
}
this.Program = this.CodeParser.Parse(fileContent, this.ErrorReporter);
this.Usings.Add("System");
this.Usings.Add("System.Collections.Generic");
this.Usings.Add("System.Linq");
this.Usings.Add("System.Text");
this.Usings.Add("OsloExtensions");
this.Usings.Add("OsloExtensions.Extensions");
this.Includes.Add(this);
this.FunctionCount = 0;
new OsloCodeGeneratorUsingProcessor(this, this).Process(this.Program);
}
开发者ID:st9200,项目名称:soal-oslo,代码行数:35,代码来源:OsloCodeGeneratorInfo.cs
示例5: Argument
public Argument(ArgumentAttribute attribute, FieldInfo field, ErrorReporter reporter)
{
this.longName = Parser.LongName (attribute, field);
this.explicitShortName = Parser.ExplicitShortName (attribute);
this.shortName = Parser.ShortName (attribute, field);
this.hasHelpText = Parser.HasHelpText (attribute);
this.helpText = Parser.HelpText (attribute);
this.defaultValue = Parser.DefaultValue (attribute);
this.elementType = ElementType (field);
this.flags = Flags (attribute, field);
this.field = field;
this.SeenValue = false;
this.reporter = reporter;
this.isDefault = attribute != null && attribute is DefaultArgumentAttribute;
if (this.IsCollection)
this.collectionValues = new ArrayList ();
Debug.Assert (!String.IsNullOrEmpty (this.longName));
Debug.Assert (!this.isDefault || !this.ExplicitShortName);
Debug.Assert (!this.IsCollection || this.AllowMultiple, "Collection arguments must have allow multiple");
Debug.Assert (!this.Unique || this.IsCollection, "Unique only applicable to collection arguments");
Debug.Assert (IsValidElementType (this.Type) ||
IsCollectionType (this.Type));
Debug.Assert ((this.IsCollection && IsValidElementType (this.elementType)) ||
(!this.IsCollection && this.elementType == null));
Debug.Assert (!(this.IsRequired && this.HasDefaultValue), "Required arguments cannot have default value");
Debug.Assert (!this.HasDefaultValue || (this.defaultValue.GetType () == field.FieldType),
"Type of default value must match field type");
}
开发者ID:victorsamun,项目名称:NSimulator,代码行数:30,代码来源:Argument.cs
示例6: ForEval
internal static ErrorReporter ForEval (ErrorReporter reporter)
{
DefaultErrorReporter r = new DefaultErrorReporter ();
r.forEval = true;
r.chainedReporter = reporter;
return r;
}
开发者ID:hazzik,项目名称:EcmaScript.NET,代码行数:7,代码来源:DefaultErrorReporter.cs
示例7: Main
static int Main(string[] args)
{
CommandLineParser parser = new CommandLineParser( args );
if (parser.RegistrationPath.Length == 0)
parser.RegistrationPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(RegistrarApp)).Location);
try
{
AssemblyRegistrar registrar = new AssemblyRegistrar( parser );
if( parser.RegisterMode == CommandLineParser.InstallMode.Register )
registrar.Register();
else
{
try
{
registrar.UnRegister();
}
catch
{
// ignore the exception
}
}
return (int) ReturnValue.Success;
}
catch( Exception ex )
{
System.Diagnostics.Debug.Assert(false, ex.Message);
ErrorReporter reporter = new ErrorReporter(parser.RegistrationPath, parser.SilentMode);
reporter.Report(ex.Message);
return (int) ReturnValue.Failure;
}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:34,代码来源:RegistrarApp.cs
示例8: Report
public void Report()
{
ExceptionForm form = new ExceptionForm(message, ex);
if (form.ShowDialog(owner) == DialogResult.OK) {
ErrorReporter reporter = new ErrorReporter();
reporter.Report(ex);
}
}
开发者ID:xwiz,项目名称:WixEdit,代码行数:8,代码来源:ErrorReportHandler.cs
示例9: SetErrorReporter
public virtual void SetErrorReporter(ErrorReporter errorReporter)
{
if (errorReporter == null)
{
throw new ArgumentException();
}
this.errorReporter = errorReporter;
}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:CompilerEnvirons.cs
示例10: Parser
/// <summary>
/// Creates a new command line argument parser.
/// </summary>
/// <param name="argumentSpecification"> The type of object to parse. </param>
/// <param name="reporter"> The destination for parse errors. </param>
private Parser(Type argumentSpecification, ErrorReporter reporter)
{
this.reporter = reporter;
this.reporter += Log.Error;
this.arguments = new ArrayList();
this.argumentMap = new Hashtable();
foreach (FieldInfo field in argumentSpecification.GetFields())
{
if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
{
ArgumentAttribute attribute = GetAttribute(field);
if (attribute is DefaultArgumentAttribute)
{
Debug.Assert(this.defaultArgument == null);
this.defaultArgument = new Argument(attribute, field, reporter);
}
else
{
this.arguments.Add(new Argument(attribute, field, reporter));
}
}
}
// add explicit names to map
foreach (Argument argument in this.arguments)
{
Debug.Assert(!this.argumentMap.ContainsKey(argument.LongName));
this.argumentMap[argument.LongName] = argument;
if (argument.ExplicitShortName)
{
if (!string.IsNullOrEmpty(argument.ShortName))
{
Debug.Assert(!this.argumentMap.ContainsKey(argument.ShortName));
this.argumentMap[argument.ShortName] = argument;
}
else
{
argument.ClearShortName();
}
}
}
// add implicit names which don't collide to map
foreach (Argument argument in this.arguments)
{
if (!argument.ExplicitShortName)
{
if (!string.IsNullOrEmpty(argument.ShortName) &&
!this.argumentMap.ContainsKey(argument.ShortName))
this.argumentMap[argument.ShortName] = argument;
else
argument.ClearShortName();
}
}
}
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:61,代码来源:Parser.cs
示例11: QueryCompiler
/// <summary>
/// Creates a new instance of the QueryCompiler.
/// </summary>
/// <param name="reporter">A delegate to report any errors to an upper layer.</param>
/// <param name="query">The query to compile.</param>
public QueryCompiler(ErrorReporter reporter, string query)
{
if (reporter == null)
throw new ArgumentNullException("reporter");
if (query == null)
throw new ArgumentNullException("query");
this.report = reporter;
this.currentQuery = query;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:15,代码来源:QueryCompiler.cs
示例12: Parser
public Parser(Type argumentSpecification, ErrorReporter reporter)
{
this.reporter = reporter;
arguments = new ArrayList();
argumentMap = new Hashtable();
FieldInfo[] fields = argumentSpecification.GetFields();
for (int i = 0; i < fields.Length; i++)
{
FieldInfo field = fields[i];
if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
{
ArgumentAttribute attribute = GetAttribute(field);
if (attribute is DefaultArgumentAttribute)
{
Debug.Assert(defaultArgument == null);
defaultArgument = new Argument(attribute, field, reporter);
}
else
{
arguments.Add(new Argument(attribute, field, reporter));
}
}
}
foreach (Argument argument in arguments)
{
Debug.Assert(!argumentMap.ContainsKey(argument.LongName));
argumentMap[argument.LongName] = argument;
if (argument.ExplicitShortName)
{
if (argument.ShortName != null && argument.ShortName.Length > 0)
{
Debug.Assert(!argumentMap.ContainsKey(argument.ShortName));
argumentMap[argument.ShortName] = argument;
}
else
{
argument.ClearShortName();
}
}
}
foreach (Argument argument in arguments)
{
if (!argument.ExplicitShortName)
{
if (argument.ShortName != null && argument.ShortName.Length > 0 && !argumentMap.ContainsKey(argument.ShortName))
{
argumentMap[argument.ShortName] = argument;
}
else
{
argument.ClearShortName();
}
}
}
}
开发者ID:bittercoder,项目名称:HeatSite,代码行数:55,代码来源:Parser.cs
示例13: CompilerEnvirons
public CompilerEnvirons()
{
errorReporter = DefaultErrorReporter.instance;
languageVersion = Context.Versions.Default;
generateDebugInfo = true;
useDynamicScope = false;
reservedKeywordAsIdentifier = false;
allowMemberExprAsFunctionName = false;
xmlAvailable = true;
optimizationLevel = 0;
generatingSource = true;
}
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:12,代码来源:CompilerEnvirons.cs
示例14: CommandLineArgumentParser
/// <summary>
/// Creates a new command line argument parser.
/// </summary>
/// <param name="argumentSpecification"> The type of object to parse. </param>
/// <param name="reporter"> The destination for parse errors. </param>
public CommandLineArgumentParser(Type argumentSpecification, ErrorReporter reporter)
{
this.reporter = reporter;
this.arguments = new ArrayList();
this.argumentMap = new Hashtable();
foreach (FieldInfo field in argumentSpecification.GetFields())
{
if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
{
CommandLineArgumentAttribute attribute = GetAttribute(field);
if (attribute is DefaultCommandLineArgumentAttribute)
{
if (this.defaultArgument!=null)
ThrowError("More that one DefaultCommandLineArgument has been used");
this.defaultArgument = new Argument(attribute, field, reporter);
}
else
{
this.arguments.Add(new Argument(attribute, field, reporter));
}
}
}
// add explicit names to map
foreach (Argument argument in this.arguments)
{
if (argumentMap.ContainsKey(argument.LongName))
ThrowError("Argument {0} is duplicated",argument.LongName);
this.argumentMap[argument.LongName] = argument;
if (argument.ExplicitShortName && argument.ShortName != null && argument.ShortName.Length > 0)
{
if(this.argumentMap.ContainsKey(argument.ShortName))
ThrowError("Argument {0} is duplicated",argument.ShortName);
this.argumentMap[argument.ShortName] = argument;
}
}
// add implicit names which don't collide to map
foreach (Argument argument in this.arguments)
{
if (!argument.ExplicitShortName && argument.ShortName != null && argument.ShortName.Length > 0)
{
if (!argumentMap.ContainsKey(argument.ShortName))
this.argumentMap[argument.ShortName] = argument;
}
}
}
开发者ID:timonela,项目名称:mb-unit,代码行数:53,代码来源:CommandLineArgumentParser.cs
示例15: MainWindow
public MainWindow()
{
InitializeComponent();
var userInterface = new NormalWpfUserInterface();
var settings = new DefaultSettings { HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface };
settings.Sender = new LocalSender();
//Adding screenshot plugin
settings.Plugins.Add(new ScreenShotWriter());
var reporter = new ErrorReporter(settings);
reporter.HandleExceptions = true;
AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;
Application.Current.DispatcherUnhandledException += reporter.DispatcherUnhandledException;
}
开发者ID:mgnslndh,项目名称:NCrash,代码行数:16,代码来源:MainWindow.xaml.cs
示例16: CompileAssembly
public static Assembly CompileAssembly(string fullSource, ErrorReporter errorReporter, params string[] referencedAssemblies)
{
CompilerResults cr = DoCompile(fullSource, referencedAssemblies);
foreach (CompilerError item in cr.Errors)
{
if (item.IsWarning)
{
errorReporter.Warning(item.ToString());
}
else
{
errorReporter.Error(item.ToString());
}
}
return cr.CompiledAssembly;
}
开发者ID:st9200,项目名称:soal-oslo,代码行数:16,代码来源:CSharpCompiler.cs
示例17: JavaScriptCompressor
public JavaScriptCompressor(string javaScript,
bool isVerboseLogging,
Encoding encoding,
CultureInfo threadCulture,
bool isEvalIgnored,
ErrorReporter errorReporter)
{
if (string.IsNullOrEmpty(javaScript))
{
throw new ArgumentNullException("javaScript");
}
CultureInfo currentCultureInfo = Thread.CurrentThread.CurrentCulture;
CultureInfo currentUiCulture = Thread.CurrentThread.CurrentUICulture;
try
{
// Change the current Thread Culture if the user has asked for something specific.
// Reference: http://www.codeplex.com/YUICompressor/WorkItem/View.aspx?WorkItemId=3219
if (threadCulture != null)
{
Thread.CurrentThread.CurrentCulture = threadCulture;
Thread.CurrentThread.CurrentUICulture = threadCulture;
}
Initialise();
_verbose = isVerboseLogging;
var memoryStream = new MemoryStream(encoding.GetBytes(javaScript));
ErrorReporter = errorReporter ?? new CustomErrorReporter(isVerboseLogging);
_logger = ErrorReporter;
_tokens = Parse(new StreamReader(memoryStream), ErrorReporter);
_isEvalIgnored = isEvalIgnored;
}
finally
{
if (threadCulture != null)
{
Thread.CurrentThread.CurrentCulture = currentCultureInfo;
Thread.CurrentThread.CurrentUICulture = currentUiCulture;
}
}
}
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:43,代码来源:JavaScriptCompressor.cs
示例18: Options
public Options(string[] args,
OptionsParsingMode parsingMode,
bool breakSingleDashManyLettersIntoManyOptions,
bool endOptionProcessingWithDoubleDash,
bool dontSplitOnCommas,
ErrorReporter reportError)
{
ParsingMode = parsingMode;
BreakSingleDashManyLettersIntoManyOptions = breakSingleDashManyLettersIntoManyOptions;
EndOptionProcessingWithDoubleDash = endOptionProcessingWithDoubleDash;
DontSplitOnCommas = dontSplitOnCommas;
if (reportError == null)
ReportError = new ErrorReporter(DefaultErrorReporter);
else
ReportError = reportError;
InitializeOtherDefaults();
if (args != null)
ProcessArgs(args);
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:19,代码来源:Options.cs
示例19: JavaScriptCompressor
public JavaScriptCompressor(string javaScript,
bool isVerboseLogging,
Encoding encoding,
CultureInfo threadCulture,
bool isEvalIgnored,
ErrorReporter errorReporter)
{
if (string.IsNullOrEmpty(javaScript))
{
throw new ArgumentNullException("javaScript");
}
CultureInfo currentCultureInfo = Thread.CurrentThread.CurrentCulture;
CultureInfo currentUICulture = Thread.CurrentThread.CurrentCulture;
try
{
// Lets make sure the current thread is in english. This is because most javascript (yes, this also does css..)
// must be in english in case a developer runs this on a non-english OS.
// Reference: http://www.codeplex.com/YUICompressor/WorkItem/View.aspx?WorkItemId=3219
Thread.CurrentThread.CurrentCulture = threadCulture;
Thread.CurrentThread.CurrentUICulture = threadCulture;
Initialise();
_verbose = isVerboseLogging;
var memoryStream = new MemoryStream(encoding.GetBytes(javaScript));
ErrorReporter = errorReporter ?? new CustomErrorReporter(isVerboseLogging);
_logger = ErrorReporter;
_tokens = Parse(new StreamReader(memoryStream), ErrorReporter);
_isEvalIgnored = isEvalIgnored;
}
finally
{
Thread.CurrentThread.CurrentCulture = currentCultureInfo;
Thread.CurrentThread.CurrentUICulture = currentUICulture;
}
}
开发者ID:ikvm,项目名称:YUI-Compressor-.NET,代码行数:38,代码来源:JavaScriptCompressor.cs
示例20: ParseCommandLineArguments
/// <summary>
/// Parses Command Line Arguments.
/// Use CommandLineArgumentAttributes to control parsing behaviour.
/// </summary>
/// <param name="arguments"> The actual arguments. </param>
/// <param name="destination"> The resulting parsed arguments. </param>
/// <param name="reporter"> The destination for parse errors. </param>
public static void ParseCommandLineArguments(string[] arguments, object destination, ErrorReporter reporter)
{
CommandLineArgumentParser parser = new CommandLineArgumentParser(destination.GetType(), reporter);
if (!parser.Parse(arguments, destination))
throw new Exception("Parsing failed");
}
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:13,代码来源:CommandLineUtility.cs
注:本文中的ErrorReporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论