private static async Task SendMetricToZapier(MetricsEntry entry, string channel) { entry.Channel = channel; var uri = "https://hooks.zapier.com/hooks/catch/3191324/oa68u9r/"; var settings = new JsonSerializerSettings { DateFormatString = "ddd MMM dd yyyy" }; var json = JsonConvert.SerializeObject(entry, settings); var zapierResult = await _httpClient.PostAsJsonAsync(uri, json); zapierResult.EnsureSuccessStatusCode(); }
public FileSegment GetMetricFileStream(MemoryMappedFileAccess access) { if (ParentArchive != null) { MemoryMappedFile mmf = GetMemoryMappedFile(access); return(new FileSegment(mmf, MetricsEntry.GetAbsoluteOffset(), MetricsEntry.UncompressedContentSize, access)); } string path = Path.Combine(Options.GameDataDirectoryPath, Name + ".fi"); FileStream stream = new FileStream(path, FileMode.Open, ConvertAccess(access), FileShare.ReadWrite); using (DisposableAction insurance = new DisposableAction(stream.Dispose)) { MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile(stream, null, 0, access, null, HandleInheritability.Inheritable, false); insurance.Cancel(); return(new FileSegment(mmf, 0, stream.Length, access)); } }