diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-06-30 15:27:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-30 15:27:06 -0400 |
| commit | 2708df6cc28c48a89416bdfbdde7e78fc4227c62 (patch) | |
| tree | 9f892d6350a4d694c96985d679f622c0f7005278 /MediaBrowser.ServerApplication | |
| parent | d9406d48ca0231bc096aeadc595c30f0596c8dda (diff) | |
| parent | 5bdc96bb6a9b863980661e2d11c1ad00a02eb601 (diff) | |
Merge pull request #1899 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.ServerApplication')
9 files changed, 54 insertions, 194 deletions
diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index a92d92300..6d840c191 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 08c8a25b9..be381fe96 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 63d2cf30d..fb4fb86ff 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -256,10 +256,7 @@ namespace MediaBrowser.ServerApplication { Task.WaitAll(task); - task = InstallVcredistIfNeeded(_appHost, _logger); - Task.WaitAll(task); - - task = InstallFrameworkV46IfNeeded(_logger); + task = InstallVcredist2013IfNeeded(_appHost, _logger); Task.WaitAll(task); SystemEvents.SessionEnding += SystemEvents_SessionEnding; @@ -594,94 +591,7 @@ namespace MediaBrowser.ServerApplication } } - private static async Task InstallFrameworkV46IfNeeded(ILogger logger) - { - bool installFrameworkV46 = false; - - try - { - using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32) - .OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\")) - { - if (ndpKey != null && ndpKey.GetValue("Release") != null) - { - if ((int)ndpKey.GetValue("Release") <= 393295) - { - //Found framework V4, but not yet V4.6 - installFrameworkV46 = true; - } - } - else - { - //Nothing found in the registry for V4 - installFrameworkV46 = true; - } - } - } - catch (Exception ex) - { - logger.ErrorException("Error getting .NET Framework version", ex); - } - - _logger.Info(".NET Framework 4.6 found: {0}", !installFrameworkV46); - - if (installFrameworkV46) - { - try - { - await InstallFrameworkV46().ConfigureAwait(false); - } - catch (Exception ex) - { - logger.ErrorException("Error installing .NET Framework version 4.6", ex); - } - } - } - - private static async Task InstallFrameworkV46() - { - var httpClient = _appHost.HttpClient; - - var tmp = await httpClient.GetTempFile(new HttpRequestOptions - { - Url = "https://github.com/MediaBrowser/Emby.Resources/raw/master/netframeworkV46/NDP46-KB3045560-Web.exe", - Progress = new Progress<double>() - - }).ConfigureAwait(false); - - var exePath = Path.ChangeExtension(tmp, ".exe"); - File.Copy(tmp, exePath); - - var startInfo = new ProcessStartInfo - { - FileName = exePath, - - CreateNoWindow = true, - WindowStyle = ProcessWindowStyle.Hidden, - Verb = "runas", - ErrorDialog = false, - Arguments = "/q /norestart" - }; - - - _logger.Info("Running {0}", startInfo.FileName); - - using (var process = Process.Start(startInfo)) - { - process.WaitForExit(); - //process.ExitCode - /* - 0 --> Installation completed successfully. - 1602 --> The user canceled installation. - 1603 --> A fatal error occurred during installation. - 1641 --> A restart is required to complete the installation. This message indicates success. - 3010 --> A restart is required to complete the installation. This message indicates success. - 5100 --> The user's computer does not meet system requirements. - */ - } - } - - private static async Task InstallVcredistIfNeeded(ApplicationHost appHost, ILogger logger) + private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger) { try { @@ -695,7 +605,7 @@ namespace MediaBrowser.ServerApplication try { - await InstallVcredist().ConfigureAwait(false); + await InstallVcredist2013().ConfigureAwait(false); } catch (Exception ex) { @@ -703,13 +613,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 +645,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 366d4b608..fcd6f7faf 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -83,8 +83,8 @@ <Reference Include="System.Configuration" /> <Reference Include="System.Configuration.Install" /> <Reference Include="System.Core" /> - <Reference Include="System.Data.SQLite, Version=1.0.101.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Data.SQLite.Core.1.0.101.0\lib\net46\System.Data.SQLite.dll</HintPath> + <Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Data.SQLite.Core.1.0.102.0\lib\net46\System.Data.SQLite.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System.Drawing" /> @@ -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" /> @@ -1109,12 +1112,12 @@ <PostBuildEvent> </PostBuildEvent> </PropertyGroup> - <Import Project="..\packages\System.Data.SQLite.Core.1.0.101.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net46\System.Data.SQLite.Core.targets')" /> + <Import Project="..\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> </PropertyGroup> - <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.101.0\build\net46\System.Data.SQLite.Core.targets'))" /> + <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\System.Data.SQLite.Core.targets'))" /> </Target> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/MediaBrowser.ServerApplication/Native/DbConnector.cs b/MediaBrowser.ServerApplication/Native/DbConnector.cs new file mode 100644 index 000000000..9aaa96a80 --- /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 1cde2ea13..000000000 --- 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/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index c99b0f9af..d8b2720c2 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -10,6 +10,7 @@ using System.Reflection; using System.Windows.Forms; using CommonIO; using MediaBrowser.Controller.Power; +using MediaBrowser.Model.System; using MediaBrowser.Server.Implementations.Persistence; using MediaBrowser.Server.Startup.Common.FFMpeg; using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem; @@ -53,7 +54,7 @@ namespace MediaBrowser.ServerApplication.Native return new NativeEnvironment { OperatingSystem = OperatingSystem.Windows, - SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X86_X64 : Architecture.X86, + SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86, OperatingSystemVersionString = System.Environment.OSVersion.VersionString }; } @@ -158,10 +159,7 @@ namespace MediaBrowser.ServerApplication.Native info.FFMpegFilename = "ffmpeg.exe"; info.FFProbeFilename = "ffprobe.exe"; - info.Version = "20160410"; - info.ArchiveType = "7z"; - info.IsEmbedded = false; - info.DownloadUrls = GetDownloadUrls(); + info.Version = "0"; return info; } @@ -206,23 +204,5 @@ namespace MediaBrowser.ServerApplication.Native { ((Process)sender).Dispose(); } - - private string[] GetDownloadUrls() - { - switch (Environment.SystemArchitecture) - { - case Architecture.X86_X64: - return new[] - { - "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20160409-git-0c90b2e-win64-static.7z" - }; - case Architecture.X86: - return new[] - { - "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20160409-git-0c90b2e-win32-static.7z" - }; - } - return new string[] { }; - } } -} +}
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs index cc9061fcd..ed60de9d2 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> diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 2d4baae25..a573c6fd9 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -3,5 +3,5 @@ <package id="CommonIO" version="1.0.0.9" targetFramework="net45" /> <package id="ImageMagickSharp" version="1.0.0.18" targetFramework="net45" /> <package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" /> - <package id="System.Data.SQLite.Core" version="1.0.101.0" targetFramework="net46" /> + <package id="System.Data.SQLite.Core" version="1.0.102.0" targetFramework="net46" /> </packages>
\ No newline at end of file |
