コード例 #1
0
        //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;
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        async Task <bool> ReportExceptionCoreAsync(Exception ex, IInfoCollector collector)
        {
            if (!ShouldSendExceptionReport())
            {
                return(false);
            }

            LogifyClientExceptionReport report = CreateExceptionReport(ex, collector);

            return(await SendExceptionReportAsync(report));
        }
コード例 #4
0
        bool ReportExceptionCore(Exception ex, IInfoCollector collector)
        {
            if (!ShouldSendExceptionReport())
            {
                return(false);
            }

            LogifyClientExceptionReport report = CreateExceptionReport(ex, collector);

            return(SendExceptionReport(report));
        }
コード例 #5
0
        async Task <bool> PerformReportExceptionAsync(Exception ex, IInfoCollector collector)
        {
            if (ex == null || collector == null)
            {
                return(false);
            }

            try {
                return(await ReportExceptionCoreAsync(ex, collector));
            }
            catch {
                return(false);
            }
        }
コード例 #6
0
        bool PerformReportException(Exception ex, IInfoCollector collector)
        {
            if (ex == null || collector == null)
            {
                return(false);
            }

            try {
                return(ReportExceptionCore(ex, collector));
            }
            catch {
                return(false);
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
        }