| | | 1 | | // <copyright file="IsoFileLocator.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.Iso9660; |
| | | 12 | | using IO.Locator; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// An iso based disc file locator. |
| | | 16 | | /// </summary> |
| | | 17 | | internal sealed class IsoFileLocator : DiscFsFileLocator |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Initializes a new instance of the <see cref="IsoFileLocator"/> class. |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="root">The root path.</param> |
| | | 23 | | public IsoFileLocator(string root) |
| | 0 | 24 | | : base(root, stream => new CDReader(stream, true, true)) |
| | | 25 | | { |
| | 0 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Initializes a new instance of the <see cref="IsoFileLocator"/> class. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <param name="locator">A file locator.</param> |
| | | 32 | | /// <param name="root">The root path.</param> |
| | | 33 | | public IsoFileLocator(IFileLocator? locator, string root) |
| | 0 | 34 | | : base(locator, root, stream => new CDReader(stream, true, true)) |
| | | 35 | | { |
| | 0 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Initializes a new instance of the <see cref="IsoFileLocator"/> class. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="root">A stream.</param> |
| | | 42 | | public IsoFileLocator(Stream root) |
| | 0 | 43 | | : base(root, stream => new CDReader(stream, true, true)) |
| | | 44 | | { |
| | 0 | 45 | | } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Detects whether a stream is an iso disc. |
| | | 49 | | /// </summary> |
| | | 50 | | /// <param name="root">A stream.</param> |
| | | 51 | | /// <returns>A boolean.</returns> |
| | | 52 | | public static bool IsIsoFile(Stream root) |
| | | 53 | | { |
| | 3 | 54 | | return CDReader.Detect(root); |
| | | 55 | | } |
| | | 56 | | } |
| | | 57 | | } |
| | | 58 | | |