diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-16 14:10:58 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-16 14:10:58 -0400 |
| commit | 4f791d6ee1712439c8485260221a8c0aa64760f2 (patch) | |
| tree | 88bd1f7e13bfda15644a054cd205f64753d25275 /MediaBrowser.ServerApplication | |
| parent | d9406d48ca0231bc096aeadc595c30f0596c8dda (diff) | |
| parent | 7498b7b5b7e2f7ddf380df1f47421d26c8171418 (diff) | |
Merge branch 'dev'
Diffstat (limited to 'MediaBrowser.ServerApplication')
7 files changed, 45 insertions, 75 deletions
diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index a92d923007..6d840c1910 100644 --- a/MediaBrowser.ServerApplication/App.config +++ b/MediaBrowser.ServerApplication/App.config @@ -52,6 +52,7 @@ <bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0"/> </dependentAssembly> </assemblyBinding> + <enforceFIPSPolicy enabled="false"/> </runtime> <system.web> <membership defaultProvider="ClientAuthenticationMembershipProvider"> diff --git a/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs b/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs index 08c8a25b9d..be381fe963 100644 --- a/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs +++ b/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs @@ -25,7 +25,7 @@ namespace MediaBrowser.ServerApplication Description = "The windows background service for Emby Server.", // Will ensure the network is available - ServicesDependedOn = new[] { "LanmanServer", "Tcpip" } + ServicesDependedOn = new[] { "LanmanServer", "EventLog", "Tcpip", "http" } }; // Microsoft didn't add the ability to add a diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 63d2cf30d4..3a3b10188a 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -256,7 +256,7 @@ namespace MediaBrowser.ServerApplication { Task.WaitAll(task); - task = InstallVcredistIfNeeded(_appHost, _logger); + task = InstallVcredist2013IfNeeded(_appHost, _logger); Task.WaitAll(task); task = InstallFrameworkV46IfNeeded(_logger); @@ -681,7 +681,7 @@ namespace MediaBrowser.ServerApplication } } - private static async Task InstallVcredistIfNeeded(ApplicationHost appHost, ILogger logger) + private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger) { try { @@ -695,7 +695,7 @@ namespace MediaBrowser.ServerApplication try { - await InstallVcredist().ConfigureAwait(false); + await InstallVcredist2013().ConfigureAwait(false); } catch (Exception ex) { @@ -703,13 +703,13 @@ namespace MediaBrowser.ServerApplication } } - private async static Task InstallVcredist() + private async static Task InstallVcredist2013() { var httpClient = _appHost.HttpClient; var tmp = await httpClient.GetTempFile(new HttpRequestOptions { - Url = GetVcredistUrl(), + Url = GetVcredist2013Url(), Progress = new Progress<double>() }).ConfigureAwait(false); @@ -735,7 +735,7 @@ namespace MediaBrowser.ServerApplication } } - private static string GetVcredistUrl() + private static string GetVcredist2013Url() { if (Environment.Is64BitProcess) { diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 366d4b6083..35660b2b1f 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -97,6 +97,9 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="..\MediaBrowser.Server.Implementations\Persistence\SqliteExtensions.cs"> + <Link>Native\SqliteExtensions.cs</Link> + </Compile> <Compile Include="..\SharedVersion.cs"> <Link>Properties\SharedVersion.cs</Link> </Compile> @@ -114,7 +117,7 @@ </Compile> <Compile Include="MainStartup.cs" /> <Compile Include="Native\LnkShortcutHandler.cs" /> - <Compile Include="Native\SqliteExtensions.cs" /> + <Compile Include="Native\DbConnector.cs" /> <Compile Include="Native\Standby.cs" /> <Compile Include="Native\ServerAuthorization.cs" /> <Compile Include="Native\WindowsApp.cs" /> diff --git a/MediaBrowser.ServerApplication/Native/DbConnector.cs b/MediaBrowser.ServerApplication/Native/DbConnector.cs new file mode 100644 index 0000000000..9aaa96a804 --- /dev/null +++ b/MediaBrowser.ServerApplication/Native/DbConnector.cs @@ -0,0 +1,24 @@ +using System; +using System.Data; +using System.Data.SQLite; +using System.Threading.Tasks; +using MediaBrowser.Model.Logging; +using MediaBrowser.Server.Implementations.Persistence; + +namespace MediaBrowser.ServerApplication.Native +{ + public class DbConnector : IDbConnector + { + private readonly ILogger _logger; + + public DbConnector(ILogger logger) + { + _logger = logger; + } + + public Task<IDbConnection> Connect(string dbPath, bool isReadOnly, bool enablePooling = false, int? cacheSize = null) + { + return SqliteExtensions.ConnectToDb(dbPath, isReadOnly, enablePooling, cacheSize, _logger); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/Native/SqliteExtensions.cs b/MediaBrowser.ServerApplication/Native/SqliteExtensions.cs deleted file mode 100644 index 1cde2ea139..0000000000 --- a/MediaBrowser.ServerApplication/Native/SqliteExtensions.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Data; -using System.Data.SQLite; -using System.Threading.Tasks; -using MediaBrowser.Model.Logging; -using MediaBrowser.Server.Implementations.Persistence; - -namespace MediaBrowser.ServerApplication.Native -{ - /// <summary> - /// Class SQLiteExtensions - /// </summary> - static class SqliteExtensions - { - /// <summary> - /// Connects to db. - /// </summary> - /// <param name="dbPath">The db path.</param> - /// <param name="logger">The logger.</param> - /// <returns>Task{IDbConnection}.</returns> - /// <exception cref="System.ArgumentNullException">dbPath</exception> - public static async Task<IDbConnection> ConnectToDb(string dbPath, ILogger logger) - { - if (string.IsNullOrEmpty(dbPath)) - { - throw new ArgumentNullException("dbPath"); - } - - logger.Info("Sqlite {0} opening {1}", SQLiteConnection.SQLiteVersion, dbPath); - - var connectionstr = new SQLiteConnectionStringBuilder - { - PageSize = 4096, - CacheSize = 2000, - SyncMode = SynchronizationModes.Full, - DataSource = dbPath, - JournalMode = SQLiteJournalModeEnum.Wal - }; - - var connection = new SQLiteConnection(connectionstr.ConnectionString); - - await connection.OpenAsync().ConfigureAwait(false); - - return connection; - } - } - - public class DbConnector : IDbConnector - { - private readonly ILogger _logger; - - public DbConnector(ILogger logger) - { - _logger = logger; - } - - public Task<IDbConnection> Connect(string dbPath) - { - return SqliteExtensions.ConnectToDb(dbPath, _logger); - } - } -}
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs index cc9061fcd0..ed60de9d20 100644 --- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs +++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs @@ -89,19 +89,21 @@ namespace MediaBrowser.ServerApplication.Networking /// </summary> /// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER /// PC's in the Domain</returns> - private IEnumerable<string> GetNetworkDevicesInternal() + private List<string> GetNetworkDevicesInternal() { //local fields const int MAX_PREFERRED_LENGTH = -1; var SV_TYPE_WORKSTATION = 1; var SV_TYPE_SERVER = 2; - var buffer = IntPtr.Zero; - var tmpBuffer = IntPtr.Zero; + IntPtr buffer = IntPtr.Zero; + IntPtr tmpBuffer = IntPtr.Zero; var entriesRead = 0; var totalEntries = 0; var resHandle = 0; var sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100)); + var returnList = new List<string>(); + try { //call the DllImport : NetServerEnum with all its required parameters @@ -118,7 +120,7 @@ namespace MediaBrowser.ServerApplication.Networking //get pointer to, Pointer to the buffer that received the data from //the call to NetServerEnum. Must ensure to use correct size of //STRUCTURE to ensure correct location in memory is pointed to - tmpBuffer = new IntPtr((int)buffer + (i * sizeofINFO)); + tmpBuffer = new IntPtr((Int64)buffer + (i * sizeofINFO)); //Have now got a pointer to the list of SV_TYPE_WORKSTATION and //SV_TYPE_SERVER PC's, which is unmanaged memory //Needs to Marshal data from an unmanaged block of memory to a @@ -129,7 +131,7 @@ namespace MediaBrowser.ServerApplication.Networking //add the PC names to the ArrayList if (!string.IsNullOrEmpty(svrInfo.sv100_name)) { - yield return svrInfo.sv100_name; + returnList.Add(svrInfo.sv100_name); } } } @@ -140,6 +142,8 @@ namespace MediaBrowser.ServerApplication.Networking //the memory that the NetApiBufferAllocate function allocates NativeMethods.NetApiBufferFree(buffer); } + + return returnList; } /// <summary> |
