Rename and rework entry point

This commit is contained in:
Bond_009
2019-01-01 16:27:11 +01:00
committed by Vasily
parent e094c45abb
commit 75efe9cf0a
25 changed files with 461 additions and 756 deletions

View File

@@ -416,7 +416,6 @@ namespace Emby.Server.Implementations
ConfigurationManager = GetConfigurationManager();
// Initialize this early in case the -v command line option is used
Logger = LoggerFactory.CreateLogger("App");
StartupOptions = options;
@@ -467,7 +466,7 @@ namespace Emby.Server.Implementations
{
get
{
return _version ?? (_version = GetType().GetTypeInfo().Assembly.GetName().Version);
return _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
}
}
@@ -1772,7 +1771,7 @@ namespace Emby.Server.Implementations
return list.ToList();
}
protected abstract List<Assembly> GetAssembliesWithPartsInternal();
protected abstract IEnumerable<Assembly> GetAssembliesWithPartsInternal();
/// <summary>
/// Gets the plugin assemblies.

View File

@@ -1,12 +1,12 @@
using System;
using System.IO;
using MediaBrowser.Model.System;
using System.Runtime.InteropServices;
namespace Emby.Server.Implementations.EnvironmentInfo
{
public class EnvironmentInfo : IEnvironmentInfo
{
private Architecture? _customArchitecture;
private MediaBrowser.Model.System.OperatingSystem? _customOperatingSystem;
public virtual MediaBrowser.Model.System.OperatingSystem OperatingSystem
@@ -60,22 +60,7 @@ namespace Emby.Server.Implementations.EnvironmentInfo
}
}
public Architecture SystemArchitecture
{
get
{
if (_customArchitecture.HasValue)
{
return _customArchitecture.Value;
}
return Environment.Is64BitOperatingSystem ? MediaBrowser.Model.System.Architecture.X64 : MediaBrowser.Model.System.Architecture.X86;
}
set
{
_customArchitecture = value;
}
}
public Architecture SystemArchitecture { get; set; }
public string GetEnvironmentVariable(string name)
{

View File

@@ -1,33 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Emby.Server.Implementations
{
public class StartupOptions
{
private readonly List<string> _options;
private readonly string[] _options;
public StartupOptions(string[] commandLineArgs)
{
_options = commandLineArgs.ToList();
_options = commandLineArgs;
}
public bool ContainsOption(string option)
{
return _options.Contains(option, StringComparer.OrdinalIgnoreCase);
}
=> _options.Contains(option, StringComparer.OrdinalIgnoreCase);
public string GetOption(string name)
{
var index = _options.IndexOf(name);
int index = Array.IndexOf(_options, name);
if (index != -1)
if (index == -1)
{
return _options.ElementAtOrDefault(index + 1);
return null;
}
return null;
return _options.ElementAtOrDefault(index + 1);
}
}
}