This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This sample project illustrates how to capture crashes (unhandled exceptions) in native Windows applications using BugSplat. | |
// | |
// The shared sample database 'Fred' is used in this example. | |
// You may view crashes for the Fred account by logging in at https://www.bugsplat.com: | |
// Account (Email Address): Fred@bugsplat.com | |
// Password: *** | |
// | |
// In order to assure that crashes sent to the BugSplat website yield exception stack traces with file/line # information, | |
// just rebuild this project. A Visual Studio post build event is configured to send the resulting .exe and .pdb files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup Label="ProjectConfigurations"> | |
<ProjectConfiguration Include="Debug|Win32"> | |
<Configuration>Debug</Configuration> | |
<Platform>Win32</Platform> | |
</ProjectConfiguration> | |
<ProjectConfiguration Include="Release|Win32"> | |
<Configuration>Release</Configuration> | |
<Platform>Win32</Platform> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient, HttpEvent, HttpEventType, HttpResponse, HttpUploadProgressEvent } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { NgxFileDropEntry } from '@bugsplat/ngx-file-drop'; | |
import { bindCallback, catchError, filter, from, map, mergeMap, Observable, of, scan, switchMap, takeWhile } from 'rxjs'; | |
import { AlertService } from 'src/app/alert/alert.service'; | |
import { environment } from 'src/environments/environment'; | |
import { v4 as uuid } from 'uuid'; | |
import { FileUploadProgress } from './file-upload-progress'; | |
import { UploadedFile } from './uploaded-file'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Mock<HttpMessageHandler> CreateMockHttpClientForAuthenticateSuccess(string xsrfToken = "abc123") | |
{ | |
var response = new HttpResponseMessage(); | |
response.Content = new StringContent(""); | |
response.StatusCode = HttpStatusCode.OK; | |
response.Headers.Add("Set-Cookie", $"xsrf-token:{xsrfToken}; some-other-cookie:xyz321"); | |
var handlerMock = new Mock<HttpMessageHandler>(MockBehavior.Strict); | |
handlerMock | |
.Protected() | |
.Setup<Task<HttpResponseMessage>>( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mockMessageHandler = CreateMockedHttpMessageHandler(response); | |
mockMessageHandler.Protected().Verify( | |
"SendAsync", | |
Times.Exactly(1), | |
ItExpr.Is<HttpRequestMessage>(req => | |
req.Method == HttpMethod.Post && req.RequestUri == expectedUri | |
), | |
ItExpr.IsAny<CancellationToken>() | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createAdditionalFile(): File { | |
const base64data = | |
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAADAFBMVEUAAACSbQD/AAD/tgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private MockHttpMessageHandler CreateMockedHttpClient(string expectedUri, string xsrfToken, string responseContent = "") | |
{ | |
var headers = new List<KeyValuePair<string, string>>() { | |
new KeyValuePair<string, string>( | |
"Set-Cookie", | |
"xsrf-token:abc123; some-other-cookie:xyz321" | |
) | |
}; | |
var mockHttp = new MockHttpMessageHandler(); | |
mockHttp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="d-flex justify-content-between"> | |
<h1>Files</h1> | |
</section> | |
<hr class="my-2"> | |
<section> | |
<table class="table"> | |
<tbody> | |
<tr *ngFor="let file of files"> | |
<td> | |
<a [href]="file.url">{{file.name}}</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input } from '@angular/core'; | |
import { FilesTableEntry } from './files-table-entry'; | |
@Component({ | |
selector: 'app-files', | |
templateUrl: './files.component.html', | |
styleUrls: ['./files.component.scss'] | |
}) | |
export class FilesComponent { | |
@Input() files: FilesTableEntry[] | null = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from '@angular/common/http'; | |
import { Component, OnInit } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { FilesTableEntry } from './files/files-table-entry'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) |