< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.IO.MbLinkShortcutHandler
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
Line coverage
10%
Covered lines: 1
Uncovered lines: 9
Coverable lines: 10
Total lines: 35
Line coverage: 10%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Extension()100%11100%
Resolve(...)0%620%
Create(...)100%210%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System;
 4using System.IO;
 5using MediaBrowser.Model.IO;
 6
 7namespace Emby.Server.Implementations.IO
 8{
 9    public class MbLinkShortcutHandler : IShortcutHandler
 10    {
 10011        public string Extension => ".mblink";
 12
 13        public string? Resolve(string shortcutPath)
 14        {
 015            ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
 16
 017            if (Path.GetExtension(shortcutPath.AsSpan()).Equals(".mblink", StringComparison.OrdinalIgnoreCase))
 18            {
 019                var path = File.ReadAllText(shortcutPath);
 20
 021                return Path.TrimEndingDirectorySeparator(path);
 22            }
 23
 024            return null;
 25        }
 26
 27        public void Create(string shortcutPath, string targetPath)
 28        {
 029            ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
 030            ArgumentException.ThrowIfNullOrEmpty(targetPath);
 31
 032            File.WriteAllText(shortcutPath, targetPath);
 033        }
 34    }
 35}