< Summary

Line coverage
14%
Covered lines: 1
Uncovered lines: 6
Coverable lines: 7
Total lines: 58
Line coverage: 14.2%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%10%
.ctor(...)100%10%
.ctor(...)100%10%
IsUdfFile(...)100%1100%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.IO.Locator/16c8f4344390c6376cd2208cc1ae63a39862df37/JeremyAnsel.IO.Locator/JeremyAnsel.IO.DiscLocator/UdfFileLocator.cs

#LineLine coverage
 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
 8namespace 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)
 024            : base(root, stream => new UdfReader(stream))
 25        {
 026        }
 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)
 034            : base(locator, root, stream => new UdfReader(stream))
 35        {
 036        }
 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)
 043            : base(root, stream => new UdfReader(stream))
 44        {
 045        }
 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        {
 254            return UdfReader.Detect(root);
 55        }
 56    }
 57}
 58