// Start is called before the first frame update void Start() { com.fpnn.common.ErrorRecorder RerrorRecorderecorder = new ErrorRecorder(); Config config = new Config { errorRecorder = RerrorRecorderecorder }; ClientEngine.Init(config); RTMConfig rtmConfig = new RTMConfig() { defaultErrorRecorder = RerrorRecorderecorder }; RTMControlCenter.Init(rtmConfig); testThread = new Thread(TestMain) { IsBackground = true }; testThread.Start(); /* * This is a temporary version of the test code, because the audio-related functions require running on the main thread, so add it here */ // tester = new Audios(); // tester.Start(rtmServerEndpoint, pid, uid, token); }
private DirectoryState DeleteDirectoryTree([NotNull] DirectoryEntry directory, bool isRecursive, [NotNull] ErrorRecorder recorder) { var state = new DirectoryState(recorder); if (isRecursive) { state.MarkHasRead(); foreach (BaseEntry entry in directory.EnumerateEntries(EnumerationFilter.All).OrderBy(x => x.Name).ToArray()) { if (entry is FileEntry file) { DeleteSingleFile(file, state); } else if (entry is DirectoryEntry subdirectory) { DirectoryState subState = DeleteDirectoryTree(subdirectory, true, recorder); state.PropagateSubdirectoryState(subState); } } } if (state.AccessKinds != FileAccessKinds.None) { Container.ChangeTracker.NotifyContentsAccessed(directory.PathFormatter, state.AccessKinds); } DeleteSingleDirectory(directory, state); return(state); }
/// <summary> /// 快捷查看访问的服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmLogin_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.F1) { InputBox("", "", ErpWs.HelloWorld()); } if (e.KeyCode == Keys.Enter) { ErrorRecorder.SafeExecute(Login, HandleLoginError); } }
static void RecordErrors(IEnumerable <Error> errors, string directory) { IErrorRecorder errorRecorder = new ErrorRecorder(); try { errorRecorder.RecordErrors(errors, directory); } catch (IOException e) { ExitWithErrorString("Error: IOException: " + e.Message); } }
public TaskThreadPoolCore(int tempLatencySeconds, bool usingBackgroundThread) { backgroundThread = usingBackgroundThread; normalThreadCount = 0; busyThreadCount = 0; tempThreadCount = 0; stopped = false; semaphore = new Semaphore(0, Int32.MaxValue); taskQueue = new Queue <ITask>(); tempThreadLatencySeconds = tempLatencySeconds; errorRecorder = defaultErrorRecorder; }
public override Missing Handle(DirectoryDeleteArguments arguments) { Guard.NotNull(arguments, nameof(arguments)); AssertNotDeletingVolumeRoot(arguments); DirectoryEntry directory = ResolveDirectory(arguments.Path); AssertNoConflictWithCurrentDirectory(directory, arguments.Path); AssertIsEmptyOrRecursive(directory, arguments.IsRecursive); using (var recorder = new ErrorRecorder()) { DeleteDirectoryTree(directory, arguments.IsRecursive, recorder); } return(Missing.Value); }
static void ValidateFiles(string testPackageFilePath, string csvFilePath, string errorsDirectory) { IFileValidator fileValidator = new FileValidator(); ErrorRecorder errorRecorder = new ErrorRecorder(); try { fileValidator.ValidateTestPackage(testPackageFilePath); } catch (FileNotFoundException e) { ExitWithErrorString("Error: Test package not found: " + e.Message); } catch (InvalidFileException e) { ExitWithErrorString("Error: Test package is invalid: " + e.Message); } Console.WriteLine("Validating illustration list..."); try { fileValidator.ValidateIllustrationSpreadsheet(csvFilePath); } catch (FileNotFoundException e) { ExitWithErrorString("Error: Illustration spreadsheet not found: " + e.Message); } catch (InvalidFileException e) { ExitWithErrorString("Error: Illustration spreadsheet is invalid: " + e.Message); } Console.WriteLine("Removing previous warning and error files..."); try { errorRecorder.RemoveExistingErrors(errorsDirectory); } catch (IOException e) { ExitWithErrorString("Error: IOException: " + e.Message); } }
// Start is called before the first frame update void Start() { com.fpnn.common.ErrorRecorder RerrorRecorderecorder = new ErrorRecorder(); Config config = new Config { errorRecorder = RerrorRecorderecorder }; ClientEngine.Init(config); RTMConfig rtmConfig = new RTMConfig() { defaultErrorRecorder = RerrorRecorderecorder }; RTMControlCenter.Init(rtmConfig); testThread = new Thread(TestMain) { IsBackground = true }; testThread.Start(); }
internal static void ParseFileMessage(BaseMessage baseMessage, ErrorRecorder errorRecorder) { try { Dictionary <string, object> infoDict = Json.ParseObject(baseMessage.stringMessage); if (infoDict != null) { if (infoDict.TryGetValue("url", out object urlText)) { baseMessage.fileInfo.url = (string)urlText; } if (infoDict.TryGetValue("size", out object sizeInt)) { baseMessage.fileInfo.size = (Int32)Convert.ChangeType(sizeInt, TypeCode.Int32); } if (baseMessage.messageType == (byte)MessageType.ImageFile) { if (infoDict.TryGetValue("surl", out object surlText)) { baseMessage.fileInfo.surl = (string)surlText; } } baseMessage.stringMessage = null; } } catch (JsonException e) { if (errorRecorder != null) { errorRecorder.RecordError("Parse file msg error. Full msg: " + baseMessage.stringMessage, e); } } }
/// <summary> /// Return a DFS parsed from the text. Throw if error during parsing. /// </summary> /// <param name="text"></param> /// <returns></returns> public static DetectorFinalState Parse(this string text) { // Lex. var input = new AntlrInputStream(text); var lexer = new FinalStatePatternLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); // Parse, capture errors. var parser = new FinalStatePatternParser(tokens); var errors = new ErrorRecorder(); parser.AddErrorListener(errors); var tree = parser.top_level(); if (errors.Errors.Count > 0) { string msg = ""; foreach (var e in errors.Errors) { msg += e; } throw new ArgumentException(msg); } // Convert to DFS var traverser = new FinalStatePatternListener(); var walker = new ParseTreeWalker(); walker.Walk(traverser, tree); // And collect the DFS return(traverser.BuildDFS()); }
public DirectoryState([NotNull] ErrorRecorder recorder) { Guard.NotNull(recorder, nameof(recorder)); this.recorder = recorder; }
public void SetErrorRecorder(ErrorRecorder recorder) { errorRecorder = recorder; }
public void SetErrorRecorder(ErrorRecorder er) { core.errorRecorder = er; }
public static void SetDefaultErrorRecorder(ErrorRecorder er) { defaultErrorRecorder = er; }
protected EntityAccessBase(ConnectionStringSettings connection) { connectionString = new System.Data.Entity.Core.EntityClient.EntityConnectionStringBuilder(connection.ConnectionString).ProviderConnectionString; errorRecorder = new ErrorRecorder("Application", "SADFM.Data"); }
internal static void ParseFileAttrs(BaseMessage baseMessage, ErrorRecorder errorRecorder) { try { Dictionary <string, object> attrsDict = Json.ParseObject(baseMessage.attrs); if (attrsDict != null) { if (attrsDict.TryGetValue("rtm", out object rtmAttrs)) { Dictionary <string, object> rtmAttrsDict = (Dictionary <string, object>)rtmAttrs; if (rtmAttrsDict.TryGetValue("type", out object typeText)) { string typeStr = (string)typeText; if (typeStr.Equals("audiomsg")) { baseMessage.fileInfo.isRTMAudio = true; } } if (baseMessage.fileInfo.isRTMAudio) { if (rtmAttrsDict.TryGetValue("lang", out object languageText)) { baseMessage.fileInfo.language = (string)languageText; } if (rtmAttrsDict.TryGetValue("duration", out object durationInt)) { baseMessage.fileInfo.duration = (Int32)Convert.ChangeType(durationInt, TypeCode.Int32); } } } if (attrsDict.TryGetValue("custom", out object attrsInfo)) { try { Dictionary <string, object> userAttrsDict = (Dictionary <string, object>)attrsInfo; baseMessage.attrs = Json.ToString(userAttrsDict); return; } catch (Exception) { try { string userAttrs = (string)attrsInfo; baseMessage.attrs = userAttrs; return; } catch (Exception ex) { if (errorRecorder != null) { errorRecorder.RecordError("Convert user attrs to string type for file attrs error. Full attrs: " + baseMessage.attrs, ex); } } } } } } catch (JsonException e) { if (errorRecorder != null) { errorRecorder.RecordError("Parse file attrs error. Full attrs: " + baseMessage.attrs, e); } } }
internal static void BuildFileInfo(BaseMessage baseMessage, ErrorRecorder errorRecorder) { baseMessage.fileInfo = new FileInfo(); ParseFileMessage(baseMessage, errorRecorder); ParseFileAttrs(baseMessage, errorRecorder); }
private void btnLogin_Click(object sender, EventArgs e) { ErrorRecorder.SafeExecute(Login, HandleLoginError); }