| | 1 | | // <copyright file="UdfFileLocator.cs" company="Jérémy Ansel"> |
| | 2 | | // Copyright (c) 2015, 2019 Jérémy Ansel |
| | 3 | | // </copyright> |
| | 4 | | // <license> |
| | 5 | | // Licensed under the MIT license. See LICENSE.txt |
| | 6 | | // </license> |
| | 7 | |
|
| | 8 | | namespace JeremyAnsel.IO.DiscLocator |
| | 9 | | { |
| | 10 | | using System.IO; |
| | 11 | | using DiscUtils.Udf; |
| | 12 | | using IO.Locator; |
| | 13 | |
|
| | 14 | | /// <summary> |
| | 15 | | /// An udf based disc file locator. |
| | 16 | | /// </summary> |
| | 17 | | internal sealed class UdfFileLocator : DiscFsFileLocator |
| | 18 | | { |
| | 19 | | /// <summary> |
| | 20 | | /// Initializes a new instance of the <see cref="UdfFileLocator"/> class. |
| | 21 | | /// </summary> |
| | 22 | | /// <param name="root">The root path.</param> |
| | 23 | | public UdfFileLocator(string root) |
| 0 | 24 | | : base(root, stream => new UdfReader(stream)) |
| | 25 | | { |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the <see cref="UdfFileLocator"/> class. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="locator">A file locator</param> |
| | 32 | | /// <param name="root">The root path.</param> |
| | 33 | | public UdfFileLocator(IFileLocator? locator, string root) |
| 0 | 34 | | : base(locator, root, stream => new UdfReader(stream)) |
| | 35 | | { |
| 0 | 36 | | } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Initializes a new instance of the <see cref="UdfFileLocator"/> class. |
| | 40 | | /// </summary> |
| | 41 | | /// <param name="root">A stream.</param> |
| | 42 | | public UdfFileLocator(Stream root) |
| 0 | 43 | | : base(root, stream => new UdfReader(stream)) |
| | 44 | | { |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// Detects whether a stream is an udf disc. |
| | 49 | | /// </summary> |
| | 50 | | /// <param name="root">A stream.</param> |
| | 51 | | /// <returns>A boolean.</returns> |
| | 52 | | public static bool IsUdfFile(Stream root) |
| | 53 | | { |
| 3 | 54 | | return UdfReader.Detect(root); |
| | 55 | | } |
| | 56 | | } |
| | 57 | | } |
| | 58 | |
|