public void SetMetadata(string tab, Dictionary <string, string> unityMetadata) { var index = 0; var count = 0; if (unityMetadata != null) { var metadata = new string[unityMetadata.Count * 2]; foreach (var data in unityMetadata) { if (data.Key != null) { metadata[index] = data.Key; metadata[index + 1] = data.Value; count += 2; } index += 2; } NativeCode.bugsnag_setMetadata(NativeConfiguration, tab, metadata, count); } else { NativeCode.bugsnag_removeMetadata(NativeConfiguration, tab); } }
internal Configuration(string apiKey, bool autoNotify) : base() { NativeConfiguration = NativeCode.bugsnag_createConfiguration(apiKey); SetupDefaults(apiKey); NativeCode.bugsnag_setAutoNotify(NativeConfiguration, autoNotify); _autoNotify = autoNotify; }
public void PopulateUser(User user) { var nativeUser = new NativeUser(); NativeCode.bugsnag_populateUser(ref nativeUser); user.Id = Marshal.PtrToStringAuto(nativeUser.Id); }
NativeClient(IConfiguration configuration, IntPtr nativeConfiguration, IBreadcrumbs breadcrumbs) { Configuration = configuration; NativeConfiguration = nativeConfiguration; NativeCode.bugsnag_startBugsnagWithConfiguration(NativeConfiguration, NotifierInfo.NotifierVersion); Delivery = new Delivery(); Breadcrumbs = breadcrumbs; }
public void PopulateDevice(Device device) { var handle = GCHandle.Alloc(device); try { NativeCode.bugsnag_retrieveDeviceData(GCHandle.ToIntPtr(handle), PopulateDeviceData); } finally { handle.Free(); } }
public void SetSession(Session session) { if (session == null) { // Clear session NativeCode.bugsnag_registerSession(null, 0, 0, 0); } else { // The ancient version of the runtime used doesn't have an equivalent to GetUnixTime() var startedAt = Convert.ToInt64((session.StartedAt.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds); NativeCode.bugsnag_registerSession(session.Id.ToString(), startedAt, session.UnhandledCount(), session.HandledCount()); } }
public void SetMetadata(string tab, Dictionary <string, string> unityMetadata) { var index = 0; var metadata = new string[unityMetadata.Count * 2]; foreach (var data in unityMetadata) { metadata[index] = data.Key; metadata[index + 1] = data.Value; index += 2; } NativeCode.bugsnag_setMetadata(NativeConfiguration, tab, metadata, metadata.Length); }
public void PopulateApp(App app) { GCHandle handle = GCHandle.Alloc(app); try { NativeCode.bugsnag_retrieveAppData(GCHandle.ToIntPtr(handle), PopulateAppData); } finally { if (handle != null) { handle.Free(); } } }
public Breadcrumb[] Retrieve() { var breadcrumbs = new List <Breadcrumb>(); var handle = GCHandle.Alloc(breadcrumbs); try { NativeCode.bugsnag_retrieveBreadcrumbs(NativeBreadcrumbs, GCHandle.ToIntPtr(handle), PopulateBreadcrumb); } finally { handle.Free(); } return(breadcrumbs.ToArray()); }
public void Leave(Breadcrumb breadcrumb) { if (breadcrumb != null) { if (breadcrumb.Metadata != null) { var index = 0; var metadata = new string[breadcrumb.Metadata.Count * 2]; foreach (var data in breadcrumb.Metadata) { metadata[index] = data.Key; metadata[index + 1] = data.Value; index += 2; } NativeCode.bugsnag_addBreadcrumb(NativeBreadcrumbs, breadcrumb.Name, breadcrumb.Type, metadata, metadata.Length); } else { NativeCode.bugsnag_addBreadcrumb(NativeBreadcrumbs, breadcrumb.Name, breadcrumb.Type, null, 0); } } }
public void SetUser(User user) { NativeCode.bugsnag_setUser(user.Id, user.Name, user.Email); }
internal Configuration(string apiKey) : base() { NativeConfiguration = NativeCode.bugsnag_createConfiguration(apiKey); SetupDefaults(apiKey); }
Breadcrumbs(IntPtr nativeConfiguration) { NativeBreadcrumbs = NativeCode.bugsnag_createBreadcrumbs(nativeConfiguration); }