From d457023a2e40542d672f15c27b04b42ba218ba4b Mon Sep 17 00:00:00 2001 From: Kees van Spelde Date: Wed, 21 Dec 2022 14:53:30 +0100 Subject: [PATCH] Fix issue #318 --- MsgReaderCore/Helpers/FileManager.cs | 7 +- MsgReaderCore/MsgReader.csproj | 164 +++++++++--------- MsgReaderCore/MsgReader.csproj.DotSettings | 2 + MsgReaderCore/MsgReader.xml | 44 ++--- MsgReaderCore/Outlook/Message.cs | 2 +- MsgReaderCore/Rtf/Document.cs | 2 +- MsgViewer/MsgViewer.csproj.DotSettings | 2 + .../EmailExtractor.csproj.DotSettings | 2 + 8 files changed, 119 insertions(+), 106 deletions(-) create mode 100644 MsgReaderCore/MsgReader.csproj.DotSettings create mode 100644 MsgViewer/MsgViewer.csproj.DotSettings create mode 100644 Utilities/EmailExtractor/EmailExtractor.csproj.DotSettings diff --git a/MsgReaderCore/Helpers/FileManager.cs b/MsgReaderCore/Helpers/FileManager.cs index a1523d74..ad74d02f 100644 --- a/MsgReaderCore/Helpers/FileManager.cs +++ b/MsgReaderCore/Helpers/FileManager.cs @@ -28,6 +28,7 @@ using System.Globalization; using System.IO; using System.Linq; +// ReSharper disable UseIndexFromEndExpression namespace MsgReader.Helpers { @@ -121,7 +122,7 @@ public static string GetExtension(string path) throw new ArgumentException("path"); var splittedPath = path.Split(Path.DirectorySeparatorChar); - var fileName = splittedPath[^1]; + var fileName = splittedPath[splittedPath.Length - 1]; var index = fileName.LastIndexOf(".", StringComparison.Ordinal); @@ -144,8 +145,8 @@ public static string GetFileNameWithoutExtension(string path) throw new ArgumentException(@"No path given", nameof(path)); var splittedPath = path.Split(Path.DirectorySeparatorChar); - var fileName = splittedPath[^1]; - return !fileName.Contains(".") + var fileName = splittedPath[splittedPath.Length - 1]; + return !fileName.Contains('.') ? fileName : fileName.Substring(0, fileName.LastIndexOf(".", StringComparison.Ordinal)); } diff --git a/MsgReaderCore/MsgReader.csproj b/MsgReaderCore/MsgReader.csproj index 5a4f0d2a..70acd32d 100644 --- a/MsgReaderCore/MsgReader.csproj +++ b/MsgReaderCore/MsgReader.csproj @@ -1,93 +1,99 @@  - - net6;net5;net462;netstandard2.0;netstandard2.1 - MsgReader - true - 4.4.13 - 4.4.13.0 - Kees van Spelde - Magic-Sessions - (c)2013-2022 - Kees van Spelde - https://github.com/Sicos1977/MSGReader - - - https://github.com/Sicos1977/MSGReader - GitHub - Outlook MSG Signed EML Contact Appointment Task - Read Outlook MSG and EML files without using Outlook. + + net6;net5;net462;netstandard2.0;netstandard2.1 + MsgReader + true + 4.4.13 + 4.4.13.0 + Kees van Spelde + Magic-Sessions + (c)2013-2023 - Kees van Spelde + https://github.com/Sicos1977/MSGReader + + + https://github.com/Sicos1977/MSGReader + GitHub + 10.0 + Outlook MSG Signed EML Contact Appointment Task + + Read Outlook MSG and EML files without using Outlook. -The MSGReader supports MSG E-Mail (also signed), Contact, Appointment, Task, Sticky notes and Contact files. -The EML reader supports MIME 1.0 encoded files - - Updates nuget packages -- Fix various decoding issues with 2 byte charsets - true - MSGReader.snk - 4.4.13.0 - MIT - Outlook-icon.png - README.md - + The MSGReader supports MSG E-Mail (also signed), Contact, Appointment, Task, Sticky notes and Contact files. - - MsgReader.xml - + The EML reader supports MIME 1.0 encoded files + + + - Updates nuget packages + - Fix various decoding issues with 2 byte charsets + + true + MSGReader.snk + 4.4.13.0 + MIT + Outlook-icon.png + README.md + - - - - - - - + + MsgReader.xml + - - - - + + + - - - - - + + + - - - - - - + + + + - - - + + + + + - - - True - \ - - - True - - - + + + + + + - - - True - True - LanguageConsts.resx - - + + + - - - ResXFileCodeGenerator - LanguageConsts.Designer.cs - - + + + True + \ + + + True + + + - + + + True + True + LanguageConsts.resx + + + + + + ResXFileCodeGenerator + LanguageConsts.Designer.cs + + + + \ No newline at end of file diff --git a/MsgReaderCore/MsgReader.csproj.DotSettings b/MsgReaderCore/MsgReader.csproj.DotSettings new file mode 100644 index 00000000..4887f947 --- /dev/null +++ b/MsgReaderCore/MsgReader.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp100 \ No newline at end of file diff --git a/MsgReaderCore/MsgReader.xml b/MsgReaderCore/MsgReader.xml index f9bff9fe..876148e9 100644 --- a/MsgReaderCore/MsgReader.xml +++ b/MsgReaderCore/MsgReader.xml @@ -157,12 +157,12 @@ Gives the size of a file in Windows format (GB, MB, KB, Bytes) - Filesize in bytes + File size in bytes - This class is used as a placeholder for the filetype information + This class is used as a placeholder for the file type information @@ -2723,7 +2723,7 @@ The X500 DN of the Address Book object. - A distinguished name (DN), in Teletex form, of an object that is in an address book. An X500 DN can be more limited + A distinguished name (DN), in Teletext form, of an object that is in an address book. An X500 DN can be more limited in the size and number of relative distinguished names (RDNs) than a full DN. @@ -3078,7 +3078,7 @@ - Returns the named propery work (business) address (Outlook 2007 or higher), null when not available + Returns the named property work (business) address (Outlook 2007 or higher), null when not available @@ -3128,7 +3128,7 @@ - Returns the named propery home address (Outlook 2007 or higher) + Returns the named property home address (Outlook 2007 or higher) @@ -3173,7 +3173,7 @@ - Returns the named propery other address (Outlook 2007 or higher) + Returns the named property other address (Outlook 2007 or higher) @@ -3283,7 +3283,7 @@ - Returns the name property e-mail displayname 1 (Outlook 2007 or higher), null when not available + Returns the name property e-mail display name 1 (Outlook 2007 or higher), null when not available @@ -3293,7 +3293,7 @@ - Returns the name property e-mail displayname 2 (Outlook 2007 or higher), null when not available + Returns the name property e-mail display name 2 (Outlook 2007 or higher), null when not available @@ -3303,7 +3303,7 @@ - Returns the name property e-mail displayname 3 (Outlook 2007 or higher), null when not available + Returns the name property e-mail display name 3 (Outlook 2007 or higher), null when not available @@ -4055,7 +4055,7 @@ - Returns the addresstype, null when not available + Returns the address type, null when not available @@ -4515,7 +4515,7 @@ - Returns the rendering position for the attachmnt + Returns the rendering position for the attachment @@ -4662,7 +4662,7 @@ - Variable size; a COUNT field followed by that many PT_MV_LONGLONGvalues. (PT_MV_I8, PT_MV_I8) + Variable size; a COUNT field followed by that many PT_MV_LONGLONG values. (PT_MV_I8, PT_MV_I8) @@ -5450,7 +5450,7 @@ - Returns the Property as a readable string without the streamprefix and type + Returns the Property as a readable string without the stream prefix and type @@ -5467,7 +5467,7 @@ - Returns true when this property is part of a multivalue property + Returns true when this property is part of a multi value property @@ -5559,13 +5559,13 @@ - Creates this object and sets all its propertues + Creates this object and sets all its properties The id of the property The The property data Set to true to indicate that this property is part of a - multivalue property + multi value property @@ -5620,7 +5620,7 @@ - Returns the addresstype, null when not available + Returns the address type, null when not available @@ -5703,7 +5703,7 @@ The task has not yet started - + The task is in progress @@ -5834,12 +5834,12 @@ - An organiztional mailbox + An organizational mailbox - A private distribtion list + A private distribution list @@ -5969,7 +5969,7 @@ this recipient (1). - A distinguished name (DN), in Teletex form, of an object that is in an address book. An X500 DN can be more limited + A distinguished name (DN), in Teletext form, of an object that is in an address book. An X500 DN can be more limited in the size and number of relative distinguished names (RDNs) than a full DN. @@ -6004,7 +6004,7 @@ key of the distribution list. - + This field MUST be present when the field of the RecipientsFlags field is set to NoType (0x0) and the O flag of the RecipientsFlags field diff --git a/MsgReaderCore/Outlook/Message.cs b/MsgReaderCore/Outlook/Message.cs index 574d0cc0..f10a83cd 100644 --- a/MsgReaderCore/Outlook/Message.cs +++ b/MsgReaderCore/Outlook/Message.cs @@ -1986,7 +1986,7 @@ private void SetEmailSenderAndRepresentingSender() var parts = tempDisplayName.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if (parts.Length > 0) { - var lastPart = parts[^1]; + var lastPart = parts[parts.Length - 1]; tempDisplayName = lastPart.Contains("=") ? lastPart.Split('=')[1] : lastPart; } } diff --git a/MsgReaderCore/Rtf/Document.cs b/MsgReaderCore/Rtf/Document.cs index 2625c713..5bb11f8e 100644 --- a/MsgReaderCore/Rtf/Document.cs +++ b/MsgReaderCore/Rtf/Document.cs @@ -892,7 +892,7 @@ public void ParseRtfText(string rtfText) break; case Consts.Af: - _associateFontCharSet = FontTable[reader.Parameter].Encoding; + _associateFontCharSet = FontTable[reader.Parameter]?.Encoding; break; case Consts.HtmlRtf: diff --git a/MsgViewer/MsgViewer.csproj.DotSettings b/MsgViewer/MsgViewer.csproj.DotSettings new file mode 100644 index 00000000..6162834d --- /dev/null +++ b/MsgViewer/MsgViewer.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp90 \ No newline at end of file diff --git a/Utilities/EmailExtractor/EmailExtractor.csproj.DotSettings b/Utilities/EmailExtractor/EmailExtractor.csproj.DotSettings new file mode 100644 index 00000000..6162834d --- /dev/null +++ b/Utilities/EmailExtractor/EmailExtractor.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp90 \ No newline at end of file