Skip to content

Commit fabb226

Browse files
committed
Fix build
1 parent 54cefd6 commit fabb226

File tree

8 files changed

+47
-6
lines changed

8 files changed

+47
-6
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
using System;
3+
4+
namespace DocSharp.Binary.Common.Exceptions
5+
{
6+
public class EncryptedFileException : Exception
7+
{
8+
public EncryptedFileException(string message) : base(message)
9+
{
10+
}
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace DocSharp.Binary.Tools
5+
{
6+
public static class CollectionsHelpers
7+
{
8+
public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
9+
{
10+
if (dictionary == null)
11+
{
12+
throw new ArgumentNullException(nameof(dictionary));
13+
}
14+
15+
if (!dictionary.ContainsKey(key))
16+
{
17+
dictionary.Add(key, value);
18+
return true;
19+
}
20+
21+
return false;
22+
}
23+
}
24+
}

src/DocSharp.Binary/DocSharp.Binary.Common/Tools/MathHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Globalization;
34

45
namespace DocSharp.Binary.Tools

src/DocSharp.Binary/DocSharp.Binary.Doc/DocFileFormat/DocumentProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ private void setDefaultCompatibilityOptions(FileInformationBlock.FibVersion nFib
16761676
}
16771677
else if (nFib < FileInformationBlock.FibVersion.Fib1997Beta)
16781678
{
1679-
throw new UnspportedFileVersionException();
1679+
// throw new UnsupportedFileVersionException();
16801680
}
16811681
}
16821682

src/DocSharp.Binary/DocSharp.Binary.Doc/DocFileFormat/FileInformationBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public FileInformationBlock(VirtualStreamReader reader)
452452
ushort nFibRaw = reader.ReadUInt16();
453453
if (this.wIdent == 0xA5EC && nFibRaw == 0x000B)
454454
{
455-
throw new Exception("Word 2.0 files are not supported.");
455+
throw new UnsupportedFileVersionException("Word 2.0 files are not supported.");
456456
}
457457
this.nFib = (FibVersion)nFibRaw;
458458
reader.ReadBytes(2);

src/DocSharp.Binary/DocSharp.Binary.Doc/DocFileFormat/InvalidFileException.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace DocSharp.Binary.DocFileFormat
44
{
5-
public class UnspportedFileVersionException :Exception
5+
public class UnsupportedFileVersionException : Exception
66
{
7-
private const string MSG = "DocFileFormat does not support .doc files that have been created with Word versions older than Word 97.";
7+
private const string MSG = "DocFileFormat does not support .doc files that have been created with Word versions older than Word 6.0.";
88

9-
public UnspportedFileVersionException()
9+
public UnsupportedFileVersionException()
1010
: base(MSG)
1111
{
1212
}
1313

14-
public UnspportedFileVersionException(string text)
14+
public UnsupportedFileVersionException(string text)
1515
: base(text)
1616
{
1717
}

src/DocSharp.Binary/DocSharp.Binary.Doc/DocFileFormat/PieceTable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public PieceTable(FileInformationBlock fib)
3737
Encoding encoding1252;
3838
try
3939
{
40+
#if !NETFRAMEWORK
4041
// Try to register encoding provider for .NET Core compatibility
4142
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
43+
#endif
4244
encoding1252 = Encoding.GetEncoding(1252);
4345
}
4446
catch

src/DocSharp.Binary/DocSharp.Binary.Doc/DocFileFormat/WordDocument.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
using DocSharp.Binary.Common.Exceptions;
12
using DocSharp.Binary.CommonTranslatorLib;
23
using DocSharp.Binary.OfficeDrawing;
34
using DocSharp.Binary.StructuredStorage.Common;
45
using DocSharp.Binary.StructuredStorage.Reader;
6+
using DocSharp.Binary.Tools;
57
using System;
68
using System.Collections.Generic;
79
using System.Reflection;

0 commit comments

Comments
 (0)