private IncidentReportDialog(Window parent, string filename, UnknownPropertyException exc)
            : this(parent)
        {
            _msg = exc.Message;

            Message.Text = string.Format(Translate._("IncidentReportDialog.Message"), filename, exc.PropertyType, exc.ErrorPos);

            long offset = (exc.ErrorPos - Settings.INCIDENT_OFFSET) & (~0xF);
            long length = Settings.INCIDENT_LENGTH;
            _ReadData(filename, offset, length);
            SnapshotData.Text = CoreLib.Helpers.Hexdump(_data, 16, indent: 0, rel_offset: offset);
        }
 public static void Show(Window parent, string filename, UnknownPropertyException exc)
 {
     if (Config.Root.incident_reports.enabled)
     {
         new IncidentReportDialog(parent, filename, exc).ShowDialog();
     }
     else
     {
         string msg = string.Format(Translate._("IncidentReportDialog.Message"), filename, exc.PropertyType, exc.ErrorPos)
                      + "\n\n"
                      + Translate._("IncidentReportDialog.Hint")
         ;
         MessageBox.Show(msg, Translate._("IncidentReportDialog.Title"), MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
 }
        public void ShouldSerializeUnknownPropertyExceptionCorrectly()
        {
            var original = new UnknownPropertyException(typeof(string), "Property1");
            var formatter = new BinaryFormatter();

            using (var stream = new MemoryStream())
            {
                formatter.Serialize(stream, original);
                stream.Position = 0;

                var result = formatter.Deserialize(stream) as UnknownPropertyException;

                original.Message.ShouldEqual(result.Message);
                original.Property.ShouldEqual(result.Property);
                original.Type.ShouldEqual(result.Type);
            }
        }
        public void ShouldSerializeUnknownPropertyExceptionCorrectly()
        {
            var original  = new UnknownPropertyException(typeof(string), "Property1");
            var formatter = new BinaryFormatter();

            using (var stream = new MemoryStream())
            {
                formatter.Serialize(stream, original);
                stream.Position = 0;

                var result = formatter.Deserialize(stream) as UnknownPropertyException;

                original.Message.ShouldEqual(result.Message);
                original.Property.ShouldEqual(result.Property);
                original.Type.ShouldEqual(result.Type);
            }
        }
 public static void Show(string filename, UnknownPropertyException exc)
 {
     Show(null, filename, exc);
 }