/// <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"); } }
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"); }
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); }
/// <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"); } }
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); }
internal static ErrorReporter ForEval (ErrorReporter reporter) { DefaultErrorReporter r = new DefaultErrorReporter (); r.forEval = true; r.chainedReporter = reporter; return r; }
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; } }
public virtual void SetErrorReporter(ErrorReporter errorReporter) { if (errorReporter == null) { throw new ArgumentException(); } this.errorReporter = errorReporter; }
public void Report() { ExceptionForm form = new ExceptionForm(message, ex); if (form.ShowDialog(owner) == DialogResult.OK) { ErrorReporter reporter = new ErrorReporter(); reporter.Report(ex); } }
/// <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(); } } }
/// <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; }
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(); } } } }
public CompilerEnvirons() { errorReporter = DefaultErrorReporter.instance; languageVersion = Context.Versions.Default; generateDebugInfo = true; useDynamicScope = false; reservedKeywordAsIdentifier = false; allowMemberExprAsFunctionName = false; xmlAvailable = true; optimizationLevel = 0; generatingSource = true; }
/// <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; } } }
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; }
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; }
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; } } }
static void Main() { // set NCrash handlers var userInterface = new NormalWinFormsUserInterface(); var settings = new DefaultSettings { 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; Application.ThreadException += reporter.ThreadException; System.Threading.Tasks.TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
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); }
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; } }
/// <summary> /// RPC-method for adding a course to the schedule and for /// adding the calling user to a course that someone else /// has already added. /// </summary> /// <param name="courseId">Course ID</param> /// <returns></returns> public async Task AddCourse(string courseId) { using (var errorReporter = new ErrorReporter(s => CallingClient.Errors.ScheduleMessage = s)) { var course = PaulRepository.Courses.FirstOrDefault(c => c.Id == courseId); if (course == null) { errorReporter.Throw( new ArgumentException("Course not found", nameof(courseId)), UserErrorsViewModel.GenericErrorMessage); } var schedule = CallingClient.SharedScheduleVM.Schedule; await CallingClient.SharedScheduleVM.TimetableHubSemaphore.WaitAsync(); try { var selectedCourse = schedule.SelectedCourses.FirstOrDefault(c => c.CourseId == courseId); if (course.IsTutorial) { // The user has decided to select a pending tutorial or one // that was already selected by another user, so remove all pending // tutorials of this course CallingClient.TailoredScheduleVM.RemovePendingTutorials(course, errorReporter); // Remove user from other possibly selected tutorial var parentCourse = schedule.SelectedCourses.First(sel => sel.Course.AllTutorials.SelectMany(it => it).Contains(course)); var otherSelectedTutorial = parentCourse.Course.AllTutorials .FirstOrDefault(group => group.Contains(course)) ?.FirstOrDefault(tut => schedule.SelectedCourses.Any(sel => Equals(tut, sel.Course) && sel.Users.Select(it => it.User).Contains(CallingClient.User))); if (otherSelectedTutorial != null) { await RemoveUserFromCourse(otherSelectedTutorial.Id, acquireSemaphore : false); } //If the user hasn't selected the parent course of the tutorial, it will be added here if (parentCourse.Users.All(u => u.User.Name != CallingClient.Name)) { var connectedCourses = parentCourse.Course.ConnectedCourses.Concat(new[] { parentCourse.Course }); foreach (var c in connectedCourses) { await PaulRepository.AddUserToSelectedCourseAsync(schedule.SelectedCourses.First(s => s.CourseId == c.Id), CallingClient.User); } } } if (selectedCourse == null) { var connectedCourses = course.ConnectedCourses.Concat(new[] { course }) .Select(it => PaulRepository.CreateSelectedCourse(schedule, CallingClient.User, it)) .ToList(); await PaulRepository.AddCourseToScheduleAsync(schedule, connectedCourses); AddTutorialsForCourse(courseId); } else if (selectedCourse.Users.All(u => u.User != CallingClient.User)) { // The course has already been added to the schedule by someone else. // Add the calling user to the selected course (if not yet done). await PaulRepository.AddUserToSelectedCourseAsync(selectedCourse, CallingClient.User); var connectedCourseIds = selectedCourse.Course.ConnectedCourses.Select(it => it.Id).ToList(); var selectedConnectedCourses = schedule.SelectedCourses .Where(selCo => connectedCourseIds.Contains(selCo.CourseId)); foreach (var connectedCourse in selectedConnectedCourses) { await PaulRepository.AddUserToSelectedCourseAsync(connectedCourse, CallingClient.User); } } UpdateAddedStateInSearchResultsAndCourseList(course, isAdded: true); } finally { CallingClient.SharedScheduleVM.TimetableHubSemaphore.Release(); } UpdateTailoredViewModels(); } }
public Checker(ErrorReporter errorReporter) { this.errorReporter = errorReporter; idTable = new IdentificationTable(); EstablishStdEnvironment(); }
/// <summary> /// RPC-method for removing a course from the schedule /// </summary> /// <param name="courseId"></param> /// <returns></returns> public async Task RemoveCourse(string courseId) { using (var errorReporter = new ErrorReporter(s => CallingClient.Errors.ScheduleMessage = s)) { var course = PaulRepository.Courses.FirstOrDefault(c => c.Id == courseId); if (course == null) { errorReporter.Throw( new ArgumentException("Course not found", nameof(courseId)), UserErrorsViewModel.GenericErrorMessage); } var schedule = CallingClient.SharedScheduleVM.Schedule; await CallingClient.SharedScheduleVM.TimetableHubSemaphore.WaitAsync(); try { var selectedCourse = schedule.SelectedCourses.FirstOrDefault(c => c.CourseId == courseId); if (selectedCourse != null) { //Find selected Tutorials var selectedTutorials = schedule.SelectedCourses .Where(sel => selectedCourse.Course.Tutorials.Any(it => it.Id == sel.CourseId)) .Select(s => s.Course) .ToList(); var courses = selectedCourse.Course.ConnectedCourses .Concat(selectedTutorials) .Concat(new[] { selectedCourse.Course }); foreach (var course1 in courses) { try { if (course1.Tutorials.Any()) { // Remove all pending tutorials from all TailoredSchedules foreach (var user in CallingClient.SharedScheduleVM.Users) { user.TailoredScheduleVM.RemovePendingTutorials(course1.Tutorials.FirstOrDefault(), errorReporter); } } await PaulRepository.RemoveCourseFromScheduleAsync(schedule, course1.Id); UpdateAddedStateInSearchResultsAndCourseList(course1, isAdded: false); } catch (NullReferenceException e) { // This is just for purposes of compatibility // with development versions. Can be safely removed // after product launch PaulRepository.AddLog(e.Message, FatalityLevel.Normal, typeof(TimetableHub).Name); } } UpdateTailoredViewModels(); } else if (course.IsTutorial) { // The user has decided to remove a tutorial before joining one CallingClient.TailoredScheduleVM.RemovePendingTutorials(course, errorReporter); UpdateTailoredViewModels(); } else { errorReporter.Throw( new ArgumentException("Course not found in the schedule!"), UserErrorsViewModel.GenericErrorMessage); } } finally { CallingClient.SharedScheduleVM.TimetableHubSemaphore.Release(); } } }
/// <summary> /// Loads resources for the resolution of 870x1200. /// </summary> public static void LoadResources870x1200() { try { CardResources.Clear(); Back = MainResources870x1200.Resources.back; CardResources.Add(MainResources870x1200.Resources._1); CardResources.Add(MainResources870x1200.Resources._2); CardResources.Add(MainResources870x1200.Resources._3); CardResources.Add(MainResources870x1200.Resources._4); CardResources.Add(MainResources870x1200.Resources._5); CardResources.Add(MainResources870x1200.Resources._6); CardResources.Add(MainResources870x1200.Resources._7); CardResources.Add(MainResources870x1200.Resources._8); CardResources.Add(MainResources870x1200.Resources._9); CardResources.Add(MainResources870x1200.Resources._10); CardResources.Add(MainResources870x1200.Resources._11); CardResources.Add(MainResources870x1200.Resources._12); CardResources.Add(MainResources870x1200.Resources._13); CardResources.Add(MainResources870x1200.Resources._14); CardResources.Add(MainResources870x1200.Resources._15); CardResources.Add(MainResources870x1200.Resources._16); CardResources.Add(MainResources870x1200.Resources._17); CardResources.Add(MainResources870x1200.Resources._18); CardResources.Add(MainResources870x1200.Resources._19); CardResources.Add(MainResources870x1200.Resources._20); CardResources.Add(MainResources870x1200.Resources._21); CardResources.Add(MainResources870x1200.Resources._22); CardResources.Add(MainResources870x1200.Resources._23); CardResources.Add(MainResources870x1200.Resources._24); CardResources.Add(MainResources870x1200.Resources._25); CardResources.Add(MainResources870x1200.Resources._26); CardResources.Add(MainResources870x1200.Resources._27); CardResources.Add(MainResources870x1200.Resources._28); CardResources.Add(MainResources870x1200.Resources._29); CardResources.Add(MainResources870x1200.Resources._30); CardResources.Add(MainResources870x1200.Resources._31); CardResources.Add(MainResources870x1200.Resources._32); CardResources.Add(MainResources870x1200.Resources._33); CardResources.Add(MainResources870x1200.Resources._34); CardResources.Add(MainResources870x1200.Resources._35); CardResources.Add(MainResources870x1200.Resources._36); CardResources.Add(MainResources870x1200.Resources._37); CardResources.Add(MainResources870x1200.Resources._38); CardResources.Add(MainResources870x1200.Resources._39); CardResources.Add(MainResources870x1200.Resources._40); CardResources.Add(MainResources870x1200.Resources._41); CardResources.Add(MainResources870x1200.Resources._42); CardResources.Add(MainResources870x1200.Resources._43); CardResources.Add(MainResources870x1200.Resources._44); CardResources.Add(MainResources870x1200.Resources._45); CardResources.Add(MainResources870x1200.Resources._46); CardResources.Add(MainResources870x1200.Resources._47); CardResources.Add(MainResources870x1200.Resources._48); CardResources.Add(MainResources870x1200.Resources._49); CardResources.Add(MainResources870x1200.Resources._50); CardResources.Add(MainResources870x1200.Resources._51); CardResources.Add(MainResources870x1200.Resources._52); CardResources.Add(MainResources870x1200.Resources._53); CardResources.Add(MainResources870x1200.Resources._54); } catch (Exception TheException) { ErrorReporter.Report(TheException); } }
/// <summary> /// Creates a new compiler /// </summary> /// <param name="inputFile">The file containing the source code</param> public Compiler(string inputFile) { Reporter = new ErrorReporter(); Reader = new FileReader(inputFile); Tokenizer = new Tokenizer(Reader, Reporter); }
/// <summary> /// Resolves types. /// </summary> /// <param name="node"> </param> /// <param name="scope">The scope to resolve in.</param> /// <param name="reporter"> </param> public abstract bool ResolveReferencedTypes(ASTNode node, Scope scope, ErrorReporter reporter);
public async Task <Microsoft.Dafny.Program> ParseAsync(TextDocumentItem document, ErrorReporter errorReporter, CancellationToken cancellationToken) { await _mutex.WaitAsync(cancellationToken); try { var module = new LiteralModuleDecl(new DefaultModuleDecl(), null); var builtIns = new BuiltIns(); var parseErrors = Parser.Parse( document.Text, document.Uri.GetFileSystemPath(), // We use the full path as filename so we can better re-construct the DocumentUri for the definition lookup. document.Uri.GetFileSystemPath(), module, builtIns, errorReporter ); if (parseErrors != 0) { _logger.LogDebug("encountered {} errors while parsing {}", parseErrors, document.Uri); } if (!TryParseIncludesOfModule(module, builtIns, errorReporter)) { _logger.LogDebug("encountered error while parsing the includes of {}", document.Uri); } // TODO Remove PoC workaround: the file system path is used as a program name to return(new Dafny.Program(document.Uri.GetFileSystemPath(), module, builtIns, errorReporter)); } finally { _mutex.Release(); } }
public void TestToSha256InBase64(string input, string expected) { var actual = ErrorReporter.ToSha256InBase64(input); Assert.That(actual, Is.EqualTo(expected)); }
/// <summary> /// Creates a new type checker /// </summary> /// <param name="reporter">The error reporter to use</param> public TypeChecker(ErrorReporter reporter) { Reporter = reporter; }
public dynamic Parse(ITextStream stream, ErrorReporter errors, SourcePoint startLocation) { object result = this.parser.Parse(stream, errors, startLocation); return this.NormalizeResult(result); }
internal void SetErrorReporter(ErrorReporter aReporter) { mReporter = aReporter; }
public Argument(ArgumentAttribute attribute, FieldInfo field, ErrorReporter reporter) { _longName = CommandLineParser.LongName(attribute, field); _explicitShortName = CommandLineParser.ExplicitShortName(attribute); _shortName = CommandLineParser.ShortName(attribute, field); _hasHelpText = CommandLineParser.HasHelpText(attribute); _helpText = CommandLineParser.HelpText(attribute, field); _defaultValue = CommandLineParser.DefaultValue(attribute, field); _elementType = ElementType(field); _flags = Flags(attribute, field); _field = field; _seenValue = false; _reporter = reporter; _isDefault = attribute is DefaultArgumentAttribute; if (IsCollection) { _collectionValues = new ArrayList(); } Debug.Assert(!string.IsNullOrEmpty(_longName)); Debug.Assert(!_isDefault || !ExplicitShortName); Debug.Assert(!IsCollection || AllowMultiple, "Collection arguments must have allow multiple"); Debug.Assert(!Unique || IsCollection, "Unique only applicable to collection arguments"); Debug.Assert(IsValidElementType(Type) || IsCollectionType(Type)); Debug.Assert((IsCollection && IsValidElementType(_elementType)) || (!IsCollection && _elementType == null)); Debug.Assert(!(IsRequired && HasDefaultValue), "Required arguments cannot have default value"); Debug.Assert(!HasDefaultValue || (_defaultValue.GetType() == field.FieldType), "Type of default value must match field type"); }
public ModuleWeaver() { errorReporter = new ErrorReporter(this); }
private void ButtonOK_Click(object sender, EventArgs e) { var args = ApplyToArgument(); // validation if (args.FleetIDs == null || args.FleetIDs.Length == 0) { MessageBox.Show("出力する艦隊が指定されていません。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); args.DisposeResources(); return; } if (args.HorizontalFleetCount <= 0 || args.HorizontalShipCount <= 0) { MessageBox.Show("艦隊・艦船の横幅は 1 以上にしてください。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); args.DisposeResources(); return; } if (args.Fonts.Any(f => f == null)) { MessageBox.Show("未入力・不正なフォントが存在します。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); args.DisposeResources(); return; } if (!OutputToClipboard.Checked) { if (string.IsNullOrWhiteSpace(OutputPath.Text)) { MessageBox.Show("出力先ファイル名が入力されていません。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); args.DisposeResources(); return; } if (OutputPath.Text.ToCharArray().Intersect(Path.GetInvalidPathChars()).Any()) { MessageBox.Show("出力先に使用できない文字が含まれています。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); args.DisposeResources(); return; } if (!DisableOverwritePrompt.Checked && File.Exists(OutputPath.Text)) { if (MessageBox.Show(Path.GetFileName(OutputPath.Text) + "\r\nは既に存在します。\r\n上書きしますか?", "上書き確認", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No) { args.DisposeResources(); return; } } } int mode; if (ImageTypeCard.Checked) { mode = 0; } else if (ImageTypeCutin.Checked) { mode = 1; } else if (ImageTypeBanner.Checked) { mode = 2; } else { mode = 0; } try { if (!OutputToClipboard.Checked) { using (var image = GenerateFleetImage(args, mode)) { switch (Path.GetExtension(OutputPath.Text).ToLower()) { case ".png": default: image.Save(OutputPath.Text, System.Drawing.Imaging.ImageFormat.Png); break; case ".bmp": case ".dib": image.Save(OutputPath.Text, System.Drawing.Imaging.ImageFormat.Bmp); break; case ".gif": image.Save(OutputPath.Text, System.Drawing.Imaging.ImageFormat.Gif); break; case ".tif": case ".tiff": image.Save(OutputPath.Text, System.Drawing.Imaging.ImageFormat.Tiff); break; case ".jpg": case ".jpeg": case ".jpe": case ".jfif": { // jpeg quality settings var encoderParams = new System.Drawing.Imaging.EncoderParameters(); encoderParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 90L); var codecInfo = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders().FirstOrDefault(codec => codec.MimeType == "image/jpeg"); image.Save(OutputPath.Text, codecInfo, encoderParams); } break; } if (OpenImageAfterOutput.Checked) { System.Diagnostics.Process.Start(OutputPath.Text); } } } else { using (var image = GenerateFleetImage(args, mode)) { Clipboard.SetImage(image); } } if (CurrentArgument != null) { CurrentArgument.DisposeResources(); } CurrentArgument = args; SaveConfiguration(); Utility.Logger.Add(2, "編成画像を出力しました。"); } catch (Exception ex) { ErrorReporter.SendErrorReport(ex, "編成画像の出力に失敗しました。"); MessageBox.Show("編成画像の出力に失敗しました。\r\n" + ex.GetType().Name + "\r\n" + ex.Message, "編成画像出力失敗", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { args.DisposeResources(); } Close(); }
public DefaultWorkspaceSemanticTokensRefreshPublisher(IClientLanguageServer languageServer, ErrorReporter errorReporter) { if (languageServer is null) { throw new ArgumentNullException(nameof(languageServer)); } if (errorReporter is null) { throw new ArgumentNullException(nameof(errorReporter)); } _languageServer = languageServer; _workQueue = new BatchingWorkQueue(s_debounceTimeSpan, StringComparer.Ordinal, errorReporter: errorReporter); }
/// <summary> /// Parses Command Line Arguments. /// Use ArgumentAttributes 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> /// <returns> true if no errors were detected. </returns> public static bool ParseArguments(string[] arguments, object destination, ErrorReporter reporter) { Parser parser = new Parser(destination.GetType(), reporter); return parser.Parse(arguments, destination); }
public Encoder(ErrorReporter errorReporter) { _errorReporter = errorReporter; _emitter = new Emitter(_errorReporter); ElaborateStdEnvironment(); }
public void RunTest() { var er = new ErrorReporter(); er.Run("testmessage", "teststack"); }
/// <summary> /// Reports duplicate guids to the user /// </summary> /// <param name="errorText">The error text.</param> public void ReportDuplicateGuids(string errorText) { m_synchronizeInvoke.Invoke(() => ErrorReporter.ReportDuplicateGuids(FwRegistryHelper.FieldWorksRegistryKey, "*****@*****.**", null, errorText)); }
public ReferencedFileSave CreateReferencedFileSaveForExistingFile(IElement containerForFile, string directoryInsideContainer, string absoluteFileName, PromptHandleEnum unknownTypeHandle, AssetTypeInfo ati, out string creationReport, out string errorMessage) { creationReport = ""; errorMessage = null; ReferencedFileSave referencedFileSaveToReturn = null; string whyItIsntValid; // Let's see if there is already an Entity with the same name string fileWithoutPath = FileManager.RemovePath(FileManager.RemoveExtension(absoluteFileName)); bool isValid = NameVerifier.IsReferencedFileNameValid(fileWithoutPath, ati, referencedFileSaveToReturn, containerForFile, out whyItIsntValid); if (!isValid) { errorMessage = "Invalid file name:\n" + fileWithoutPath + "\n" + whyItIsntValid; } else { Zipper.UnzipAndModifyFileIfZip(ref absoluteFileName); string extension = FileManager.GetExtension(absoluteFileName); bool isValidExtensionOrIsConfirmedByUser; bool isUnknownType; FlatRedBall.Glue.Plugins.ExportedImplementations.CommandInterfaces.ElementCommands.CheckAndWarnAboutUnknownFileTypes(unknownTypeHandle, extension, out isValidExtensionOrIsConfirmedByUser, out isUnknownType); string fileToAdd = null; if (isValidExtensionOrIsConfirmedByUser) { string directoryThatFileShouldBeRelativeTo = FlatRedBall.Glue.Plugins.ExportedImplementations.CommandInterfaces.ElementCommands.GetFullPathContentDirectory(containerForFile, directoryInsideContainer); string projectDirectory = ProjectManager.ContentProject.GetAbsoluteContentFolder(); bool needsToCopy = !FileManager.IsRelativeTo(absoluteFileName, projectDirectory); if (needsToCopy) { fileToAdd = directoryThatFileShouldBeRelativeTo + FileManager.RemovePath(absoluteFileName); fileToAdd = FileManager.MakeRelative(fileToAdd, ProjectManager.ContentProject.GetAbsoluteContentFolder()); try { FileHelper.RecursivelyCopyContentTo(absoluteFileName, FileManager.GetDirectory(absoluteFileName), directoryThatFileShouldBeRelativeTo); } catch (System.IO.FileNotFoundException fnfe) { errorMessage = "Could not copy the files because of a missing file: " + fnfe.Message; } } else { fileToAdd = FlatRedBall.Glue.Plugins.ExportedImplementations.CommandInterfaces.ElementCommands.GetNameOfFileRelativeToContentFolder(absoluteFileName, directoryThatFileShouldBeRelativeTo, projectDirectory); } } if (string.IsNullOrEmpty(errorMessage)) { BuildToolAssociation bta = null; if (ati != null && !string.IsNullOrEmpty(ati.CustomBuildToolName)) { bta = BuildToolAssociationManager.Self.GetBuilderToolAssociationByName(ati.CustomBuildToolName); } if (containerForFile != null) { referencedFileSaveToReturn = containerForFile.AddReferencedFile(fileToAdd, ati, bta); } else { bool useFullPathAsName = false; // todo - support built files here referencedFileSaveToReturn = AddReferencedFileToGlobalContent(fileToAdd, useFullPathAsName); } // This will be null if there was an error above in creating this file if (referencedFileSaveToReturn != null) { if (containerForFile != null) { containerForFile.HasChanged = true; } if (fileToAdd.EndsWith(".csv")) { string fileToAddAbsolute = ProjectManager.MakeAbsolute(fileToAdd); CsvCodeGenerator.GenerateAndSaveDataClass(referencedFileSaveToReturn, referencedFileSaveToReturn.CsvDelimiter); } if (isUnknownType) { referencedFileSaveToReturn.LoadedAtRuntime = false; } string error; referencedFileSaveToReturn.RefreshSourceFileCache(false, out error); if (!string.IsNullOrEmpty(error)) { ErrorReporter.ReportError(referencedFileSaveToReturn.Name, error, false); } } } } return(referencedFileSaveToReturn); }
private bool TryParseInclude(Include include, ModuleDecl module, BuiltIns builtIns, ErrorReporter errorReporter, Errors errors) { try { var dafnyFile = new DafnyFile(include.includedFilename); int errorCount = Parser.Parse( dafnyFile.SourceFileName, include, module, builtIns, errors, verifyThisFile: false, compileThisFile: false ); if (errorCount != 0) { errorReporter.Error(MessageSource.Parser, include.tok, $"{errorCount} parse error(s) detected in {include.includedFilename}"); return(false); } } catch (IllegalDafnyFile e) { errorReporter.Error(MessageSource.Parser, include.tok, $"Include of file {include.includedFilename} failed."); _logger.LogDebug(e, "encountered include of illegal dafny file {}", include.includedFilename); return(false); } catch (IOException e) { errorReporter.Error(MessageSource.Parser, include.tok, $"Unable to open the include {include.includedFilename}."); _logger.LogDebug(e, "could not open file {}", include.includedFilename); return(false); } return(true); }
/// <summary> /// Removes the calling user from the specified selected course. /// If after the removal no other user has selected the course, /// the course is removed from the schedule. /// </summary> /// <remarks> /// If the user has not selected the course with the specified ID, /// nothing happens. /// </remarks> /// <param name="courseId">Course ID</param> /// <returns></returns> public async Task RemoveUserFromCourse(string courseId, bool acquireSemaphore = true) { using (var errorReporter = new ErrorReporter(s => CallingClient.Errors.ScheduleMessage = s)) { if (PaulRepository.Courses.All(c => c.Id != courseId)) { errorReporter.Throw( new ArgumentException("Course not found", nameof(courseId)), UserErrorsViewModel.GenericErrorMessage); } var schedule = CallingClient.SharedScheduleVM.Schedule; var selectedCourse = schedule.SelectedCourses .FirstOrDefault(c => c.CourseId == courseId); if (selectedCourse == null) { errorReporter.Throw( new ArgumentException("Course not found in the schedule!"), UserErrorsViewModel.GenericErrorMessage); } var selectedConnectedCourses = schedule.SelectedCourses .Where(sel => selectedCourse.Course.ConnectedCourses.Any(it => it.Id == sel.CourseId)) .ToList(); if (acquireSemaphore) { await CallingClient.SharedScheduleVM.TimetableHubSemaphore.WaitAsync(); } try { var selectedCourseUser = selectedCourse.Users.FirstOrDefault(o => o.User == CallingClient.User); //Find selected Tutorials var selectedTutorials = schedule.SelectedCourses .Where(sel => selectedCourse.Course.Tutorials .Concat(selectedConnectedCourses.SelectMany(s => s.Course.Tutorials)) .Any(it => it.Id == sel.CourseId)) .ToList(); if (selectedCourseUser != null) { // Remove user from selected courses foreach (var sel in selectedConnectedCourses.Concat(selectedTutorials).Concat(new[] { selectedCourse })) { await PaulRepository.RemoveUserFromSelectedCourseAsync(sel, selectedCourseUser); } } if (!selectedCourse.Users.Any()) { var firstTutorials = selectedCourse.Course.Tutorials.Take(1) .Concat(selectedConnectedCourses.SelectMany(s => s.Course.Tutorials.Take(1))); // Remove all Pending Tutorials from all TailoredSchedules foreach (var user in CallingClient.SharedScheduleVM.Users) { foreach (var t in firstTutorials) { user.TailoredScheduleVM.RemovePendingTutorials(t, errorReporter); } } // The course is no longer selected by anyone // -> Remove the whole course from schedule foreach (var sel in selectedConnectedCourses.Concat(selectedTutorials).Concat(new[] { selectedCourse })) { await PaulRepository.RemoveCourseFromScheduleAsync(schedule, sel.CourseId); } } UpdateAddedStateInSearchResultsAndCourseList(selectedCourse.Course, isAdded: false); UpdateTailoredViewModels(); } finally { if (acquireSemaphore) { CallingClient.SharedScheduleVM.TimetableHubSemaphore.Release(); } } } }
/// <summary> /// show a dialog or output to the error log, as appropriate. /// </summary> /// <param name="error">the exception you want to report</param> /// <param name="isLethal">set to <c>true</c> if the error is lethal, otherwise /// <c>false</c>.</param> public void ReportException(Exception error, bool isLethal) { m_synchronizeInvoke.Invoke(() => ErrorReporter.ReportException(error, null, null, null, isLethal)); }
public Emitter(ErrorReporter errorReporter) { _errorReporter = errorReporter; _nextInstrAddr = Machine.CodeBase; }
/// <summary> /// Constructs the parser. /// </summary> /// <param name="errorReporter">The error reporter instance.</param> /// <param name="context">The parser context.</param> public SoaLanguageParser(ErrorReporter errorReporter, SoaLanguageContext context) : base() { this.errorReporter = errorReporter; this.context = context; }
public void TestGetEnvironment(string informationalVersion, string environment) { Assert.That(ErrorReporter.GetEnvironment(informationalVersion), Is.EqualTo(environment)); }
public static ThriftFileElement Parse(Location location, string data, ErrorReporter errorReporter) { throw new System.NotImplementedException(); }
/// <summary> /// Explores the P# program for bugs. /// </summary> private static void FindBugs() { Output.Print("... Using '{0}' strategy", AnalysisContext.Strategy); Task task = new Task(() => { for (int i = 0; i < Configuration.SchedulingIterations; i++) { if (SCTEngine.ShouldPrintIteration(i + 1)) { Output.Print("..... Iteration #{0}", i + 1); } PSharpRuntime.BugFinder = new Scheduler(SCTEngine.Strategy); StringWriter sw = null; if (Configuration.Verbose < 2) { sw = SCTEngine.RedirectOutput(); SCTEngine.HasRedirectedOutput = true; } // Start the test and wait for it to terminate. AnalysisContext.TestMethod.Invoke(null, null); PSharpRuntime.WaitMachines(); // Runs the liveness checker to find any liveness property violations. // Requires that no bug has been found and the scheduler terminated // before reaching the depth bound. if (Configuration.CheckLiveness && !PSharpRuntime.BugFinder.BugFound) { PSharpRuntime.LivenessChecker.Run(); } if (SCTEngine.HasRedirectedOutput) { SCTEngine.ResetOutput(); } SCTEngine.ExploredSchedules++; SCTEngine.ExploredDepth = PSharpRuntime.BugFinder.SchedulingPoints; if (PSharpRuntime.BugFinder.BugFound) { SCTEngine.NumOfFoundBugs++; SCTEngine.BugReport = PSharpRuntime.BugFinder.BugReport; } else { SCTEngine.BugReport = ""; } if (SCTEngine.Strategy.HasFinished()) { break; } SCTEngine.Strategy.Reset(); if (!Configuration.FullExploration && (SCTEngine.NumOfFoundBugs > 0 || Configuration.PrintTrace)) { if (sw != null && !Configuration.SuppressTrace) { SCTEngine.PrintTrace(sw); } break; } } }); Profiler.StartMeasuringExecutionTime(); task.Start(); try { if (Configuration.AnalysisTimeout > 0) { task.Wait(Configuration.AnalysisTimeout * 1000); } else { task.Wait(); } } catch (AggregateException) { if (SCTEngine.HasRedirectedOutput) { SCTEngine.ResetOutput(); } ErrorReporter.ReportAndExit("Internal systematic testing exception. " + "Please send a bug report to the developers."); } finally { Profiler.StopMeasuringExecutionTime(); } }
public dynamic Parse(ITextStream stream, ErrorReporter errors) { object result = this.parser.Parse(stream, errors); return this.NormalizeResult(result); }
private static void Main() { ErrorReporter.WithErrorReporting(MainImpl); }
internal void FireParseError(ErrorReporter aErrorReporter) { var handler = ParseError; if (handler != null) handler(this, new CssParserErrorEventArgs(aErrorReporter)); }
/// <summary> /// Creates a new parser /// </summary> /// <param name="reporter">The error reporter to use</param> public Parser(ErrorReporter reporter) { Reporter = reporter; }
private static ArrayList Parse(StreamReader stream, ErrorReporter reporter) { var compilerEnvirons = new CompilerEnvirons(); var parser = new Parser(compilerEnvirons, reporter); parser.Parse(stream, null, 1); string source = parser.EncodedSource; int offset = 0; int length = source.Length; var tokens = new ArrayList(); var stringBuilder = new StringBuilder(); while (offset < length) { int tt = source[offset++]; switch (tt) { case Token.CONDCOMMENT: case Token.KEEPCOMMENT: case Token.NAME: case Token.REGEXP: case Token.STRING: stringBuilder.Length = 0; offset = PrintSourceString(source, offset, stringBuilder); tokens.Add(new JavaScriptToken(tt, stringBuilder.ToString())); break; case Token.NUMBER: stringBuilder.Length = 0; offset = PrintSourceNumber(source, offset, stringBuilder); tokens.Add(new JavaScriptToken(tt, stringBuilder.ToString())); break; default: var literal = (string) Literals[tt]; if (literal != null) { tokens.Add(new JavaScriptToken(tt, literal)); } break; } } return tokens; }
/// <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> /// <returns> true if no errors were detected. </returns> public static bool ParseCommandLineArguments(string[] arguments, object destination, ErrorReporter reporter) { CommandLineArgumentParser parser = new CommandLineArgumentParser(destination.GetType(), reporter); return(parser.Parse(arguments, destination)); }
/// <summary> /// Constructs the name validator. /// </summary> /// <param name="errorReporter">The error reporter instance.</param> /// <param name="context">The parser context.</param> public NameValidator(ErrorReporter errorReporter, SoaLanguageContext context) : base(errorReporter, context) { }
public override void PopulateRecordBar(RecordList recList) { CheckDisposed(); // The ListBar has a problem in that when it is populated for the first time the horizonal // scroll scrolls over a little ways over hiding the left most + or -. I (Rand) sent some // time searching this out and found that it is a bug in the ListView control. It is not // our bug. The scrolling happens when EnsureVisible() is called on the listview. I found // a way around it. By calling this method twice the bug goes away, it looks like the list // must be populated, cleared, then repopulated before the bug is bypassed. There are also // other things that have an effect on it, such as ClearListBar() must be before // BeginUpdate(). Also selection must be made before ExpandAll() or CollapseAll() is called. // JohnT: no, the problem is when we EnsureVisible of a node that is wider than the window. // EnsureVisble tries to show as much as possible of the label; since it won't fit, it scrolls // horizontally and hides the plus/minus. // To avoid this if it is desired to EnsureVisible, use the EnsureSelectedNodeVisible routine // (which temporarily makes the label short while calling EnsureVisible). // (I'm not sure why Rand's comment is in this exact location, so I'm not deleting it.) if (this.IsShowing) { m_fOutOfDate = false; } else { m_fOutOfDate = true; return; } XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window"); window.TreeBarControl.IsFlatList = true; using (new WaitCursor(window)) { ListView list = (ListView)window.ListStyleRecordList; list.BeginUpdate(); window.ClearRecordBarList(); //don't want to directly clear the nodes, because that causes an event to be fired as every single node is removed! m_hvoToListViewItemTable.Clear(); AddListViewItems(recList.SortedObjects, list); try { list.Font = new System.Drawing.Font(recList.FontName, recList.TypeSize); } catch (Exception error) { IApp app = (IApp)m_mediator.PropertyTable.GetValue("App"); ErrorReporter.ReportException(error, app.SettingsKey, m_mediator.FeedbackInfoProvider.SupportEmailAddress, null, false); } UpdateSelection(recList.CurrentObject); list.EndUpdate(); if (list.SelectedItems.Count > 0) { } //list.s .EnsureVisible(); } }
public OptionList(Options optionBundle) { if (optionBundle == null) throw new ArgumentNullException("optionBundle"); Type optionsType = optionBundle.GetType(); this.optionBundle = optionBundle; parsingMode = optionBundle.ParsingMode; breakSingleDashManyLettersIntoManyOptions = optionBundle.BreakSingleDashManyLettersIntoManyOptions; endOptionProcessingWithDoubleDash = optionBundle.EndOptionProcessingWithDoubleDash; ReportError = optionBundle.ReportError; ExtractEntryAssemblyInfo(optionsType); foreach(MemberInfo mi in optionsType.GetMembers()) { object[] attribs = mi.GetCustomAttributes(typeof(KillOptionAttribute), true); if (attribs == null || attribs.Length == 0) { attribs = mi.GetCustomAttributes(typeof(OptionAttribute), true); if (attribs != null && attribs.Length > 0) { OptionDetails option = new OptionDetails(mi, (OptionAttribute) attribs[0], optionBundle); list.Add(option); HasSecondLevelHelp = HasSecondLevelHelp || option.SecondLevelHelp; } else if (mi.DeclaringType == mi.ReflectedType) { // not inherited attribs = mi.GetCustomAttributes(typeof(ArgumentProcessorAttribute), true); if (attribs != null && attribs.Length > 0) AddArgumentProcessor(mi); } } } if (argumentProcessor == null) // try to find an inherited one foreach(MemberInfo mi in optionsType.GetMembers()) if (mi.DeclaringType != mi.ReflectedType) { // inherited object[] attribs = mi.GetCustomAttributes(typeof(ArgumentProcessorAttribute), true); if (attribs != null && attribs.Length > 0) AddArgumentProcessor(mi); } }
private void RefreshSourceFileCache() { List <string> errors = new List <string>(); // parallelizing this seems to screw things up when a plugin tries to do something on the UI thread //Parallel.ForEach(ProjectManager.GlueProjectSave.Screens, (screen) => foreach (ScreenSave screen in ProjectManager.GlueProjectSave.Screens) { foreach (ReferencedFileSave rfs in screen.ReferencedFiles) { string error; rfs.RefreshSourceFileCache(true, out error); if (!string.IsNullOrEmpty(error)) { lock (errors) { errors.Add(error + " in " + screen.ToString()); } } } } //); //Parallel.ForEach(ProjectManager.GlueProjectSave.Entities, (entitySave) => foreach (EntitySave entitySave in ProjectManager.GlueProjectSave.Entities) { foreach (ReferencedFileSave rfs in entitySave.ReferencedFiles) { string error; rfs.RefreshSourceFileCache(true, out error); if (!string.IsNullOrEmpty(error)) { lock (errors) { errors.Add(error + " in " + entitySave.ToString()); } } } } //); //Parallel.ForEach(ProjectManager.GlueProjectSave.GlobalFiles, (rfs) => foreach (ReferencedFileSave rfs in ProjectManager.GlueProjectSave.GlobalFiles) { string error; rfs.RefreshSourceFileCache(true, out error); if (!string.IsNullOrEmpty(error)) { lock (errors) { errors.Add(error + " in Global Content Files"); } } } //); foreach (var error in errors) { ErrorReporter.ReportError("", error, true); } }
/// <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"); }
/// <summary> /// Creates a new scope size recorder /// </summary> /// <param name="reporter">The error reporter</param> public ScopeSizeRecorder(ErrorReporter reporter) { Reporter = reporter; }