示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ InstallationDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (InstallationChannel != null ? InstallationChannel.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#2
0
        /// <summary>
        ///     对象解析为Xml元素,方便的存储
        /// </summary>
        /// <returns>包含节点信息的Xml元素</returns>
        public override XElement ToXmlElement()
        {
            var element = base.ToXmlElement();

            element.SetAttributeValue("DeviceType", DeviceType);
            element.SetAttributeValue("ConnectTimeOut", ConnectTimeOut);
            element.SetAttributeValue("CreateTime", CreateTime.ToString());
            element.SetAttributeValue("InstallationDate", InstallationDate.ToString());
            return(element);
        }
示例#3
0
 private bool Equals(ReferredUser other)
 {
     return(base.Equals(other) && InstallationDate.Equals(other.InstallationDate) && string.Equals(InstallationChannel, other.InstallationChannel));
 }
 private bool Equals(ReferredUser other)
 {
     return(base.Equals(other) && InstallationDate.Equals(other.InstallationDate) && string.Equals(InstallationChannel, other.InstallationChannel) && string.Equals(InstallPlatform, other.InstallPlatform) && Reinstall == other.Reinstall && InstallSuspicious == other.InstallSuspicious);
 }
示例#5
0
        /// <summary>
        /// Report exception and show UI in given thread.
        /// </summary>
        /// <param name="exception"></param>
        /// <returns></returns>
        protected virtual ExecutionFlow Report(Exception exception)
        {
            try
            {
                Logger.Trace("Starting to generate a bug report for the exception.");
                var serializableException = new SerializableException(exception);
                var report = new Report(serializableException);

                if (_settings.Plugins != null && _settings.Plugins.Count > 0)
                {
                    Logger.Trace("Processing plugins.");
                    foreach (IPlugin plugin in _settings.Plugins)
                    {
                        plugin.PreProcess(_settings);
                    }
                }

                var handler = ProcessingException;
                if (handler != null)
                {
                    Logger.Trace("Notifying the user before handling the exception.");

                    // Allowing user to add any custom information to the report
                    handler(exception, report);
                }

                var uiDialogResult = _settings.UserInterface.DisplayBugReportUI(report);

                if (uiDialogResult.SendReport)
                {
                    // Test if it has NOT been more than x many days since entry assembly was last modified)
                    if (_settings.StopReportingAfter >= 0 &&
                        InstallationDate.AddDays(_settings.StopReportingAfter).CompareTo(DateTime.Now) <= 0)
                    {
                        // TODO: this should be moved to task
                        // clear written reports
                        Logger.Trace("As per setting 'Settings.StopReportingAfter(" + _settings.StopReportingAfter +
                                     ")', bug reporting feature was enabled for a certain amount of time which has now expired: Truncating all expired bug reports. Bug reporting is now disabled.");
                        _storage.Clear();
                    }
                    else
                    {
                        _storage.Write(report);

                        // notify dispatcher to dispatch
                        lock (_backgroundLock)
                        {
                            Monitor.PulseAll(_backgroundLock);
                        }
                    }
                }

                if (_settings.Plugins != null && _settings.Plugins.Count > 0)
                {
                    Logger.Trace("PostProcessing plugins.");
                    foreach (IPlugin plugin in _settings.Plugins)
                    {
                        plugin.PostProcess(_settings);
                    }
                }

                return(uiDialogResult.Execution);
            }
            catch (Exception ex)
            {
                Logger.Error("An exception occurred during bug report generation process. See the inner exception for details.", ex);
                return(ExecutionFlow.BreakExecution); // Since an internal exception occured
            }
        }