コード例 #1
0
ファイル: MetaData.cs プロジェクト: gerasimov-a/Bugsnager.Net
 /// <summary>
 /// Adds an existing metadata
 /// </summary>
 /// <param name="data">The metadata to add</param>
 public void AddMetadata(Metadata data)
 {
     Merge(this, data);
 }
コード例 #2
0
ファイル: MetaData.cs プロジェクト: gerasimov-a/Bugsnager.Net
        /// <summary>
        /// Merge two metadata objects into one. The first metadata object will be returned
        /// with the other metadata's data merged into it.
        /// </summary>
        /// <param name="currentData">The first (base) metadata object to merge</param>
        /// <param name="dataToAdd">The second metadata object to merge</param>
        /// <returns>The merged metadata</returns>
        private static Metadata Merge(Metadata currentData, Metadata dataToAdd)
        {
            if (dataToAdd == null || dataToAdd.MetadataStore.Count == 0)
                return currentData;

            var currStore = currentData.MetadataStore;
            var storeToAdd = dataToAdd.MetadataStore;

            // Loop through all the tabs that are in the data to add...
            foreach (var newTab in storeToAdd)
            {
                // If the tab doesn't exist in current data, add a blank tab
                if (!currStore.ContainsKey(newTab.Key))
                    currStore.Add(newTab.Key, new Dictionary<string, object>());

                var currTab = currStore[newTab.Key];

                foreach (var newTabEntry in newTab.Value)
                {
                    // Only add the entry if its a new tab entry, otherwise overwrite the existing entry
                    if (!currTab.ContainsKey(newTabEntry.Key))
                        currTab.Add(newTabEntry.Key, newTabEntry.Value);
                    else
                        currTab[newTabEntry.Key] = newTabEntry.Value;
                }
            }
            return currentData;
        }
コード例 #3
0
        /// <summary>
        /// Finalises the event info by adding final metadata 
        /// </summary>
        /// <param name="eventInfo">The event info to finalise</param>
        /// <param name="error">The responsible event</param>
        /// <param name="lastException">The root exception of the event info</param>
        private void FinaliseEventInfo(EventInfo eventInfo, Event error, Exception lastException)
        {
            var expMetaData = new Metadata();

            expMetaData.AddToTab(ExpDetailsTabName, "runtimeEnding", error.IsRuntimeEnding);

            if (lastException.HelpLink != null)
                expMetaData.AddToTab(ExpDetailsTabName, "helpLink", lastException.HelpLink);

            if (lastException.Source != null)
                expMetaData.AddToTab(ExpDetailsTabName, "source", lastException.Source);

            var metaData = Metadata.CombineMetadata(Config.Metadata, error.Metadata, expMetaData);
            metaData.FilterEntries(Config.IsEntryFiltered);
            eventInfo.Metadata = metaData.MetadataStore;
        }
コード例 #4
0
ファイル: Event.cs プロジェクト: gerasimov-a/Bugsnager.Net
 /// <summary>
 /// Initializes a new event instance, ensures the right number of initial call stack frames are ignored
 /// </summary>
 /// <param name="exception">The exception to report on</param>
 /// <param name="runtimeEnding">True if the runtime is ending otherwise false</param>
 protected void Intialise(Exception exception, bool runtimeEnding)
 {
     Exception = exception;
     
     CallTrace = exception.StackTrace;
     
     IsRuntimeEnding = runtimeEnding;
     Severity = Severity.Error;
     Metadata = new Metadata();
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Configuration"/> class. Uses the passed
 /// configuration storage to populate its settings.
 /// </summary>
 /// <param name="storage">The storage to use for settings.</param>
 /// <param name="deviceInfo">Information about device</param>
 public Configuration(IConfigurationStorage storage, MobileDeviceInfo deviceInfo)
 {
     Storage = storage;
     DeviceInfo = deviceInfo;
     Metadata = new Metadata();
     BeforeNotifyCallbacks = new List<Func<Event, bool>>();
     InternalBeforeNotifyCallbacks = new List<Action<Event>>();
 }