public async Task Executar(FiltroRelatorioDto request)
        {
            var relatorioQuery = request.ObterObjetoFiltro <ObterRelatorioConselhoClasseAlunoQuery>();

            SentrySdk.CaptureMessage("4.09 Obtendo relatorio.. - RelatorioConselhoClasseAlunoUseCase");

            var relatorio = await mediator.Send(relatorioQuery);

            SentrySdk.CaptureMessage("5.1 Obtive relatorio.. - RelatorioConselhoClasseAlunoUseCase");

            var urlRelatorio = "";

            if (relatorio.Relatorio.FirstOrDefault().EhBimestreFinal)
            {
                urlRelatorio = "/sgp/RelatorioConselhoClasse/ConselhoClasseAbaFinal";
            }
            else
            {
                urlRelatorio = "/sgp/RelatorioConselhoClasse/ConselhoClasse";
            }

            var relatorioSerializado = JsonConvert.SerializeObject(relatorio);

            SentrySdk.CaptureMessage("5.2 Serializei relatório.. - RelatorioConselhoClasseAlunoUseCase");

            SentrySdk.AddBreadcrumb("5 - Obtive o relatorio serializado : " + relatorioSerializado, "5 - RelatorioConselhoClasseAlunoUseCase");
            await mediator.Send(new GerarRelatorioAssincronoCommand(urlRelatorio, relatorioSerializado, TipoFormatoRelatorio.Pdf, request.CodigoCorrelacao));

            SentrySdk.CaptureMessage("5 FINAL - RelatorioConselhoClasseAlunoUseCase");
        }
Ejemplo n.º 2
0
        public EstruturaInstitucionalRetornoEolDTO ObterEstruturaInstuticionalVigentePorDre()
        {
            EstruturaInstitucionalRetornoEolDTO resultado = null;
            var    codigosDres = ObterCodigosDres();
            string url         = $"abrangencia/estrutura-vigente";

            if (codigosDres != null && codigosDres.Length > 0)
            {
                resultado = new EstruturaInstitucionalRetornoEolDTO();
                foreach (var item in codigosDres)
                {
                    httpClient.DefaultRequestHeaders.Clear();

                    var resposta = httpClient.GetAsync($"{url}/{item}").Result;

                    if (resposta.IsSuccessStatusCode)
                    {
                        var json    = resposta.Content.ReadAsStringAsync().Result;
                        var parcial = JsonConvert.DeserializeObject <EstruturaInstitucionalRetornoEolDTO>(json);

                        if (parcial != null)
                        {
                            resultado.Dres.AddRange(parcial.Dres);
                        }
                    }
                    else
                    {
                        SentrySdk.AddBreadcrumb($"Ocorreu um erro na tentativa de buscar os dados de Estrutura Institucional Vigente por Dre: {item} - HttpCode {resposta.StatusCode} - Body {resposta.Content?.ReadAsStringAsync()?.Result ?? string.Empty}");
                    }
                }
            }

            return(resultado);
        }
 public async Task<bool> Executar(MensagemRabbit mensagemRabbit)
 {
     SentrySdk.AddBreadcrumb($"Mensagem {nameof(AtualizarPendenciaRegistroIndividualUseCase)}", $"Rabbit - {nameof(AtualizarPendenciaRegistroIndividualUseCase)}");
     var command = mensagemRabbit.ObterObjetoMensagem<AtualizarPendenciaRegistroIndividualCommand>();
     await mediator.Send(command);
     return true;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Update data when character changes
 /// </summary>
 public void CharacterSelectionChanged()
 {
     try
     {
         if (!_finishedLoad)
         {
             return;
         }
         if (SelectedCharacterIndex != -1 && SelectedCharacterIndex <= CharacterNamesCollection.Count)
         {
             SentrySdk.AddBreadcrumb($"CharNameCollCnt:{CharacterNamesCollection.Count}, CharIdx:{SelectedCharacterIndex}, VnId:{VndbContentViewModel.VnId}");
             _characterId = CharacterNamesCollection[SelectedCharacterIndex].Key;
             UpdateCharacterData();
         }
         else
         {
             return;
         }
     }
     catch (Exception e)
     {
         App.Logger.Warning(e, "Failed to search for Change character data on SelectionChanged");
         SentryHelper.SendException(e, null, SentryLevel.Warning);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Sends a report to Sentry only (no log, no toast, etc.).
        /// Does not send to Sentry if ApplicationUpdateSupport.IsDev is true.
        /// Fails silently (unless throwOnException is true).
        /// </summary>
        /// <param name="exception">The exception to report to Sentry</param>
        /// <param name="message">An optional message to send with the exception to provide more context</param>
        /// <param name="throwOnException">If true, will rethrow any exception which occurs while reporting to Sentry.</param>
        /// <remarks>Note, some previous Sentry reports were adding the message as a fullDetailedMessage tag, but when we refactored
        /// to create this method, we decided to standardize on the more versatile breadcrumbs approach.</remarks>
        public static void ReportSentryOnly(Exception exception, string message = null, bool throwOnException = false)
        {
            if (ApplicationUpdateSupport.IsDev)
            {
                Debug.WriteLine("Developer, we though you might want to know that ReportSentryOnly() was called. Ignore if you like.");
                Debug.Indent();
                Debug.WriteLine(exception);
                Debug.Unindent();
                return;
            }
            try
            {
                if (!string.IsNullOrWhiteSpace(message))
                {
                    SentrySdk.AddBreadcrumb(message);
                }
                SentrySdk.CaptureException(exception);
            }
            catch (Exception err)
            {
                // will only "do something" if we're testing reporting and have thus turned off checking for dev
                Debug.Fail(err.Message);

                if (throwOnException)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 6
0
        private void EnviaNotificacaoParaUe(IEnumerable <PeriodoFechamentoBimestre> fechamentosBimestre, long UeId)
        {
            try
            {
                var ue = repositorioUe.ObterPorId(UeId);
                if (ue != null)
                {
                    var nomeUe = $"{ue.TipoEscola.ShortName()} {ue.Nome}";

                    Notificacao notificacao = MontaNotificacao(nomeUe, "DRE", fechamentosBimestre, ue.CodigoUe, null);
                    var         diretores   = servicoEol.ObterFuncionariosPorCargoUe(ue.CodigoUe, (long)Cargo.Diretor);
                    if (diretores == null || !diretores.Any())
                    {
                        SentrySdk.AddBreadcrumb($"Não foram localizados diretores para Ue {ue.CodigoUe}.");
                    }
                    else
                    {
                        foreach (var diretor in diretores)
                        {
                            var usuario = servicoUsuario.ObterUsuarioPorCodigoRfLoginOuAdiciona(diretor.CodigoRf);
                            notificacao.UsuarioId = usuario.Id;

                            servicoNotificacao.Salvar(notificacao);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }
        }
        public async Task <bool> Executar(MensagemRabbit param)
        {
            try
            {
                var turmasDoEnsinoInfantil = await mediator.Send(new ObterTurmasPorAnoModalidadeQuery(DateTime.Now.Year, Modalidade.Infantil));

                if (!turmasDoEnsinoInfantil?.Any() ?? true)
                {
                    SentrySdk.AddBreadcrumb($"Não foram encontradas turmas para geração de pendências de ausência de registro individual .", $"Rabbit - {nameof(GerarPendenciaAusenciaRegistroIndividualUseCase)}");
                    return(false);
                }

                foreach (var turma in turmasDoEnsinoInfantil)
                {
                    await GerarPendenciaAusenciaRegistroIndividualTurmaAsync(turma);
                }

                return(true);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
                return(false);
            }
        }
Ejemplo n.º 8
0
        public static bool Uninstall(ProgressBar progressBar, Label statusLabel)
        {
            SentrySdk.AddBreadcrumb($"{nameof(Uninstall)}", nameof(DNSCryptHelper));

            progressBar.Minimum = 0;
            progressBar.Maximum = 1;
            progressBar.Value   = 0;
            progressBar.Style   = ProgressBarStyle.Marquee;
            statusLabel.Text    = "Deleting DNSCrypt files...";

            try
            {
                Directory.Delete(UnzipDirectory, true);
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);

                statusLabel.Text = $"[!] Error message: {ex.Message}";
                return(false);
            }

            progressBar.Value = 1;
            progressBar.Style = ProgressBarStyle.Continuous;
            statusLabel.Text  = "Uninstallation successful.";
            return(true);
        }
Ejemplo n.º 9
0
        public static async Task StartService(ProgressBar progressBar, Label statusLabel)
        {
            SentrySdk.AddBreadcrumb($"{nameof(StartService)}", nameof(DNSCryptHelper));

            progressBar.Minimum = 0;
            progressBar.Maximum = 1;
            progressBar.Value   = 0;
            progressBar.Style   = ProgressBarStyle.Marquee;
            statusLabel.Text    = "Installing DNSCrypt service...";

            await Task.Run(() =>
            {
                ExecuteProcessHidden(BinaryPath, "-service install");
            });

            statusLabel.Text = "Starting DNSCrypt service...";

            await Task.Run(() =>
            {
                ExecuteProcessHidden(BinaryPath, "-service start");
            });

            var counter = 1;

            while (!IsRunning())
            {
                statusLabel.Text = $"Starting DNSCrypt service ({counter++} s)...";
                await Task.Delay(TimeSpan.FromSeconds(1));
            }

            progressBar.Value = 1;
            progressBar.Style = ProgressBarStyle.Continuous;
            statusLabel.Text  = "Service start successful.";
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Changes the state of the AI State Machine.
        /// Intended to be PROTECTED - only the AI States should be able to call this from their encapsulated transition methods.
        /// Changes the internal state of the AI State Machine based on the given state type Enum.
        /// </summary>
        /// <param name="stateType">The new state type to be changed to.</param>
        /// <param name="optionalData">Optional data to be passed to the transitioning state.</param>
        public void ChangeState(StateEnum stateType, object optionalData = null)
        {
            if (currentState != null)
            {
                // Only time when the current state will be null is when state machine spawns.
                currentState.Exit();
                currentState.enabled = false;
            }

            try
            {
                switch (stateType)
                {
                case StateEnum.Intermission: currentState = GetComponent <AIIntermissionState>(); break;

                case StateEnum.Race: currentState = GetComponent <AIRaceState>(); break;

                case StateEnum.ClientSpectate: currentState = GetComponent <AISpectateState>(); break;

                default: throw new InvalidOperationException("Invalid AI ChangeState attempt: " + stateType.ToString());
                }
                SentrySdk.AddBreadcrumb($"AI State Machine change state from { StateType } to { stateType }.");
                StateType = stateType;
            }
            catch (InvalidOperationException e)
            {
                Debug.LogError(e);
            }

            currentState.enabled = true;
            currentState.Enter(optionalData);
        }
        public async Task Executar(FiltroRelatorioDto filtroRelatorioDto)
        {
            SentrySdk.AddBreadcrumb($"Obtendo dados do relatório", "8 - MonitorarStatusRelatorioUseCase");

            var dadosRelatorio = filtroRelatorioDto.ObterObjetoFiltro <DadosRelatorioDto>();

            var detalhesRelatorio = await mediator.Send(new ObterDetalhesRelatorioQuery(dadosRelatorio.RequisicaoId, dadosRelatorio.JSessionId));

            SentrySdk.AddBreadcrumb($"dados do relatório OK", "8 - MonitorarStatusRelatorioUseCase");


            if (detalhesRelatorio != null && detalhesRelatorio.Pronto)
            {
                SentrySdk.AddBreadcrumb($"Indo publicar na fila Prontos..", "8 - MonitorarStatusRelatorioUseCase");

                //TODO: Aplicar Polly ??
                if (await mediator.Send(new SalvarRelatorioJasperLocalCommand(dadosRelatorio.JSessionId, dadosRelatorio.RequisicaoId, dadosRelatorio.ExportacaoId, dadosRelatorio.CodigoCorrelacao)))
                {
                    servicoFila.PublicaFila(new PublicaFilaDto(dadosRelatorio, RotasRabbit.RotaRelatoriosProntosSgp, RotasRabbit.ExchangeSgp, filtroRelatorioDto.CodigoCorrelacao));
                    SentrySdk.CaptureMessage("8 - MonitorarStatusRelatorioUseCase - Publicado na fila PRONTO OK!");
                }
                else
                {
                    PublicarNovamenteNaFila(filtroRelatorioDto, dadosRelatorio);
                }
            }
            else
            {
                PublicarNovamenteNaFila(filtroRelatorioDto, dadosRelatorio);
            }
        }
Ejemplo n.º 12
0
        public SKColor ToSKColor()
        {
            CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            ci.NumberFormat.NumberDecimalSeparator = ".";


            try
            {
                var colorArr = color.Trim('[', ']').Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci))
                               .ToList();

                if (colorArr.Count != 4)
                {
                    SentrySdk.CaptureException(new System.ArgumentOutOfRangeException($"Marker color {color} doesn't have 4 elements!"));
                    return(SKColors.Black);
                }

                return(new SKColor((byte)(colorArr[0] * 255), (byte)(colorArr[1] * 255), (byte)(colorArr[2] * 255),
                                   (byte)(colorArr[3] * 255)));
            }
            catch (System.FormatException ex)
            {
                SentrySdk.AddBreadcrumb($"color = {color}");
                SentrySdk.CaptureException(ex);
                return(SKColors.Black);
            }
        }
Ejemplo n.º 13
0
        private void configPrivacyButton_Click(object sender, System.EventArgs e)
        {
            SentrySdk.AddBreadcrumb($"{nameof(configPrivacyButton_Click)}", nameof(SettingsForm));

            foreach (var pair in _controls)
            {
                var setting       = (ComboBoxItem)pair.Value.SelectedItem;
                var targetSetting = pair.Key.GetSetting(DNSCryptSettingPreference.Privacy);

                if ((string)setting.Value != targetSetting)
                {
                    foreach (var item in pair.Value.Items)
                    {
                        setting = (ComboBoxItem)item;

                        if ((string)setting.Value == targetSetting)
                        {
                            pair.Value.SelectedItem = item;
                            break;
                        }
                    }
                }
            }

            Utilities.ButtonSuccessAnimation(sender);
        }
Ejemplo n.º 14
0
        public SettingsForm()
        {
            SentrySdk.AddBreadcrumb($"{nameof(SettingsForm)}", nameof(SettingsForm));

            InitializeComponent();
            Text = GlobalVars.Name + " Settings";
            Icon = Resources.Icon;

            Utilities.ApplyThemeToForm(this);

            _controls = new Dictionary <IDNSCryptSetting, ComboBox>
            {
                { new DNSCryptSetting_ipv4_servers(), ipv4_servers },
                { new DNSCryptSetting_ipv6_servers(), ipv6_servers },
                { new DNSCryptSetting_dnscrypt_servers(), dnscrypt_servers },
                { new DNSCryptSetting_doh_servers(), doh_servers },
                { new DNSCryptSetting_require_dnssec(), require_dnssec },
                { new DNSCryptSetting_require_nolog(), require_nolog },
                { new DNSCryptSetting_require_nofilter(), require_nofilter },
                { new DNSCryptSetting_fallback_resolvers(), fallback_resolvers },
                { new DNSCryptSetting_dnscrypt_ephemeral_keys(), dnscrypt_ephemeral_keys },
                { new DNSCryptSetting_tls_disable_session_tickets(), tls_disable_session_tickets },
                { new DNSCryptSetting_netprobe_timeout(), netprobe_timeout },
                { new DNSCryptSetting_netprobe_address(), netprobe_address },
                { new DNSCryptSetting_block_ipv6(), block_ipv6 },
                { new DNSCryptSetting_reject_ttl(), reject_ttl },
            };

            UpdateControls();
        }
Ejemplo n.º 15
0
        private void FillInterfacesCombo()
        {
            SentrySdk.AddBreadcrumb($"{nameof(FillInterfacesCombo)}", nameof(MainForm));

            interfacesCombo.Items.Clear();

            var selectedItem = (object)null;

            foreach (var @interface in NetshHelper.GetInterfaces())
            {
                var item = new ComboBoxItem(@interface.ToString(), @interface);
                interfacesCombo.Items.Add(item);

                if (@interface.ToString() == Settings.Default.SelectedInterface)
                {
                    selectedItem = item;
                }
            }

            // some users do not have any interfaces available
            if (interfacesCombo.Items.Count == 0)
            {
                throw new Exception("Failed to fetch network interface list (empty response).");
            }

            if (selectedItem != null)
            {
                interfacesCombo.SelectedItem = selectedItem;
            }
            else
            {
                interfacesCombo.SelectedIndex = 0;
            }
        }
Ejemplo n.º 16
0
        public static async Task StopService(ProgressBar progressBar, Label statusLabel)
        {
            SentrySdk.AddBreadcrumb($"{nameof(StopService)}", nameof(DNSCryptHelper));

            progressBar.Minimum = 0;
            progressBar.Maximum = 1;
            progressBar.Value   = 0;
            progressBar.Style   = ProgressBarStyle.Marquee;
            statusLabel.Text    = "Stopping DNSCrypt service...";

            await Task.Run(() =>
            {
                ExecuteProcessHidden(BinaryPath, "-service stop");
            });

            statusLabel.Text = "Uninstall DNSCrypt service...";

            await Task.Run(() =>
            {
                ExecuteProcessHidden(BinaryPath, "-service uninstall");
            });

            progressBar.Value = 1;
            progressBar.Style = ProgressBarStyle.Continuous;
            statusLabel.Text  = "Service stop successful.";
        }
Ejemplo n.º 17
0
        public bool Log(LogLevel logLevel, Func <string> messageFunc, Exception exception = null)
        {
            if ((messageFunc == null && logLevel <= LogLevel.Warn) || (logLevel >= LogLevel.Error && exception == null))
            {
                return(false);
            }

            switch (logLevel)
            {
            case LogLevel.Error:
            case LogLevel.Fatal:
                if (messageFunc != null)
                {
                    SentrySdk.CaptureException(new Exception(messageFunc(), exception));
                }
                else
                {
                    SentrySdk.CaptureException(exception);
                }
                break;

            case LogLevel.Warn:
                SentrySdk.CaptureMessage(messageFunc(), Sentry.Protocol.SentryLevel.Warning);
                break;

            default:
                SentrySdk.AddBreadcrumb(messageFunc(), $"Hangfire {logLevel.ToString()} event", "Logging");
                break;
            }
            return(true);
        }
Ejemplo n.º 18
0
        public override void OnException(ExceptionContext context)
        {
            using (SentrySdk.Init(sentryDSN))
            {
                var internalIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList?.Where(c => c.AddressFamily == AddressFamily.InterNetwork).ToString();
                SentrySdk.AddBreadcrumb($"{Environment.MachineName ?? string.Empty} - {internalIP ?? string.Empty }", "Machine Identification");

                SentrySdk.CaptureException(context.Exception);
            }

            switch (context.Exception)
            {
            case NegocioException negocioException:
                context.Result = new ResultadoBaseResult(context.Exception.Message, negocioException.StatusCode);
                break;

            case ValidacaoException validacaoException:
                context.Result = new ResultadoBaseResult(new RetornoBaseDto(validacaoException.Erros));
                break;

            default:
                context.Result = new ResultadoBaseResult("Ocorreu um erro interno. Favor contatar o suporte.", 500);
                break;
            }

            base.OnException(context);
        }
Ejemplo n.º 19
0
 void NotifyPlayerFinished(Player player)
 {
     raceSessionData.FinishedPlayers.Add(player);
     player.PosInfo = new Player.PositionInfo(player.PosInfo.startTime, NetworkTime.time);
     player.MarkPlayerCarAsZombie();
     SentrySdk.AddBreadcrumb($"{ player.PlayerName } finished the race.");
 }
Ejemplo n.º 20
0
        public async Task <RetornoBaseDto> Executar(ExcluirAulaDto excluirDto)
        {
            var usuarioLogado = await mediator.Send(new ObterUsuarioLogadoQuery());

            if (excluirDto.RecorrenciaAula == RecorrenciaAula.AulaUnica)
            {
                return(await mediator.Send(new ExcluirAulaUnicaCommand(usuarioLogado,
                                                                       excluirDto.AulaId,
                                                                       excluirDto.ComponenteCurricularNome)));
            }
            else
            {
                try
                {
                    // TODO alterar para fila do RabbitMQ
                    await mediator.Send(new IncluirFilaExclusaoAulaRecorrenteCommand(excluirDto.AulaId,
                                                                                     excluirDto.RecorrenciaAula,
                                                                                     excluirDto.ComponenteCurricularNome,
                                                                                     usuarioLogado));

                    return(new RetornoBaseDto("Serão excluidas aulas recorrentes, em breve você receberá uma notificação com o resultado do processamento."));
                }
                catch (Exception ex)
                {
                    SentrySdk.AddBreadcrumb("Exclusão de aulas recorrentes", "RabbitMQ");
                    SentrySdk.CaptureException(ex);
                }
                return(new RetornoBaseDto("Ocorreu um erro ao solicitar a exclusão de aulas recorrentes, por favor tente novamente."));
            }
        }
        private async Task GerarPendenciaAusenciaRegistroIndividualTurmaAsync(Turma turma)
        {
            if (turma is null)
            {
                return;
            }

            try
            {
                var retorno = await mediator.Send(new GerarPendenciaAusenciaRegistroIndividualTurmaCommand(turma));

                if (retorno is null)
                {
                    SentrySdk.AddBreadcrumb($"Não foi possível gerar a pendência de ausência de registro individual para a turma {turma.Id}.", $"Rabbit - {nameof(GerarPendenciaAusenciaRegistroIndividualUseCase)}");
                    return;
                }

                if (retorno.ExistemErros)
                {
                    var erros = string.Join(", ", retorno.Mensagens);
                    SentrySdk.AddBreadcrumb($"Não foi possível gerar a pendência de ausência de registro individual para a turma {turma.Id}. {erros}", $"Rabbit - {nameof(GerarPendenciaAusenciaRegistroIndividualUseCase)}");
                    return;
                }
            }
            catch (Exception ex)
            {
                SentrySdk.CaptureException(ex);
            }
        }
        public async Task <bool> Executar(MensagemRabbit mensagemRabbit)
        {
            SentrySdk.AddBreadcrumb($"Mensagem InserirAulaRecorrenteUseCase", "Rabbit - InserirAulaRecorrenteUseCase");
            InserirAulaRecorrenteCommand command = mensagemRabbit.ObterObjetoMensagem <InserirAulaRecorrenteCommand>();

            return(await mediator.Send(command));
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Replace any BBCode [Spoiler][/Spoiler] blocks with a content hidden message if your spoiler level settings don't allow major spoilers
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        private static string ReplaceSpoilers(string text)
        {
            try
            {
                List <string> spoilerList = new List <string>();
                string        rawText     = text;

                Regex regex = new Regex(@"\[spoiler\]((?:.|\n)+?)\[\/spoiler\]", RegexOptions.IgnoreCase);
                SentrySdk.AddBreadcrumb($"ReplaceSpoilerText:{text}");
                foreach (Match match in regex.Matches(text))
                {
                    rawText = rawText.Replace(match.Groups[0].ToString(), match.Groups[1].ToString());
                    spoilerList.Add(match.Groups[1].ToString());
                }

                if (App.UserSettings.SettingsVndb.Spoiler < SpoilerLevel.Major)
                {
                    rawText = spoilerList.Aggregate(rawText,
                                                    (current, spoiler) => current.Replace(spoiler, "<Content hidden by spoiler setting>"));
                }

                return(rawText);
            }
            catch (Exception ex)
            {
                App.Logger.Error(ex, "failed to replace spoilers");
                SentryHelper.SendException(ex, null, SentryLevel.Warning);
                throw;
            }
        }
Ejemplo n.º 24
0
        public async Task <bool> Handle(GerarRelatorioAtaFinalHtmlParaPdfCommand request, CancellationToken cancellationToken)
        {
            List <string> paginasEmHtml = new List <string>();

            foreach (var modelPagina in request.Paginas)
            {
                string html = string.Empty;

                html = GerarHtmlRazor(modelPagina, request.NomeTemplate);

                html = html.Replace("logo.png", SmeConstants.LogoSme);

                paginasEmHtml.Add(html);
            }

            //TODO: FILA PARA RELATORIO SEM DADOS?
            if (paginasEmHtml.Any())
            {
                PdfGenerator pdfGenerator = new PdfGenerator(converter);

                var directory = AppDomain.CurrentDomain.BaseDirectory;
                SentrySdk.AddBreadcrumb($"Gerando PDF", $"Caminho geração : {directory}");

                pdfGenerator.ConvertToPdf(paginasEmHtml, directory, request.CodigoCorrelacao.ToString());

                SentrySdk.AddBreadcrumb($"Indo publicar na fila Prontos..", "8 - MonitorarStatusRelatorioUseCase");
                servicoFila.PublicaFila(new PublicaFilaDto(new MensagemRelatorioProntoDto(request.MensagemUsuario, string.Empty), RotasRabbit.RotaRelatoriosProntosSgp, RotasRabbit.ExchangeSgp, request.CodigoCorrelacao));
                SentrySdk.CaptureMessage("8 - MonitorarStatusRelatorioUseCase - Publicado na fila PRONTO OK!");
            }

            return(true);
        }
Ejemplo n.º 25
0
        public void Init_MultipleCalls_ReplacesHubWithLatest()
        {
            var first = SentrySdk.Init(ValidDsnWithSecret);

            SentrySdk.AddBreadcrumb("test", "category");
            var called = false;

            SentrySdk.ConfigureScope(p =>
            {
                called = true;
                Assert.Single(p.Breadcrumbs);
            });
            Assert.True(called);
            called = false;

            var second = SentrySdk.Init(ValidDsnWithSecret);

            SentrySdk.ConfigureScope(p =>
            {
                called = true;
                Assert.Empty(p.Breadcrumbs);
            });
            Assert.True(called);

            first.Dispose();
            second.Dispose();
        }
Ejemplo n.º 26
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                if (value is string typeName)
                {
                    return(GameState.Instance.marker.markerTypes[typeName]);
                }
                if (value is MarkerType type)
                {
                    return(GameState.Instance.marker.markerTypes.First(x => x.Value == type).Key); //#TODO store id in markerType
                }
            } catch (Exception ex) {
                if (value is string typeName)
                {
                    SentrySdk.AddBreadcrumb(typeName);
                }
                if (value is MarkerType type)
                {
                    SentrySdk.AddBreadcrumb(type.name);
                }

                SentrySdk.AddBreadcrumb(GameState.Instance.marker.markerTypes.Select(x => x.Key).Join());
                SentrySdk.CaptureException(ex);
            }


            return(null);
        }
Ejemplo n.º 27
0
        public static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            SentrySdk.Init("https://[email protected]/5380665");

            // backwards compatibility
            if (args.Contains("-validate"))
            {
                return;
            }

            if (!Utilities.IsAdministrator())
            {
                SentrySdk.AddBreadcrumb($"{nameof(Main)}: Application run with user privileges", nameof(Program));
                Utilities.Restart();
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            if (DNSCryptHelper.IsInstalled() && DNSCryptHelper.IsRunning())
            {
                SentrySdk.AddBreadcrumb($"{nameof(Main)}: Add DNSCrypt to DNSServers list", nameof(Program));
                GlobalVars.DNSServers.Insert(0, DNSCryptHelper.GetDNSServer());
            }

            SentrySdk.AddBreadcrumb($"{nameof(Main)}: Application start", nameof(Program));
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Ejemplo n.º 28
0
        private void settingsLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SentrySdk.AddBreadcrumb($"{nameof(settingsLabel_LinkClicked)}", nameof(MainForm));

            var preIsInstalled = DNSCryptHelper.IsInstalled();
            var preIsRunning   = preIsInstalled && DNSCryptHelper.IsRunning();

            SentrySdk.AddBreadcrumb($"{nameof(settingsLabel_LinkClicked)}: {nameof(preIsInstalled)}={preIsInstalled}, {nameof(preIsRunning)}={preIsRunning}", nameof(MainForm));

            new SettingsForm().ShowDialog(this);

            // check installation
            var shouldRestart = preIsInstalled != DNSCryptHelper.IsInstalled();

            // check service
            if (!shouldRestart && preIsInstalled && preIsRunning != DNSCryptHelper.IsRunning())
            {
                shouldRestart = true;
            }

            SentrySdk.AddBreadcrumb($"{nameof(settingsLabel_LinkClicked)}: {nameof(shouldRestart)}={shouldRestart}", nameof(MainForm));

            if (shouldRestart)
            {
                Utilities.Restart();
            }
        }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            SentrySdk.AddBreadcrumb($"[SME SGP] Serviço Background iniciado no ip: {IPLocal}", "Service Life cycle");
            HangfireWorkerService.Registrar();

            return(Task.CompletedTask);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Spawn the police car for a given player.
        /// We will spawn the police car at the finish line, so they can get revenge on the racers.
        /// </summary>
        /// <remarks>
        /// We assume that by default the police car prefab's vehicle controller is set to active, so
        /// the car is immediately driveable after it is spawned (unlike the other cars, which are by default
        /// set to inactive and are activated when transitioning into Server Race State).
        /// </remarks>
        /// <param name="player">The player you wish to spawn the police car for.</param>
        public void SpawnPoliceCarOnFinishingGrid(Player player)
        {
            SentrySdk.AddBreadcrumb("Spawning police car onto track.");

            // Grab the finish line from the last track piece.
            TrackGenerator.SyncListGameObject generatedTrackPiecesInRace = TrackGenerator.Singleton.GeneratedTrackPieces;
            GameObject finishingTrackPiece = generatedTrackPiecesInRace[generatedTrackPiecesInRace.Count - 1];
            Transform  finishLine          = finishingTrackPiece.transform.Find(GameObjectIdentifiers.FinishLine);

            if (finishLine == null)
            {
                throw new MissingComponentException($"Finishing Track Piece must have a GameObject named { GameObjectIdentifiers.FinishLine } which marks the finishing line.");
            }

            // Apply the same rotation from the finishing track piece + flipping 180 degrees to the vectors that were
            // originally used to calculate the position of the car in the starting track piece so we can spawn the
            // police cars in the same position as if we were spawning the race cars on the starting track piece but
            // facing away from the finish line.
            Quaternion spawnRotation = finishingTrackPiece.transform.rotation * Quaternion.Euler(0, 180, 0);

            player.CreateCarForPlayer(
                finishLine.position + spawnRotation * CalculateGridPosition(policeCarsOnFinishingGrid.Count),
                spawnRotation,
                policeCarPrefab,
                CarManager.CarTypeEnum.Police);

            policeCarsOnFinishingGrid.Add(player);
        }