47 Commits

Author SHA1 Message Date
Matt Nadareski
b325212664 Bump version 2026-11-11 11:18:54 +01:00
Matt Nadareski
70e6bdd41c Add .NET 11 support 2026-11-11 10:29:50 +01:00
gmipf
6dddf7db37 Do not follow linked directories in SafeGetFiles outside of Windows (#8)
* Do not follow linked directories in SafeGetFiles outside of Windows

SafeGetFiles with SearchOption.AllDirectories follows directory symlinks.
On Linux, the UDF view of some PC/Mac hybrid discs has symlinks whose
target reads as empty, and each one resolves to its own folder, so the
recursion never ends (fixes #2, SabreTools/BinaryObjectScanner#276).

Outside of Windows, walk the tree one directory at a time and do not enter
directories that carry FileAttributes.ReparsePoint. Files are matched with
Directory.GetFiles per directory, so the pattern behaves as before, and the
order is the same breadth-first order. Windows keeps Directory.GetFiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Do not follow linked directories in the other AllDirectories overloads

SafeGetDirectories and the SafeEnumerateDirectories, SafeEnumerateFiles
and SafeEnumerateFileSystemEntries wrappers follow directory symlinks in
the same way. On Linux, with one directory linked to itself,
SafeEnumerateFiles returns 43 files instead of 2, and with three such
links it is still running after 10 seconds.

The walk from SafeGetFiles is now a lazy iterator that all of them share,
so the Enumerate wrappers stay lazy. Each directory is listed with the
matching overload without SearchOption (Directory.GetFiles,
SafeEnumerateFiles and so on), so patterns and inaccessible directories
behave as in the recursive search. If the attributes of a subdirectory
cannot be read, such as below a directory without execute permission, it
is entered anyway, so it fails in the same way as in the recursive search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Check for linked directories without catching exceptions

DirectoryInfo.Exists returns false where the attributes cannot be read, and the criteria for the walk are checked one at a time with their reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 13:52:11 +01:00
Matt Nadareski
edd6b36826 Mount points should be left alone 2026-11-04 07:13:45 -05:00
Matt Nadareski
118e2078ea Handle space encoding in mount points and volume labels 2026-11-03 21:29:56 -05:00
Matt Nadareski
804f87e1a8 Fix incorrect replacement path 2026-11-03 20:52:14 -05:00
Matt Nadareski
8afc57b709 Relative paths don't resolve on Linux properly 2026-11-03 20:47:55 -05:00
Matt Nadareski
7f2d2e7ada Add label-finding extensions for Linux in .NET 6 and above 2026-11-03 20:20:13 -05:00
Matt Nadareski
9e25afe28b Simplify remaining device extensions tests 2026-11-02 08:46:06 -05:00
Matt Nadareski
e01891e779 Reduce surface area of tests and issues in device extensions 2026-11-02 08:05:15 -05:00
Matt Nadareski
77be01db2d This can be a List on all .NET versions 2026-11-02 07:50:59 -05:00
Matt Nadareski
17af1318b2 Move some information from summary to remarks 2026-11-02 07:48:10 -05:00
Matt Nadareski
1b1bea3a17 Separate out device extensions 2026-11-02 07:43:13 -05:00
Matt Nadareski
1ffc627d8a Port mount point methods from MPF 2026-11-02 07:36:25 -05:00
gmipf
f6b6aa1e14 Allow 0-byte reads at the end of a byte array (#3)
* Allow 0-byte reads at the end of a byte array

ReadBytes(ref offset, 0) threw ArgumentOutOfRangeException when offset
was equal to the array length, before the 0-byte case was handled. The
same happened for a 0-byte read from an empty array, and TryReadBytes
with a count of 0 at the end threw instead of returning true. The offset
check now accepts the end of the array for a 0-byte read only; reads past
the end still throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Handle 0-byte reads before the offset check

Same order as the stream version of ReadExactlyToBuffer, applied to
both byte array copies (Numerics.Extensions and IO.Extensions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:20:30 -04:00
Matt Nadareski
4235315f58 Unix IO stuff ported/opnened from MPF 2026-10-12 11:00:43 -04:00
Matt Nadareski
8695e58c27 Bump version 2026-08-28 13:00:14 -04:00
Matt Nadareski
78c6c1b6f6 Bump version 2026-07-10 11:10:33 -04:00
Matt Nadareski
9d04185b21 Use explicit enum values matching automatic values
This is being done to avoid any API-breaking changes in the future. If the values are set explicitly, added values either need to force a major version update or get added as the next-highest values.
2026-07-10 09:58:04 -04:00
Matt Nadareski
e07da60916 These helpers should be private 2026-07-09 16:03:47 -04:00
Matt Nadareski
72c523595e Give reasonable defaults to recent helpers 2026-07-09 16:01:55 -04:00
Matt Nadareski
486c95582f Port *nix device methods, update tests 2026-07-09 15:45:00 -04:00
Matt Nadareski
9281796251 ResolvePath should always return an aboslute path 2026-07-02 10:21:15 -04:00
Matt Nadareski
a893de700a Add ResolvePath extension from MPF 2026-07-02 10:01:18 -04:00
Matt Nadareski
96d7141264 Bump version 2026-05-14 08:51:35 -04:00
Matt Nadareski
574eebb231 Fix namespace that slipped by 2026-04-20 11:09:29 -04:00
Matt Nadareski
9cdee80bed Bump version 2026-03-24 17:54:11 -04:00
Matt Nadareski
4b04f4389c Cleanup from previous changes 2026-03-24 10:16:58 -04:00
Matt Nadareski
b7676f9306 Move last Transform functionality to IO.Extensions 2026-03-24 10:12:38 -04:00
Matt Nadareski
6307b9c361 Concatenate to IOExtensions 2026-03-24 09:57:40 -04:00
Matt Nadareski
6885198fcf SplitToEvenOdd to a stream extension 2026-03-24 09:53:19 -04:00
Matt Nadareski
3d4ebd4314 Migrate some Transform tasks to extensions appropriately 2026-03-24 09:05:23 -04:00
Matt Nadareski
99c318a9ae Add BlockCopy extension, finally 2026-03-23 20:47:49 -04:00
Matt Nadareski
e250c505c3 Update "Relies on" comments 2026-03-23 20:20:26 -04:00
Matt Nadareski
f2d3ae475c Fix direct references to projects 2026-03-23 20:07:53 -04:00
Matt Nadareski
77dc8ebed7 Separate out collections extensions
Even though there are relatively few collections extensions right now, there is a relatively high chance that other extension will be used in the future.
2026-03-23 10:50:09 -04:00
Matt Nadareski
1f1a5c51f3 Port GetFileSize method from BOS 2026-03-22 17:17:13 -04:00
Matt Nadareski
86040947b5 Combine ParentablePathExtensions into IO extensions and sort 2026-03-22 15:35:11 -04:00
Matt Nadareski
34ed3322c4 Move some math/numeric byte array extensions 2026-03-22 15:22:46 -04:00
Matt Nadareski
190e593883 Move some matching extensions to Matching namespace 2026-03-21 22:09:56 -04:00
Matt Nadareski
6ba25e0fbf Fix build 2026-03-21 22:00:37 -04:00
Matt Nadareski
5b2338aa6f Move more string-related extensions 2026-03-21 21:59:14 -04:00
Matt Nadareski
6dc531dad7 Start parting out IO.Extensions a bit more 2026-03-21 21:45:14 -04:00
Matt Nadareski
add545ec55 Numerics extensions to new namespace 2026-03-21 20:57:03 -04:00
Matt Nadareski
5e907da93a Port StringBuilderExtensions from Serialization 2026-03-21 17:54:36 -04:00
Matt Nadareski
bbd48926f1 Project file cleanup 2026-03-21 14:23:13 -04:00
Matt Nadareski
d614379cf5 Libraries
This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.IO.Meta` builds the normal Nuget package that is used by all other projects and includes all namespaces. `SabreTools.IO` builds to `SabreTools.IO.Common` to avoid overwriting issues on publish.
2026-03-21 13:55:42 -04:00