diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 6be6826f4e..4578da8279 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -149,7 +149,7 @@ namespace MediaBrowser.Common.Implementations
protected IConfigurationManager ConfigurationManager { get; private set; }
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
protected BaseApplicationHost()
{
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
index 56e699b358..0bd8b9df87 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
@@ -45,7 +45,7 @@ namespace MediaBrowser.Common.Implementations
///
/// Gets the path to the system folder
///
- public string ProgramSystemPath { get { return Path.Combine(ProgramDataPath, "System"); }}
+ public string ProgramSystemPath { get { return Path.Combine(ProgramDataPath, "System"); } }
///
/// The _data directory
@@ -291,7 +291,7 @@ namespace MediaBrowser.Common.Implementations
/// Gets the path to the application's ProgramDataFolder
///
/// System.String.
- private string GetProgramDataPath()
+ private string GetProgramDataPath()
{
var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : Path.Combine(ConfigurationManager.AppSettings["ReleaseProgramDataPath"], ConfigurationManager.AppSettings["ProgramDataFolderName"]);
@@ -303,11 +303,16 @@ namespace MediaBrowser.Common.Implementations
var path = Assembly.GetExecutingAssembly().Location;
path = Path.GetDirectoryName(path);
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ApplicationException("Unable to determine running assembly location");
+ }
+
programDataPath = Path.Combine(path, programDataPath);
programDataPath = Path.GetFullPath(programDataPath);
}
-
+
if (!Directory.Exists(programDataPath))
{
Directory.CreateDirectory(programDataPath);
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
index 8508fcdf50..f8edda203b 100644
--- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
@@ -1,6 +1,4 @@
-using System.Globalization;
-using System.Net.Http.Headers;
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Logging;
@@ -8,6 +6,7 @@ using MediaBrowser.Model.Net;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Cache;
@@ -214,21 +213,20 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{
var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".tmp");
- return GetTempFile(options, tempFile, 0);
+ return GetTempFile(options, tempFile);
}
protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
+
///
/// Gets the temp file.
///
/// The options.
/// The temp file.
- /// The resume count.
/// Task{System.String}.
/// progress
///
- private async Task GetTempFile(HttpRequestOptions options, string tempFile, int resumeCount)
+ private async Task GetTempFile(HttpRequestOptions options, string tempFile)
{
ValidateParams(options.Url, options.CancellationToken);
diff --git a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
index ec93fbd8eb..2917632b8e 100644
--- a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
+++ b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
@@ -52,10 +52,11 @@ namespace MediaBrowser.Common.Implementations.Logging
/// The level.
private void AddFileTarget(string path, LogSeverity level)
{
- var logFile = new FileTarget();
-
- logFile.FileName = path;
- logFile.Layout = "${longdate}, ${level}, ${logger}, ${message}";
+ var logFile = new FileTarget
+ {
+ FileName = path,
+ Layout = "${longdate}, ${level}, ${logger}, ${message}"
+ };
RemoveTarget("ApplicationLogFile");
logFile.Name = "ApplicationLogFile";
diff --git a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs
index d88b57be56..3c42d340b8 100644
--- a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs
+++ b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs
@@ -308,11 +308,7 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
//check if we have an IPv6 or ports
if (values.Length <= 2) // ipv4 or hostname
{
- if (values.Length == 1)
- //no port is specified, default
- port = defaultport;
- else
- port = GetPort(values[1]);
+ port = values.Length == 1 ? defaultport : GetPort(values[1]);
//try to use the address as IPv4, otherwise get hostname
if (!IPAddress.TryParse(values[0], out ipaddy))
diff --git a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkShares.cs b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkShares.cs
index e2a8275cff..d06c6b2e22 100644
--- a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkShares.cs
+++ b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkShares.cs
@@ -45,8 +45,11 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
///
/// Constructor
///
- ///
- ///
+ /// The server.
+ /// Name of the net.
+ /// The path.
+ /// Type of the share.
+ /// The remark.
public Share(string server, string netName, string path, ShareType shareType, string remark)
{
if (ShareType.Special == shareType && "IPC$" == netName)
@@ -423,9 +426,9 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
int nRet = 0;
ushort entriesRead, totalEntries;
- Type t = typeof(SHARE_INFO_50);
- int size = Marshal.SizeOf(t);
- ushort cbBuffer = (ushort)(MAX_SI50_ENTRIES * size);
+ var t = typeof(SHARE_INFO_50);
+ var size = Marshal.SizeOf(t);
+ var cbBuffer = (ushort)(MAX_SI50_ENTRIES * size);
//On Win9x, must allocate buffer before calling API
IntPtr pBuffer = Marshal.AllocHGlobal(cbBuffer);
@@ -448,16 +451,16 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
{
for (int i = 0, lpItem = pBuffer.ToInt32(); i < entriesRead; i++, lpItem += size)
{
- IntPtr pItem = new IntPtr(lpItem);
+ var pItem = new IntPtr(lpItem);
if (1 == level)
{
- SHARE_INFO_1_9x si = (SHARE_INFO_1_9x)Marshal.PtrToStructure(pItem, t);
+ var si = (SHARE_INFO_1_9x)Marshal.PtrToStructure(pItem, t);
shares.Add(si.NetName, string.Empty, si.ShareType, si.Remark);
}
else
{
- SHARE_INFO_50 si = (SHARE_INFO_50)Marshal.PtrToStructure(pItem, t);
+ var si = (SHARE_INFO_50)Marshal.PtrToStructure(pItem, t);
shares.Add(si.NetName, si.Path, si.ShareType, si.Remark);
}
}
@@ -542,7 +545,7 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
///
/// Constructor
///
- ///
+ /// The server.
public ShareCollection(string server)
{
_server = server;
@@ -598,9 +601,9 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
Share match = null;
- for (int i = 0; i < InnerList.Count; i++)
+ foreach (object t in InnerList)
{
- Share s = (Share)InnerList[i];
+ var s = (Share)t;
if (s.IsFileSystem && s.MatchesPath(path))
{
@@ -608,9 +611,9 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement
if (null == match)
match = s;
- // If this has a longer path,
- // and this is a disk share or match is a special share,
- // then this is a better match
+ // If this has a longer path,
+ // and this is a disk share or match is a special share,
+ // then this is a better match
else if (match.Path.Length < s.Path.Length)
{
if (ShareType.Disk == s.ShareType || ShareType.Disk != match.ShareType)
diff --git a/MediaBrowser.Common.Implementations/Properties/AssemblyInfo.cs b/MediaBrowser.Common.Implementations/Properties/AssemblyInfo.cs
index f9c3e0bd17..63a83e0034 100644
--- a/MediaBrowser.Common.Implementations/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Common.Implementations/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index f57d48f07a..94fb3ce86e 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -56,7 +56,17 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// The task manager.
/// The json serializer.
/// The logger.
- /// The server manager.
+ ///
+ /// scheduledTask
+ /// or
+ /// applicationPaths
+ /// or
+ /// taskManager
+ /// or
+ /// jsonSerializer
+ /// or
+ /// logger
+ ///
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, IJsonSerializer jsonSerializer, ILogger logger)
{
if (scheduledTask == null)
@@ -217,7 +227,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
{
get
{
- LazyInitializer.EnsureInitialized(ref _triggers, ref _triggersInitialized, ref _triggersSyncLock, () => LoadTriggers());
+ LazyInitializer.EnsureInitialized(ref _triggers, ref _triggersInitialized, ref _triggersSyncLock, LoadTriggers);
return _triggers;
}
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index c7a19c0c03..be3dd89f75 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.ScheduledTasks;
-using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -20,21 +19,14 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
///
/// The application paths.
private IApplicationPaths ApplicationPaths { get; set; }
- ///
- /// Gets or sets the logger.
- ///
- /// The logger.
- private ILogger Logger { get; set; }
///
/// Initializes a new instance of the class.
///
/// The app paths.
- /// The logger.
- public DeleteCacheFileTask(IApplicationPaths appPaths, ILogger logger)
+ public DeleteCacheFileTask(IApplicationPaths appPaths)
{
ApplicationPaths = appPaths;
- Logger = logger;
}
///
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
index faeb39735f..bcead321dc 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.ScheduledTasks;
-using MediaBrowser.Model.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -20,21 +19,14 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
///
/// The configuration manager.
private IConfigurationManager ConfigurationManager { get; set; }
- ///
- /// Gets or sets the logger.
- ///
- /// The logger.
- private ILogger Logger { get; set; }
///
/// Initializes a new instance of the class.
///
/// The configuration manager.
- /// The logger.
- public DeleteLogFileTask(IConfigurationManager configurationManager, ILogger logger)
+ public DeleteLogFileTask(IConfigurationManager configurationManager)
{
ConfigurationManager = configurationManager;
- Logger = logger;
}
///
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs
index a02f9dec6b..e860834eca 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/ReloadLoggerTask.cs
@@ -19,11 +19,6 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// The log manager.
private ILogManager LogManager { get; set; }
///
- /// Gets or sets the logger.
- ///
- /// The logger.
- private ILogger Logger { get; set; }
- ///
/// Gets or sets the configuration manager.
///
/// The configuration manager.
@@ -33,12 +28,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// Initializes a new instance of the class.
///
/// The logManager.
- /// The logger.
/// The configuration manager.
- public ReloadLoggerFileTask(ILogManager logManager, ILogger logger, IConfigurationManager configurationManager)
+ public ReloadLoggerFileTask(ILogManager logManager, IConfigurationManager configurationManager)
{
LogManager = logManager;
- Logger = logger;
ConfigurationManager = configurationManager;
}