//const string NOT_ENCRYPTED_MSG = "This file wasn't encrypted!"; //const string ALREADY_ENCRYPTED_MSG = "This file is already encrypted!"; public Application(IOutputPrinter consolePrinter, IInfoCollector infoCollector, IEncryptionService encryptionService, ISwitchInfo switchInfo) { _consolePrinter = consolePrinter; _encryptionService = encryptionService; _switchInfo = switchInfo; _infoCollector = infoCollector; }
/// <summary> /// 创建默认的UGV控制器 /// </summary> private UGV() { MovementControl = new Motions(Motor.Motor_Default); LEDControl = new ILEDController[NumberofLEDs]; ServoControl = Servo.Default; LEDControl[0] = LEDController.LEDGroup_BlueRed; Sensor = new SensorGroup(SuperSonic.Default, Gyroscope.Default); OperationTimeout = 1000; }
async Task <bool> ReportExceptionCoreAsync(Exception ex, IInfoCollector collector) { if (!ShouldSendExceptionReport()) { return(false); } LogifyClientExceptionReport report = CreateExceptionReport(ex, collector); return(await SendExceptionReportAsync(report)); }
bool ReportExceptionCore(Exception ex, IInfoCollector collector) { if (!ShouldSendExceptionReport()) { return(false); } LogifyClientExceptionReport report = CreateExceptionReport(ex, collector); return(SendExceptionReport(report)); }
async Task <bool> PerformReportExceptionAsync(Exception ex, IInfoCollector collector) { if (ex == null || collector == null) { return(false); } try { return(await ReportExceptionCoreAsync(ex, collector)); } catch { return(false); } }
bool PerformReportException(Exception ex, IInfoCollector collector) { if (ex == null || collector == null) { return(false); } try { return(ReportExceptionCore(ex, collector)); } catch { return(false); } }
LogifyClientExceptionReport CreateExceptionReport(Exception ex, IInfoCollector collector) { StringBuilder content = new StringBuilder(); StringWriter writer = new StringWriter(content); TextWriterLogger logger = new TextWriterLogger(writer); logger.BeginWriteObject(String.Empty); try { collector.Process(ex, logger); } finally { logger.EndWriteObject(String.Empty); } LogifyClientExceptionReport report = new LogifyClientExceptionReport(); report.ReportContent = content; report.Data = logger.Data; return(report); }
internal static async Task <bool> ReportExceptionAsync(Exception ex, IInfoCollector collector) { IExceptionReportSender reportSender = ExceptionLoggerFactory.Instance.PlatformReportSender; if (reportSender == null) { return(false); } if (collector == null) { return(false); } reportSender = reportSender.Clone(); ExceptionLogger logger = new ExceptionLogger(); logger.ReportSender = reportSender; return(await logger.PerformReportExceptionAsync(ex, collector)); }