Skip to content

Commit

Permalink
v1.1.6144 Fixed bug accessing attachment properties held in the attac…
Browse files Browse the repository at this point in the history
…hment's sub- node
  • Loading branch information
Dijji committed Oct 27, 2016
1 parent d4e76e9 commit b4aea2d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
1 change: 1 addition & 0 deletions Layouts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public struct NID
public UInt32 dwValue; // References use the whole four bytes
public EnidType nidType {get { return (EnidType)(dwValue & 0x0000001f); } } // Low order five bits of stored value
public UInt32 nidIndex { get { return dwValue >> 5; } }
public bool HasValue { get { return (dwValue != 0); } }

public NID(UInt32 nid)
{
Expand Down
29 changes: 25 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,15 @@ private void listMessages_SelectionChanged(object sender, SelectionChangedEventA

if (m != null)
{
xstFile.ReadMessageDetails(m);
ShowMessage(m);
try
{
xstFile.ReadMessageDetails(m);
ShowMessage(m);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message, "Error reading message details");
}
}
view.SetMessage(m);
}
Expand Down Expand Up @@ -156,12 +163,26 @@ private void listMessagesColumnHeader_Click(object sender, RoutedEventArgs e)

private void listRecipients_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
view.SelectedRecipientChanged((Recipient)listRecipients.SelectedItem);
try
{
view.SelectedRecipientChanged((Recipient)listRecipients.SelectedItem);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message, "Error reading recipient");
}
}

private void listAttachments_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
view.SelectedAttachmentsChanged(listAttachments.SelectedItems.Cast<Attachment>());
try
{
view.SelectedAttachmentsChanged(listAttachments.SelectedItems.Cast<Attachment>());
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message, "Error reading attachment");
}
}

private void btnSave_Click(object sender, RoutedEventArgs e)
Expand Down
4 changes: 3 additions & 1 deletion NDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ public static Node LookupSubNode(BTree<Node> subNodeTree, NID nid)
// If it has a multiblock structure, return all of the blocks' contents concatenated
public byte[] ReadSubNodeDataBlock(FileStream fs, BTree<Node> subNodeTree, NID nid)
{
if (!nid.HasValue)
return null;
var n = LookupSubNode(subNodeTree, nid);
if (n == null)
return null;
throw new Exception("Node not found in sub node tree");
if (n.SubDataBid != 0)
throw new Exception("Sub-nodes of sub-nodes not yet implemented");
return ReadDataBlock(fs, n.DataBid);
Expand Down
2 changes: 1 addition & 1 deletion XstFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public List<Property> ReadAttachmentProperties(Attachment a)

// Read all non-content properties
// Convert to list so that we can dispose the file access
return new List<Property>(ltp.ReadAllProperties(fs, subNodeTreeMessage, a.Nid, attachmentContentExclusions));
return new List<Property>(ltp.ReadAllProperties(fs, subNodeTreeMessage, a.Nid, attachmentContentExclusions, true));
}
}

Expand Down

0 comments on commit b4aea2d

Please sign in to comment.