Skip to content

Commit

Permalink
make more classes portable
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Feb 20, 2017

Verified

This commit was signed with the committer’s verified signature.
d2iq-dispatch D2iQ Dispatch
1 parent 6e4c9df commit 8c0bf13
Showing 30 changed files with 118 additions and 1,606 deletions.
2 changes: 1 addition & 1 deletion Emby.Common.Implementations/BaseApplicationHost.cs
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ public abstract class BaseApplicationHost<TApplicationPathsType> : IApplicationH
/// <value>The configuration manager.</value>
protected IConfigurationManager ConfigurationManager { get; private set; }

protected IFileSystem FileSystemManager { get; private set; }
public IFileSystem FileSystemManager { get; private set; }

protected IIsoManager IsoManager { get; private set; }

7 changes: 4 additions & 3 deletions Emby.Server.Core/ApplicationHost.cs
Original file line number Diff line number Diff line change
@@ -83,7 +83,6 @@
using Emby.Dlna.Ssdp;
using Emby.Server.Core;
using Emby.Server.Implementations.Activity;
using Emby.Server.Core.Configuration;
using Emby.Server.Implementations.Devices;
using Emby.Server.Implementations.FFMpeg;
using Emby.Server.Core.IO;
@@ -94,7 +93,6 @@
using Emby.Server.Implementations.Sync;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
using Emby.Server.Implementations.Connect;
using Emby.Server.Implementations.Dto;
using Emby.Server.Implementations.EntryPoints;
using Emby.Server.Implementations.FileOrganization;
@@ -134,6 +132,7 @@
using Emby.Server.Implementations.Migrations;
using MediaBrowser.Model.Diagnostics;
using Emby.Common.Implementations.Diagnostics;
using Emby.Server.Implementations.Configuration;

namespace Emby.Server.Core
{
@@ -526,6 +525,8 @@ private void PerformPostInitMigrations()
}
}

protected abstract IConnectManager CreateConnectManager();

/// <summary>
/// Registers resources that classes will depend on
/// </summary>
@@ -635,7 +636,7 @@ protected override async Task RegisterResources(IProgress<double> progress)
var encryptionManager = new EncryptionManager();
RegisterSingleInstance<IEncryptionManager>(encryptionManager);

ConnectManager = new ConnectManager(LogManager.GetLogger("ConnectManager"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager);
ConnectManager = CreateConnectManager();
RegisterSingleInstance(ConnectManager);

DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, LogManager.GetLogger("DeviceManager"), FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
16 changes: 16 additions & 0 deletions Emby.Server.Core/Logging/ConsoleLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;

namespace Emby.Server.Core.Logging
{
public class ConsoleLogger : IConsoleLogger
{
public void WriteLine(string message)
{
Console.WriteLine(message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.IO;
using System;
using System.IO;
using MediaBrowser.Common.Configuration;

namespace Emby.Common.Implementations
namespace Emby.Server.Implementations.AppBase
{
/// <summary>
/// Provides a base class to hold common application paths used by both the Ui and Server.
@@ -12,12 +13,15 @@ public abstract class BaseApplicationPaths : IApplicationPaths
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class.
/// </summary>
protected BaseApplicationPaths(string programDataPath, string appFolderPath)
protected BaseApplicationPaths(string programDataPath, string appFolderPath, Action<string> createDirectoryFn)
{
ProgramDataPath = programDataPath;
ProgramSystemPath = appFolderPath;
CreateDirectoryFn = createDirectoryFn;
}

protected Action<string> CreateDirectoryFn;

public string ProgramDataPath { get; private set; }

/// <summary>
@@ -41,7 +45,7 @@ public string DataPath
{
_dataDirectory = Path.Combine(ProgramDataPath, "data");

Directory.CreateDirectory(_dataDirectory);
CreateDirectoryFn(_dataDirectory);
}

return _dataDirectory;
@@ -148,7 +152,7 @@ public string CachePath
{
_cachePath = Path.Combine(ProgramDataPath, "cache");

Directory.CreateDirectory(_cachePath);
CreateDirectoryFn(_cachePath);
}

return _cachePath;
Original file line number Diff line number Diff line change
@@ -7,13 +7,12 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using Emby.Common.Implementations;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;

namespace Emby.Common.Implementations.Configuration
namespace Emby.Server.Implementations.AppBase
{
/// <summary>
/// Class BaseConfigurationManager
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;

namespace Emby.Common.Implementations.Configuration
namespace Emby.Server.Implementations.AppBase
{
/// <summary>
/// Class ConfigurationHelper
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Emby.Common.Implementations.Configuration;
using Emby.Server.Implementations.AppBase;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Controller;
@@ -17,7 +17,7 @@
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;

namespace Emby.Server.Core.Configuration
namespace Emby.Server.Implementations.Configuration
{
/// <summary>
/// Class ServerConfigurationManager
@@ -187,7 +187,7 @@ private void ValidateMetadataPath(ServerConfiguration newConfig)
// Validate
if (!FileSystem.DirectoryExists(newPath))
{
throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}

EnsureWriteAccess(newPath);
36 changes: 0 additions & 36 deletions Emby.Server.Implementations/Connect/ConnectData.cs

This file was deleted.

Loading

0 comments on commit 8c0bf13

Please sign in to comment.