Пример #1
0
        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);
            }
        }
Пример #2
0
 internal Configuration(string apiKey, bool autoNotify) : base()
 {
     NativeConfiguration = NativeCode.bugsnag_createConfiguration(apiKey);
     SetupDefaults(apiKey);
     NativeCode.bugsnag_setAutoNotify(NativeConfiguration, autoNotify);
     _autoNotify = autoNotify;
 }
Пример #3
0
        public void PopulateUser(User user)
        {
            var nativeUser = new NativeUser();

            NativeCode.bugsnag_populateUser(ref nativeUser);

            user.Id = Marshal.PtrToStringAuto(nativeUser.Id);
        }
Пример #4
0
        NativeClient(IConfiguration configuration, IntPtr nativeConfiguration, IBreadcrumbs breadcrumbs)
        {
            Configuration       = configuration;
            NativeConfiguration = nativeConfiguration;

            NativeCode.bugsnag_startBugsnagWithConfiguration(NativeConfiguration, NotifierInfo.NotifierVersion);

            Delivery    = new Delivery();
            Breadcrumbs = breadcrumbs;
        }
Пример #5
0
        public void PopulateDevice(Device device)
        {
            var handle = GCHandle.Alloc(device);

            try
            {
                NativeCode.bugsnag_retrieveDeviceData(GCHandle.ToIntPtr(handle), PopulateDeviceData);
            }
            finally
            {
                handle.Free();
            }
        }
Пример #6
0
 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);
        }
Пример #8
0
        public void PopulateApp(App app)
        {
            GCHandle handle = GCHandle.Alloc(app);

            try
            {
                NativeCode.bugsnag_retrieveAppData(GCHandle.ToIntPtr(handle), PopulateAppData);
            }
            finally
            {
                if (handle != null)
                {
                    handle.Free();
                }
            }
        }
Пример #9
0
        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());
        }
Пример #10
0
        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);
                }
            }
        }
Пример #11
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);
 }
Пример #13
0
 Breadcrumbs(IntPtr nativeConfiguration)
 {
     NativeBreadcrumbs = NativeCode.bugsnag_createBreadcrumbs(nativeConfiguration);
 }