The Free Software Media System - Server Backend & API
Visual Studio Reformat: Emby.IsoMounting
Erwin de Haan25a428373c93
diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.csindex ab85cb721a..846f3b2ce6 100644--- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs+++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs@@ -1,12 +1,12 @@using System;using System.IO;+using System.Runtime.InteropServices;using System.Threading;using System.Threading.Tasks;using MediaBrowser.Model.Diagnostics;using MediaBrowser.Model.IO;-using Microsoft.Extensions.Logging;using MediaBrowser.Model.System;-using System.Runtime.InteropServices;+using Microsoft.Extensions.Logging;namespace IsoMounter{@@ -87,9 +87,12 @@ namespace IsoMounterUmountCommand);- if (!string.IsNullOrEmpty(SudoCommand) && !string.IsNullOrEmpty(MountCommand) && !string.IsNullOrEmpty(UmountCommand)) {+ if (!string.IsNullOrEmpty(SudoCommand) && !string.IsNullOrEmpty(MountCommand) && !string.IsNullOrEmpty(UmountCommand))+ {ExecutablesAvailable = true;- } else {+ }+ else+ {ExecutablesAvailable = false;}@@ -99,18 +102,23 @@ namespace IsoMounter#region Interface Implementation for IIsoMounter- public bool IsInstalled {- get {+ public bool IsInstalled+ {+ get+ {return true;}}- public string Name {+ public string Name+ {get { return "LinuxMount"; }}- public bool RequiresInstallation {- get {+ public bool RequiresInstallation+ {+ get+ {return false;}}@@ -148,10 +156,12 @@ namespace IsoMounterpublic Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken){- if (MountISO(isoPath, out LinuxMount mountedISO)) {+ if (MountISO(isoPath, out LinuxMount mountedISO))+ {return Task.FromResult<IIsoMount>(mountedISO);}- else {+ else+ {throw new IOException(string.Format("An error occurred trying to mount image [$0].",isoPath@@ -180,7 +190,8 @@ namespace IsoMounterprotected virtual void Dispose(bool disposing){- if (disposed) {+ if (disposed)+ {return;}@@ -190,7 +201,8 @@ namespace IsoMounterdisposing.ToString());- if (disposing) {+ if (disposing)+ {//// Free managed objects here.@@ -217,7 +229,8 @@ namespace IsoMounter{string path = test.Trim();- if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {+ if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name)))+ {return FileSystem.GetFullPath(path);}}@@ -247,7 +260,8 @@ namespace IsoMounterbool processFailed = false;var process = ProcessFactory.Create(- new ProcessOptions {+ new ProcessOptions+ {CreateNoWindow = true,RedirectStandardOutput = true,RedirectStandardError = true,@@ -285,9 +299,12 @@ namespace IsoMounter_logger.LogDebug(ex, "[{Name}] Unhandled exception executing command.", Name);}- if (!processFailed && process.ExitCode == 0) {+ if (!processFailed && process.ExitCode == 0)+ {return true;- } else {+ }+ else+ {return false;}@@ -300,7 +317,8 @@ namespace IsoMounterstring cmdFilename;string mountPoint = Path.Combine(MountPointRoot, Guid.NewGuid().ToString());- if (!string.IsNullOrEmpty(isoPath)) {+ if (!string.IsNullOrEmpty(isoPath))+ {_logger.LogInformation("[{Name}] Attempting to mount [{Path}].",@@ -314,7 +332,9 @@ namespace IsoMountermountPoint);- } else {+ }+ else+ {throw new ArgumentNullException(nameof(isoPath));@@ -333,10 +353,13 @@ namespace IsoMounterthrow new IOException("Unable to create mount point for " + isoPath);}- if (GetUID() == 0) {+ if (GetUID() == 0)+ {cmdFilename = MountCommand;cmdArguments = string.Format("\"{0}\" \"{1}\"", isoPath, mountPoint);- } else {+ }+ else+ {cmdFilename = SudoCommand;cmdArguments = string.Format("\"{0}\" \"{1}\" \"{2}\"", MountCommand, isoPath, mountPoint);}@@ -348,7 +371,8 @@ namespace IsoMountercmdArguments);- if (ExecuteCommand(cmdFilename, cmdArguments)) {+ if (ExecuteCommand(cmdFilename, cmdArguments))+ {_logger.LogInformation("[{0}] ISO mount completed successfully.",@@ -357,7 +381,9 @@ namespace IsoMountermountedISO = new LinuxMount(this, isoPath, mountPoint);- } else {+ }+ else+ {_logger.LogInformation("[{0}] ISO mount completed with errors.",@@ -387,7 +413,8 @@ namespace IsoMounterstring cmdArguments;string cmdFilename;- if (mount != null) {+ if (mount != null)+ {_logger.LogInformation("[{0}] Attempting to unmount ISO [{1}] mounted on [{2}].",@@ -396,16 +423,21 @@ namespace IsoMountermount.MountedPath);- } else {+ }+ else+ {throw new ArgumentNullException(nameof(mount));}- if (GetUID() == 0) {+ if (GetUID() == 0)+ {cmdFilename = UmountCommand;cmdArguments = string.Format("\"{0}\"", mount.MountedPath);- } else {+ }+ else+ {cmdFilename = SudoCommand;cmdArguments = string.Format("\"{0}\" \"{1}\"", UmountCommand, mount.MountedPath);}@@ -417,14 +449,17 @@ namespace IsoMountercmdArguments);- if (ExecuteCommand(cmdFilename, cmdArguments)) {+ if (ExecuteCommand(cmdFilename, cmdArguments))+ {_logger.LogInformation("[{0}] ISO unmount completed successfully.",Name);- } else {+ }+ else+ {_logger.LogInformation("[{0}] ISO unmount completed with errors.",diff --git a/Emby.IsoMounting/IsoMounter/LinuxMount.cs b/Emby.IsoMounting/IsoMounter/LinuxMount.csindex da2eb19835..b8636822b6 100644--- a/Emby.IsoMounting/IsoMounter/LinuxMount.cs+++ b/Emby.IsoMounting/IsoMounter/LinuxMount.cs@@ -45,11 +45,13 @@ namespace IsoMounterprotected virtual void Dispose(bool disposing){- if (disposed) {+ if (disposed)+ {return;}- if (disposing) {+ if (disposing)+ {//// Free managed objects here.diff --git a/Emby.IsoMounting/IsoMounter/Plugin.cs b/Emby.IsoMounting/IsoMounter/Plugin.csindex ea53175024..6a24313932 100644--- a/Emby.IsoMounting/IsoMounter/Plugin.cs+++ b/Emby.IsoMounting/IsoMounter/Plugin.cs@@ -1,8 +1,8 @@-using MediaBrowser.Common.Configuration;+using System;+using IsoMounter.Configuration;+using MediaBrowser.Common.Configuration;using MediaBrowser.Common.Plugins;using MediaBrowser.Model.Serialization;-using System;-using IsoMounter.Configuration;namespace IsoMounter{