public static SentryClient CreateClient( IServiceProvider serviceProvider) { var options = GetOptions(serviceProvider); return(Sentry.CreateClient(GetDsn(options))); }
public static SentryClient CreateClient(IServiceProvider serviceProvider) { var optionsAccessor = serviceProvider .GetRequiredService <IOptions <SentryOptions> >(); return(Sentry.CreateClient(GetDsn(optionsAccessor.Value))); }
private static bool ReadIconPos(Stream stream) { try { using (var reader = new StreamReader(stream, Encoding.UTF8, true, 4096, true)) { using (var csv = new CsvReader(reader)) { csv.Configuration.HasHeaderRecord = true; csv.Configuration.RegisterClassMap(typeof(PosRecord.Map)); foreach (var r in csv.GetRecords <PosRecord>()) { IconPosition.Add(r.StatusId, new Int32Rect(r.X, r.Y, 24, 32)); IconPosition2x.Add(r.StatusId, new Int32Rect(r.X * 2, r.Y * 2, 24 * 2, 32 * 2)); } } } return(true); } catch (Exception ex) { Sentry.Error(ex); return(false); } }
private static ResourceResult DownloadResource() { try { using (var wc = new WebClientEx()) { wc.DownloadProgressChanged += (ls, le) => DownloadProgressChanged?.Invoke(le.ProgressPercentage); wc.DownloadFileAsync(new Uri(ResourceUrl), ResourcePath); while (wc.IsBusy) { Thread.Sleep(100); } } return(ResourceResult.Success); } catch (WebException ex) { Sentry.Error(ex); return(ResourceResult.NetworkError); } catch (Exception ex) { Sentry.Error(ex); return(ResourceResult.UnknownError); } }
private void StartWorker(object oKey) { var key = (string)oKey; string message = null; try { this.m_telegram = new TelegramBotClient(key); this.m_telegram.OnMessage += Telegram_OnMessage; this.m_telegram.OnMessageEdited += Telegram_OnMessage; this.m_telegram.OnReceiveError += m_telegram_OnReceiveError; this.m_telegram.OnReceiveGeneralError += m_telegram_OnReceiveGeneralError; if (this.m_telegram.TestApiAsync().Result) { this.BotName = this.m_telegram.GetMeAsync().Result.Username; Sentry.Info(null, "Started telegram ({0})", this.BotName); this.m_telegram.StartReceiving(); this.m_telegramConnected = true; } } catch (Exception ex) { message = ex.Message; } if (this.OnTelegramConnected != null) { this.OnTelegramConnected(message); } }
/// <summary> /// Setup all the references the core is going to need to do it's job. /// </summary> private void LinkToEntityCore() { if (thisType == EntityType.Player) { player = this.gameObject.GetComponent <Player>(); } else if (thisType == EntityType.Sentry) { sentry = this.gameObject.GetComponent <Sentry>(); } else if (thisType == EntityType.Proxy) { proxy = this.gameObject.GetComponent <Machine>().machineAsProxy; } else if (thisType == EntityType.Machine) { machine = this.gameObject.GetComponent <Machine>(); } else if (thisType == EntityType.MachineSentry) { machineSentry = this.gameObject.GetComponent <Sentry>().machineSentry; } else if (thisType == EntityType.Tile) { tile = this.gameObject.GetComponent <Tile>(); } else if (thisType == EntityType.Pawn) { pawn = this.gameObject.GetComponent <Pawn>(); } }
private void LoadGridState() { string filterPath = null; try { var filters = Directory.EnumerateFiles(_settingsPath).Select(p => Path.GetFileName(p)).ToArray(); var dialog = new SelectFilterDialog(filters); if (dialog.ShowDialog() == false) { return; } var manager = new PersistenceManager(); manager.AllowCrossVersion = true; filterPath = Path.Combine(_settingsPath, dialog.FilterName); using (var stream = File.OpenRead(filterPath)) { manager.Load(Grid as RadGridView, stream); } } catch (Exception e) { Sentry.CaptureException(e); MessageBox.Show("Failed to load filter!", "Jira Assistant", MessageBoxButton.OK, MessageBoxImage.Error); _logger.Error(e, "Error while loading Issue Browser filter from: " + filterPath); } }
public static bool SetProcess(Process process) { if (ffxivProcess != null) { ffxivProcess.Dispose(); ffxivProcess = null; } try { ffxivProcess = process; ffxivProcess.EnableRaisingEvents = true; ffxivModulePtr = ffxivProcess.MainModule.BaseAddress; ffxivHandle = NativeMethods.OpenProcess(NativeMethods.ProcessAccessFlags.All, false, ffxivProcess.Id); if (NativeMethods.IsX86Process(ffxivHandle)) { return(false); } GameWindowHandle = process.MainWindowHandle; running = true; taskWorker = Task.Factory.StartNew(WorkerThread); } catch (Exception ex) { Sentry.Error(ex); return(false); } return(true); }
public async Task SendException_ReturnsEventId() { var dsn = "<YOUR DSN HERE>"; var client = Sentry.CreateClient(Dsn.Create(dsn)); var value = 0; try { var x = 10 / value; } catch (Exception ex) { var response = await client.CaptureAsync(e => e .SetException(ex) .SetErrorLevel(ErrorLevel.Warning) .AddExtraData("test", new { IsTest = true }) .AddTag("test_tag", "yes")); Assert.NotNull(response.EventId); } }
/// <summary> /// Initializes a new instance of the <see cref="Resources"/> class. /// </summary> internal static void Initialize() { Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources)); Resources.Sentry = new Sentry(Constants.SentryAPI, Constants.SentryID, Constants.UseSentry); #if DEBUG Console.WriteLine("Loaded " + Factory.Messages.Count + " messages, " + Factory.Commands.Count + " commands, and " + Factory.Debugs.Count + " debug commands."); #endif Resources.Redis = new Redis(); Resources.Parser = new Parser(); Resources.Fingerprint = new Fingerprint(); Resources.CSV = new CSV(); Resources.Home = new Home(); Resources.Npc = new NPC(); Resources.Helpers = new Helpers(); Resources.Checker = new Timers(); Resources.Players = new Players(); Resources.Clans = new Clans(); Resources.Battles = new Battles(); Resources.Chats = new WorldChats(); Resources.Random = new XorShift(); Resources.Cluster = new Cluster(); Resources.Test = new Test(); Resources.Gateway = new TCPServer(); Resources.UGateway = new UDPServer(); Resources.Events = new EventsHandler(); Resources.Started = true; }
private void MetroWindow_Closed(object sender, System.EventArgs e) { Sentry.RemoveHandler(this.Dispatcher); Worker.Unload(); App.Current.Shutdown(); }
private void CrashDialog_Closed(object sender, EventArgs e) { if (Config.Instance.GoogleAnalytics || _hasClickedSend) { Sentry.CaptureException(_exception); } }
void Awake() { sentryRef = GetComponentInParent <Sentry> (); transform.rotation = sentryRef.muzzleTransform.rotation; GetComponent <Rigidbody>().velocity = transform.forward * initialVelocity; Destroy(gameObject, lifeTime); }
public ActionResult SenFav(FavSentry myobj) { string email = myobj.Person.email; Person myperson = dbContext.People .Where(c => c.email == email) .FirstOrDefault(); string id = myobj.SentryObj.id; Sentry mysentry = dbContext.SentryEntries .Where(c => c.id == id) .FirstOrDefault(); if (myperson == null) { TempData["message"] = "You do not have an account. You need to Sign up first"; return(RedirectToAction("Details/" + mysentry.num)); } FavSentry myfav = new FavSentry(); myfav.SentryObj = mysentry; myfav.Person = myperson; myfav.FavSentryID = myfav.Person.personID + myfav.SentryObj.id; //set key dbContext.FavSentries.Add(myfav); dbContext.SaveChanges(); ModelState.Clear(); TempData["message"] = "You successfully favorited this object!"; return(RedirectToAction("Details/" + mysentry.num)); }
private async void Login(PasswordBox passwordBox) { try { LoginErrorMessage = string.Empty; BusyMessage = "Trying to log into JIRA..."; IsBusy = true; await _jiraApi.Session.AttemptLogin(JiraAddress, Username, passwordBox.Password); _messenger.Send(new OpenAgileBoardPickupMessage()); } catch (ServerNotFoundException) { LoginErrorMessage = "Server did not respond. Please check address and/or connection."; } catch (LoginFailedException e) { LoginErrorMessage = e.Message; } catch (Exception e) { Sentry.CaptureException(e); LoginErrorMessage = "Failed to log in due to technical issues."; } finally { passwordBox.Password = string.Empty; IsBusy = false; } }
public void Stop() { this.m_telegramConnected = false; this.m_telegram.StopReceiving(); this.m_telegram = null; Sentry.Info(null, "Stop telegram ({0})", this.BotName); }
private static string GetStr(byte[] rawData, int index, int endIndex, out bool hasTag) { hasTag = false; int nextIndex; byte[] bytes; int completionId; using (var mem = new MemoryStream(rawData.Length)) { byte v; while (index < endIndex) { v = rawData[index++]; if (v == 2 && index < endIndex) { v = rawData[index]; nextIndex = index + rawData[index + 1] + 2; if (v == 0x2E || v == 0x27 || v == 0x13) { hasTag = true; if (v == 0x2E) { v = rawData[index + 2]; if (v != 0xC9) { try { completionId = GetValue(rawData, index + 3); bytes = FFData.Completion.Table[v][completionId]; } catch (Exception ex) { bytes = UnknownCommand; Sentry.Error(ex, rawData); } mem.Write(bytes, 0, bytes.Length); } } index = nextIndex; continue; } } mem.WriteByte(v); } return(mem.Length > 0 ? Encoding.UTF8.GetString(mem.ToArray()) : null); } }
private void ButtonSend_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(TextBoxDescription.Text)) { _exception.Data.Add("description", TextBoxDescription.Text); } Sentry.CaptureException(_exception); Close(); }
public LogInjectorService(IServiceScopeFactory serviceScopeFactory) { SqlServer = new SQLServer(Helper.ConfigurationDto.Config.SqlServer.Active, serviceScopeFactory); var file = new File(Helper.ConfigurationDto.Config.File.Active); var sentry = new Sentry(Helper.ConfigurationDto.Config.Sentry.Active); SqlServer.SetNext(file); file.SetNext(sentry); }
private FatalError(Exception e) { Sentry.Log(e); InitializeComponent(); ex = e; ShowingInfo = true; TopMost = true; TopLevel = true; }
public void StartTheExplorerWhenInitializingThePlugin() { Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn)); Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn(""); Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(true); Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true); PlugIn plugin = new PlugIn(); Approvals.Approve(pluginSentry.Report); }
private static ResourceResult CheckResource() { var fileInfo = new FileInfo(ResourcePath); if (!fileInfo.Exists) { return(ResourceResult.NeedToDownload); } try { using (var wc = new WebClientEx()) { // 파일 사이즈 비교 wc.Method = "HEAD"; wc.DownloadData(ResourceUrl); if (fileInfo.Length != wc.ContentLength) { return(ResourceResult.NeedToDownload); } if (fileInfo.Exists) { // 파일 해싱 비교 string hashCurrent, hashRemote; using (var md5 = MD5.Create()) using (var file = File.OpenRead(ResourcePath)) hashCurrent = BitConverter.ToString(md5.ComputeHash(file)).Replace("-", "").ToLower(); wc.Method = null; hashRemote = wc.DownloadString(ResourceHash).ToLower(); if (!string.IsNullOrWhiteSpace(hashRemote) && hashRemote.StartsWith(hashCurrent)) { return(ResourceResult.Success); } } } } catch (WebException ex) { Sentry.Error(ex); return(ResourceResult.NetworkError); } catch (Exception ex) { Sentry.Error(ex); return(ResourceResult.UnknownError); } return(ResourceResult.NeedToDownload); }
/// <summary> /// Shows the form and ends the program after an exception makes it to the top level. /// </summary> /// <param name="e">The unhandled exception.</param> private static void HandleUnhandledException(Exception e) { Logger.Exception("Fatal Error: ", e); Sentry.Log(e); using (FatalErrorDialog dialog = new FatalErrorDialog(e)) { dialog.ShowDialog(); } Application.Exit(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Sentry.AddHandler(this.Dispatcher); WpfScreen screen = WpfScreen.FromWindow(this); if (!screen.WorkingArea.IntersectsWith(new Rect(this.Left, this.Top, this.Width, this.Height))) { this.Left = screen.WorkingArea.Left + 200; this.Top = screen.WorkingArea.Top + 200; } }
public void HideOverlayWhenTextHasChanged() { Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn)); Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(false); PlugIn plugin = new PlugIn(); plugin.WhenTextChanges(null); Approvals.Approve(pluginSentry.Report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSentryWithOnPartReferencesSentry() public virtual void testSentryWithOnPartReferencesSentry() { // given Sentry exitSentry = createElement(casePlanModel, "anotherSentry", typeof(Sentry)); IfPart ifPart = createElement(exitSentry, "IfPart_1", typeof(IfPart)); ConditionExpression conditionExpression = createElement(ifPart, "con_1", typeof(ConditionExpression)); Body body = createElement(conditionExpression, null, typeof(Body)); body.TextContent = "${test}"; onPart.Sentry = exitSentry; CmmnActivity casePlanModelActivity = (new CasePlanModelHandler()).handleElement(casePlanModel, context); context.Parent = casePlanModelActivity; CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context); CmmnSentryDeclaration exitSentryDeclaration = sentryHandler.handleElement(exitSentry, context); CmmnActivity source = taskItemHandler.handleElement(planItem, context); // when sentryHandler.initializeOnParts(sentry, context); // then assertNotNull(sentryDeclaration); IList <CmmnOnPartDeclaration> onParts = sentryDeclaration.OnParts; assertNotNull(onParts); assertFalse(onParts.Count == 0); assertEquals(1, onParts.Count); IList <CmmnOnPartDeclaration> onPartsAssociatedWithSource = sentryDeclaration.getOnParts(source.Id); assertNotNull(onPartsAssociatedWithSource); assertFalse(onPartsAssociatedWithSource.Count == 0); assertEquals(1, onParts.Count); CmmnOnPartDeclaration onPartDeclaration = onPartsAssociatedWithSource[0]; assertNotNull(onPartDeclaration); // source assertEquals(source, onPartDeclaration.Source); assertEquals(onPart.Source.Id, onPartDeclaration.Source.Id); // standardEvent assertEquals(onPart.StandardEvent.name(), onPartDeclaration.StandardEvent); // sentry assertNotNull(onPartDeclaration.Sentry); assertEquals(exitSentryDeclaration, onPartDeclaration.Sentry); assertNull(sentryDeclaration.IfPart); }
public void UpdateOverlayWhenPaintingBackground() { Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn)); Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn(""); Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(true); Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true); PlugIn plugin = new PlugIn(); plugin.WhenPaintingBackground(null); Approvals.Approve(pluginSentry.Report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMultipleEntryCriteria() public virtual void testMultipleEntryCriteria() { // given // create first sentry containing ifPart Sentry sentry1 = createElement(casePlanModel, "Sentry_1", typeof(Sentry)); IfPart ifPart1 = createElement(sentry1, "abc", typeof(IfPart)); ConditionExpression conditionExpression1 = createElement(ifPart1, "def", typeof(ConditionExpression)); Body body1 = createElement(conditionExpression1, null, typeof(Body)); body1.TextContent = "${test}"; // set first entryCriteria EntryCriterion criterion1 = createElement(planItem, typeof(EntryCriterion)); criterion1.Sentry = sentry1; // create first sentry containing ifPart Sentry sentry2 = createElement(casePlanModel, "Sentry_2", typeof(Sentry)); IfPart ifPart2 = createElement(sentry2, "ghi", typeof(IfPart)); ConditionExpression conditionExpression2 = createElement(ifPart2, "jkl", typeof(ConditionExpression)); Body body2 = createElement(conditionExpression2, null, typeof(Body)); body2.TextContent = "${test}"; // set second entryCriteria EntryCriterion criterion2 = createElement(planItem, typeof(EntryCriterion)); criterion2.Sentry = sentry2; // transform casePlanModel as parent CmmnActivity parent = (new CasePlanModelHandler()).handleElement(casePlanModel, context); context.Parent = parent; // transform Sentry CmmnSentryDeclaration firstSentryDeclaration = (new SentryHandler()).handleElement(sentry1, context); CmmnSentryDeclaration secondSentryDeclaration = (new SentryHandler()).handleElement(sentry2, context); // when CmmnActivity newActivity = handler.handleElement(planItem, context); // then assertTrue(newActivity.ExitCriteria.Count == 0); assertFalse(newActivity.EntryCriteria.Count == 0); assertEquals(2, newActivity.EntryCriteria.Count); assertTrue(newActivity.EntryCriteria.Contains(firstSentryDeclaration)); assertTrue(newActivity.EntryCriteria.Contains(secondSentryDeclaration)); }
public void StartTheServiceWhenASolutionIsOpen() { Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn)); Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(false); Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true); Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn(""); PlugIn plugin = new PlugIn(); plugin.AfterOpeningSolution(); Approvals.Approve(pluginSentry.Report); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void setUp() { task = createElement(casePlanModel, "aTask", typeof(Task)); planItem = createElement(casePlanModel, "PI_aTask", typeof(PlanItem)); planItem.Definition = task; sentry = createElement(casePlanModel, "aSentry", typeof(Sentry)); onPart = createElement(sentry, "anOnPart", typeof(PlanItemOnPart)); onPart.Source = planItem; createElement(onPart, null, typeof(PlanItemTransitionStandardEvent)); onPart.StandardEvent = PlanItemTransition.complete; }