diff --git a/SabreTools.IO/Extensions/StreamExtensions.cs b/SabreTools.IO/Extensions/StreamExtensions.cs
new file mode 100644
index 0000000..5a7424f
--- /dev/null
+++ b/SabreTools.IO/Extensions/StreamExtensions.cs
@@ -0,0 +1,46 @@
+using System.IO;
+
+namespace SabreTools.IO.Extensions
+{
+ public static class StreamExtensions
+ {
+ ///
+ /// Seek to a specific point in the stream, if possible
+ ///
+ /// Input stream to try seeking on
+ /// Optional offset to seek to
+ public static long SeekIfPossible(this Stream input, long offset = 0)
+ {
+ // If the stream is null, don't even try
+ if (input == null)
+ return -1;
+
+ // If the input is not seekable, just return the current position
+ if (!input.CanSeek)
+ {
+ try
+ {
+ return input.Position;
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+ // Attempt to seek to the offset
+ try
+ {
+ if (offset < 0)
+ return input.Seek(offset, SeekOrigin.End);
+ else if (offset >= 0)
+ return input.Seek(offset, SeekOrigin.Begin);
+
+ return input.Position;
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SabreTools.IO/Extensions/StreamReaderExtensions.cs b/SabreTools.IO/Extensions/StreamReaderExtensions.cs
index cfc2099..32f93c9 100644
--- a/SabreTools.IO/Extensions/StreamReaderExtensions.cs
+++ b/SabreTools.IO/Extensions/StreamReaderExtensions.cs
@@ -454,45 +454,6 @@ namespace SabreTools.IO.Extensions
return data;
}
- ///
- /// Seek to a specific point in the stream, if possible
- ///
- /// Input stream to try seeking on
- /// Optional offset to seek to
- public static long SeekIfPossible(this Stream input, long offset = 0)
- {
- // If the stream is null, don't even try
- if (input == null)
- return -1;
-
- // If the input is not seekable, just return the current position
- if (!input.CanSeek)
- {
- try
- {
- return input.Position;
- }
- catch
- {
- return -1;
- }
- }
- // Attempt to seek to the offset
- try
- {
- if (offset < 0)
- return input.Seek(offset, SeekOrigin.End);
- else if (offset >= 0)
- return input.Seek(offset, SeekOrigin.Begin);
-
- return input.Position;
- }
- catch
- {
- return -1;
- }
- }
-
///
/// Read a number of bytes from the stream to a buffer
///
diff --git a/SabreTools.IO/Extensions/StreamWriterExtensions.cs b/SabreTools.IO/Extensions/StreamWriterExtensions.cs
index 4e95cf6..91645ee 100644
--- a/SabreTools.IO/Extensions/StreamWriterExtensions.cs
+++ b/SabreTools.IO/Extensions/StreamWriterExtensions.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.IO;
#if NET7_0_OR_GREATER
using System.Numerics;