aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/ApplicationPathHelper.cs51
-rw-r--r--MediaBrowser.ServerApplication/ImageEncoderHelper.cs1
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs176
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj48
-rw-r--r--MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs332
-rw-r--r--MediaBrowser.ServerApplication/Native/LoopUtil.cs1
-rw-r--r--MediaBrowser.ServerApplication/Networking/NetworkManager.cs2
-rw-r--r--MediaBrowser.ServerApplication/WindowsAppHost.cs7
-rw-r--r--MediaBrowser.ServerApplication/packages.config7
-rw-r--r--MediaBrowser.ServerApplication/x64/libSkiaSharp.dll.REMOVED.git-id1
10 files changed, 489 insertions, 137 deletions
diff --git a/MediaBrowser.ServerApplication/ApplicationPathHelper.cs b/MediaBrowser.ServerApplication/ApplicationPathHelper.cs
new file mode 100644
index 000000000..e8dad6213
--- /dev/null
+++ b/MediaBrowser.ServerApplication/ApplicationPathHelper.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Configuration;
+using System.IO;
+
+namespace MediaBrowser.ServerApplication
+{
+ public static class ApplicationPathHelper
+ {
+ /// <summary>
+ /// Gets the path to the application's ProgramDataFolder
+ /// </summary>
+ /// <returns>System.String.</returns>
+ public static string GetProgramDataPath(string applicationPath)
+ {
+ var useDebugPath = false;
+
+#if DEBUG
+ useDebugPath = true;
+#endif
+
+ var programDataPath = useDebugPath ?
+ ConfigurationManager.AppSettings["DebugProgramDataPath"] :
+ ConfigurationManager.AppSettings["ReleaseProgramDataPath"];
+
+ programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
+
+ programDataPath = programDataPath
+ .Replace('/', Path.DirectorySeparatorChar)
+ .Replace('\\', Path.DirectorySeparatorChar);
+
+ // If it's a relative path, e.g. "..\"
+ if (!Path.IsPathRooted(programDataPath))
+ {
+ var path = Path.GetDirectoryName(applicationPath);
+
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ApplicationException("Unable to determine running assembly location");
+ }
+
+ programDataPath = Path.Combine(path, programDataPath);
+
+ programDataPath = Path.GetFullPath(programDataPath);
+ }
+
+ Directory.CreateDirectory(programDataPath);
+
+ return programDataPath;
+ }
+ }
+}
diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
index 77e6c65fe..0e99bbbad 100644
--- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
+++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs
@@ -1,6 +1,5 @@
using System;
using Emby.Drawing;
-using Emby.Drawing.ImageMagick;
using Emby.Drawing.Skia;
using Emby.Server.Core;
using Emby.Server.Implementations;
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index bc38476ca..31acd1820 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Logging;
-using MediaBrowser.Server.Implementations;
using MediaBrowser.Server.Startup.Common;
using MediaBrowser.ServerApplication.Native;
using MediaBrowser.ServerApplication.Splash;
@@ -17,21 +16,17 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
-using Emby.Common.Implementations.EnvironmentInfo;
-using Emby.Common.Implementations.IO;
-using Emby.Common.Implementations.Logging;
-using Emby.Common.Implementations.Networking;
using Emby.Server.Core.Cryptography;
using Emby.Drawing;
using Emby.Server.Core;
-using Emby.Server.Core.IO;
-using Emby.Server.Core.Logging;
using Emby.Server.Implementations;
using Emby.Server.Implementations.Browser;
+using Emby.Server.Implementations.EnvironmentInfo;
using Emby.Server.Implementations.IO;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
+using SystemEvents = Emby.Server.Implementations.SystemEvents;
namespace MediaBrowser.ServerApplication
{
@@ -77,69 +72,71 @@ namespace MediaBrowser.ServerApplication
var appPaths = CreateApplicationPaths(ApplicationPath, IsRunningAsService);
- var logManager = new NlogManager(appPaths.LogDirectoryPath, "server");
- logManager.ReloadLogger(LogSeverity.Debug);
- logManager.AddConsoleOutput();
+ using (var logManager = new SimpleLogManager(appPaths.LogDirectoryPath, "server"))
+ {
+ logManager.ReloadLogger(LogSeverity.Debug);
+ logManager.AddConsoleOutput();
- var logger = _logger = logManager.GetLogger("Main");
+ var logger = _logger = logManager.GetLogger("Main");
- ApplicationHost.LogEnvironmentInfo(logger, appPaths, true);
+ ApplicationHost.LogEnvironmentInfo(logger, appPaths, true);
- // Install directly
- if (options.ContainsOption("-installservice"))
- {
- logger.Info("Performing service installation");
- InstallService(ApplicationPath, logger);
- return;
- }
+ // Install directly
+ if (options.ContainsOption("-installservice"))
+ {
+ logger.Info("Performing service installation");
+ InstallService(ApplicationPath, logger);
+ return;
+ }
- // Restart with admin rights, then install
- if (options.ContainsOption("-installserviceasadmin"))
- {
- logger.Info("Performing service installation");
- RunServiceInstallation(ApplicationPath);
- return;
- }
+ // Restart with admin rights, then install
+ if (options.ContainsOption("-installserviceasadmin"))
+ {
+ logger.Info("Performing service installation");
+ RunServiceInstallation(ApplicationPath);
+ return;
+ }
- // Uninstall directly
- if (options.ContainsOption("-uninstallservice"))
- {
- logger.Info("Performing service uninstallation");
- UninstallService(ApplicationPath, logger);
- return;
- }
+ // Uninstall directly
+ if (options.ContainsOption("-uninstallservice"))
+ {
+ logger.Info("Performing service uninstallation");
+ UninstallService(ApplicationPath, logger);
+ return;
+ }
- // Restart with admin rights, then uninstall
- if (options.ContainsOption("-uninstallserviceasadmin"))
- {
- logger.Info("Performing service uninstallation");
- RunServiceUninstallation(ApplicationPath);
- return;
- }
+ // Restart with admin rights, then uninstall
+ if (options.ContainsOption("-uninstallserviceasadmin"))
+ {
+ logger.Info("Performing service uninstallation");
+ RunServiceUninstallation(ApplicationPath);
+ return;
+ }
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- RunServiceInstallationIfNeeded(ApplicationPath);
+ RunServiceInstallationIfNeeded(ApplicationPath);
- if (IsAlreadyRunning(ApplicationPath, currentProcess))
- {
- logger.Info("Shutting down because another instance of Emby Server is already running.");
- return;
- }
+ if (IsAlreadyRunning(ApplicationPath, currentProcess))
+ {
+ logger.Info("Shutting down because another instance of Emby Server is already running.");
+ return;
+ }
- if (PerformUpdateIfNeeded(appPaths, logger))
- {
- logger.Info("Exiting to perform application update.");
- return;
- }
+ if (PerformUpdateIfNeeded(appPaths, logger))
+ {
+ logger.Info("Exiting to perform application update.");
+ return;
+ }
- try
- {
- RunApplication(appPaths, logManager, IsRunningAsService, options);
- }
- finally
- {
- OnServiceShutdown();
+ try
+ {
+ RunApplication(appPaths, logManager, IsRunningAsService, options);
+ }
+ finally
+ {
+ OnServiceShutdown();
+ }
}
}
@@ -201,30 +198,37 @@ namespace MediaBrowser.ServerApplication
private static bool IsAlreadyRunningAsService(string applicationPath)
{
- var serviceName = BackgroundService.GetExistingServiceName();
+ try
+ {
+ var serviceName = BackgroundService.GetExistingServiceName();
- WqlObjectQuery wqlObjectQuery = new WqlObjectQuery(string.Format("SELECT * FROM Win32_Service WHERE State = 'Running' AND Name = '{0}'", serviceName));
- ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(wqlObjectQuery);
- ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get();
+ WqlObjectQuery wqlObjectQuery = new WqlObjectQuery(string.Format("SELECT * FROM Win32_Service WHERE State = 'Running' AND Name = '{0}'", serviceName));
+ ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(wqlObjectQuery);
+ ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get();
- foreach (ManagementObject managementObject in managementObjectCollection)
- {
- var obj = managementObject.GetPropertyValue("PathName");
- if (obj == null)
+ foreach (ManagementObject managementObject in managementObjectCollection)
{
- continue;
- }
- var path = obj.ToString();
+ var obj = managementObject.GetPropertyValue("PathName");
+ if (obj == null)
+ {
+ continue;
+ }
+ var path = obj.ToString();
- _logger.Info("Service path: {0}", path);
- // Need to use indexOf instead of equality because the path will have the full service command line
- if (path.IndexOf(applicationPath, StringComparison.OrdinalIgnoreCase) != -1)
- {
- _logger.Info("The windows service is already running");
- MessageBox.Show("Emby Server is already running as a Windows Service. Only one instance is allowed at a time. To run as a tray icon, shut down the Windows Service.");
- return true;
+ _logger.Info("Service path: {0}", path);
+ // Need to use indexOf instead of equality because the path will have the full service command line
+ if (path.IndexOf(applicationPath, StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ _logger.Info("The windows service is already running");
+ MessageBox.Show("Emby Server is already running as a Windows Service. Only one instance is allowed at a time. To run as a tray icon, shut down the Windows Service.");
+ return true;
+ }
}
}
+ catch (COMException)
+ {
+ // Catch errors thrown due to WMI not being initialized
+ }
return false;
}
@@ -241,18 +245,16 @@ namespace MediaBrowser.ServerApplication
var resourcesPath = Path.GetDirectoryName(applicationPath);
- Action<string> createDirectoryFn = s => Directory.CreateDirectory(s);
-
if (runAsService)
{
var systemPath = Path.GetDirectoryName(applicationPath);
var programDataPath = Path.GetDirectoryName(systemPath);
- return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath, createDirectoryFn);
+ return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath);
}
- return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath, createDirectoryFn);
+ return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath);
}
/// <summary>
@@ -320,11 +322,8 @@ namespace MediaBrowser.ServerApplication
"emby.windows.zip",
environmentInfo,
new NullImageEncoder(),
- new Server.Startup.Common.SystemEvents(logManager.GetLogger("SystemEvents")),
- new RecyclableMemoryStreamProvider(),
- new Networking.NetworkManager(logManager.GetLogger("NetworkManager")),
- GenerateCertificate,
- () => Environment.UserDomainName);
+ new SystemEvents(logManager.GetLogger("SystemEvents")),
+ new Networking.NetworkManager(logManager.GetLogger("NetworkManager")));
var initProgress = new Progress<double>();
@@ -371,11 +370,6 @@ namespace MediaBrowser.ServerApplication
}
}
- private static void GenerateCertificate(string certPath, string certHost, string certPassword)
- {
- CertificateGenerator.CreateSelfSignCertificatePfx(certPath, certHost, certPassword, _logger);
- }
-
private static ServerNotifyIcon _serverNotifyIcon;
private static TaskScheduler _mainTaskScheduler;
private static void ShowTrayIcon()
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 591ac0fba..23db82cf1 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -73,10 +73,6 @@
<Reference Include="Emby.Server.Sync">
<HintPath>..\ThirdParty\emby\Emby.Server.Sync.dll</HintPath>
</Reference>
- <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
- <HintPath>..\packages\NLog.4.4.11\lib\net45\NLog.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="ServiceStack.Text, Version=4.5.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll</HintPath>
<Private>True</Private>
@@ -89,15 +85,13 @@
<HintPath>..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp, Version=1.58.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
- <HintPath>..\packages\SkiaSharp.1.58.0\lib\net45\SkiaSharp.dll</HintPath>
+ <HintPath>..\packages\SkiaSharp.1.58.1\lib\net45\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
- <HintPath>..\packages\SQLitePCLRaw.core.1.1.7\lib\net45\SQLitePCLRaw.core.dll</HintPath>
- <Private>True</Private>
+ <HintPath>..\packages\SQLitePCLRaw.core.1.1.8\lib\net45\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=62684c7b4f184e3f, processorArchitecture=MSIL">
- <HintPath>..\packages\SQLitePCLRaw.provider.sqlite3.net45.1.1.7\lib\net45\SQLitePCLRaw.provider.sqlite3.dll</HintPath>
- <Private>True</Private>
+ <HintPath>..\packages\SQLitePCLRaw.provider.sqlite3.net45.1.1.8\lib\net45\SQLitePCLRaw.provider.sqlite3.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@@ -119,6 +113,7 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
+ <Compile Include="ApplicationPathHelper.cs" />
<Compile Include="BackgroundService.cs">
<SubType>Component</SubType>
</Compile>
@@ -127,6 +122,7 @@
</Compile>
<Compile Include="ImageEncoderHelper.cs" />
<Compile Include="MainStartup.cs" />
+ <Compile Include="Native\LnkShortcutHandler.cs" />
<Compile Include="Native\LoopUtil.cs" />
<Compile Include="Native\PowerManagement.cs" />
<Compile Include="Native\Standby.cs" />
@@ -166,6 +162,14 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <Content Include="..\packages\SkiaSharp.1.58.1\runtimes\win7-x64\native\libSkiaSharp.dll">
+ <Link>x64\libSkiaSharp.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\packages\SkiaSharp.1.58.1\runtimes\win7-x86\native\libSkiaSharp.dll">
+ <Link>x86\libSkiaSharp.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
<Content Include="..\Tools\Installation\MediaBrowser.InstallUtil.dll">
<Link>MediaBrowser.InstallUtil.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -178,17 +182,11 @@
<Link>MediaBrowser.Updater.exe</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="x64\libSkiaSharp.dll">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="x64\sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Icon.ico" />
<Content Include="Resources\Images\mb3logo800.png" />
- <Content Include="x86\libSkiaSharp.dll">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
<Content Include="x86\sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -202,18 +200,10 @@
<Project>{713f42b5-878e-499d-a878-e4c652b1d5e8}</Project>
<Name>DvdLib</Name>
</ProjectReference>
- <ProjectReference Include="..\Emby.Common.Implementations\Emby.Common.Implementations.csproj">
- <Project>{1e37a338-9f57-4b70-bd6d-bb9c591e319b}</Project>
- <Name>Emby.Common.Implementations</Name>
- </ProjectReference>
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj">
<Project>{805844ab-e92f-45e6-9d99-4f6d48d129a5}</Project>
<Name>Emby.Dlna</Name>
</ProjectReference>
- <ProjectReference Include="..\Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj">
- <Project>{6cfee013-6e7c-432b-ac37-cabf0880c69a}</Project>
- <Name>Emby.Drawing.ImageMagick</Name>
- </ProjectReference>
<ProjectReference Include="..\Emby.Drawing.Skia\Emby.Drawing.Skia.csproj">
<Project>{2312da6d-ff86-4597-9777-bceec32d96dd}</Project>
<Name>Emby.Drawing.Skia</Name>
@@ -226,10 +216,6 @@
<Project>{89ab4548-770d-41fd-a891-8daff44f452c}</Project>
<Name>Emby.Photos</Name>
</ProjectReference>
- <ProjectReference Include="..\Emby.Server.Core\Emby.Server.Core.csproj">
- <Project>{776b9f0c-5195-45e3-9a36-1cc1f0d8e0b0}</Project>
- <Name>Emby.Server.Core</Name>
- </ProjectReference>
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj">
<Project>{e383961b-9356-4d5d-8233-9a1079d03055}</Project>
<Name>Emby.Server.Implementations</Name>
@@ -250,10 +236,6 @@
<Project>{7ef9f3e0-697d-42f3-a08f-19deb5f84392}</Project>
<Name>MediaBrowser.LocalMetadata</Name>
</ProjectReference>
- <ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj">
- <Project>{0bd82fa6-eb8a-4452-8af5-74f9c3849451}</Project>
- <Name>MediaBrowser.MediaEncoding</Name>
- </ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
@@ -262,10 +244,6 @@
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
<Name>MediaBrowser.Providers</Name>
</ProjectReference>
- <ProjectReference Include="..\MediaBrowser.Server.Implementations\MediaBrowser.Server.Implementations.csproj">
- <Project>{2e781478-814d-4a48-9d80-bff206441a65}</Project>
- <Name>MediaBrowser.Server.Implementations</Name>
- </ProjectReference>
<ProjectReference Include="..\MediaBrowser.WebDashboard\MediaBrowser.WebDashboard.csproj">
<Project>{5624b7b5-b5a7-41d8-9f10-cc5611109619}</Project>
<Name>MediaBrowser.WebDashboard</Name>
diff --git a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
new file mode 100644
index 000000000..e53a79670
--- /dev/null
+++ b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
@@ -0,0 +1,332 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using System.Text;
+using MediaBrowser.Model.IO;
+
+namespace MediaBrowser.ServerApplication.Native
+{
+ public class LnkShortcutHandler :IShortcutHandler
+ {
+ public string Extension
+ {
+ get { return ".lnk"; }
+ }
+
+ public string Resolve(string shortcutPath)
+ {
+ var link = new ShellLink();
+ ((IPersistFile)link).Load(shortcutPath, NativeMethods.STGM_READ);
+ // ((IShellLinkW)link).Resolve(hwnd, 0)
+ var sb = new StringBuilder(NativeMethods.MAX_PATH);
+ WIN32_FIND_DATA data;
+ ((IShellLinkW)link).GetPath(sb, sb.Capacity, out data, 0);
+ return sb.ToString();
+ }
+
+ public void Create(string shortcutPath, string targetPath)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// Class NativeMethods
+ /// </summary>
+ public static class NativeMethods
+ {
+ /// <summary>
+ /// The MA x_ PATH
+ /// </summary>
+ public const int MAX_PATH = 260;
+ /// <summary>
+ /// The MA x_ ALTERNATE
+ /// </summary>
+ public const int MAX_ALTERNATE = 14;
+ /// <summary>
+ /// The INVALI d_ HANDL e_ VALUE
+ /// </summary>
+ public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
+ /// <summary>
+ /// The STG m_ READ
+ /// </summary>
+ public const int STGM_READ = 0;
+ }
+
+ /// <summary>
+ /// Struct FILETIME
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct FILETIME
+ {
+ /// <summary>
+ /// The dw low date time
+ /// </summary>
+ public uint dwLowDateTime;
+ /// <summary>
+ /// The dw high date time
+ /// </summary>
+ public uint dwHighDateTime;
+ }
+
+ /// <summary>
+ /// Struct WIN32_FIND_DATA
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct WIN32_FIND_DATA
+ {
+ /// <summary>
+ /// The dw file attributes
+ /// </summary>
+ public FileAttributes dwFileAttributes;
+ /// <summary>
+ /// The ft creation time
+ /// </summary>
+ public FILETIME ftCreationTime;
+ /// <summary>
+ /// The ft last access time
+ /// </summary>
+ public FILETIME ftLastAccessTime;
+ /// <summary>
+ /// The ft last write time
+ /// </summary>
+ public FILETIME ftLastWriteTime;
+ /// <summary>
+ /// The n file size high
+ /// </summary>
+ public int nFileSizeHigh;
+ /// <summary>
+ /// The n file size low
+ /// </summary>
+ public int nFileSizeLow;
+ /// <summary>
+ /// The dw reserved0
+ /// </summary>
+ public int dwReserved0;
+ /// <summary>
+ /// The dw reserved1
+ /// </summary>
+ public int dwReserved1;
+
+ /// <summary>
+ /// The c file name
+ /// </summary>
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_PATH)]
+ public string cFileName;
+
+ /// <summary>
+ /// This will always be null when FINDEX_INFO_LEVELS = basic
+ /// </summary>
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_ALTERNATE)]
+ public string cAlternate;
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ /// <value>The path.</value>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Returns a <see cref="System.String" /> that represents this instance.
+ /// </summary>
+ /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
+ public override string ToString()
+ {
+ return Path ?? string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// Enum SLGP_FLAGS
+ /// </summary>
+ [Flags]
+ public enum SLGP_FLAGS
+ {
+ /// <summary>
+ /// Retrieves the standard short (8.3 format) file name
+ /// </summary>
+ SLGP_SHORTPATH = 0x1,
+ /// <summary>
+ /// Retrieves the Universal Naming Convention (UNC) path name of the file
+ /// </summary>
+ SLGP_UNCPRIORITY = 0x2,
+ /// <summary>
+ /// Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded
+ /// </summary>
+ SLGP_RAWPATH = 0x4
+ }
+ /// <summary>
+ /// Enum SLR_FLAGS
+ /// </summary>
+ [Flags]
+ public enum SLR_FLAGS
+ {
+ /// <summary>
+ /// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set,
+ /// the high-order word of fFlags can be set to a time-out value that specifies the
+ /// maximum amount of time to be spent resolving the link. The function returns if the
+ /// link cannot be resolved within the time-out duration. If the high-order word is set
+ /// to zero, the time-out duration will be set to the default value of 3,000 milliseconds
+ /// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out
+ /// duration, in milliseconds.
+ /// </summary>
+ SLR_NO_UI = 0x1,
+ /// <summary>
+ /// Obsolete and no longer used
+ /// </summary>
+ SLR_ANY_MATCH = 0x2,
+ /// <summary>
+ /// If the link object has changed, update its path and list of identifiers.
+ /// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine
+ /// whether or not the link object has changed.
+ /// </summary>
+ SLR_UPDATE = 0x4,
+ /// <summary>
+ /// Do not update the link information
+ /// </summary>
+ SLR_NOUPDATE = 0x8,
+ /// <summary>
+ /// Do not execute the search heuristics
+ /// </summary>
+ SLR_NOSEARCH = 0x10,
+ /// <summary>
+ /// Do not use distributed link tracking
+ /// </summary>
+ SLR_NOTRACK = 0x20,
+ /// <summary>
+ /// Disable distributed link tracking. By default, distributed link tracking tracks
+ /// removable media across multiple devices based on the volume name. It also uses the
+ /// Universal Naming Convention (UNC) path to track remote file systems whose drive letter
+ /// has changed. Setting SLR_NOLINKINFO disables both types of tracking.
+ /// </summary>
+ SLR_NOLINKINFO = 0x40,
+ /// <summary>
+ /// Call the Microsoft Windows Installer
+ /// </summary>
+ SLR_INVOKE_MSI = 0x80
+ }
+
+ /// <summary>
+ /// The IShellLink interface allows Shell links to be created, modified, and resolved
+ /// </summary>
+ [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
+ public interface IShellLinkW
+ {
+ /// <summary>
+ /// Retrieves the path and file name of a Shell link object
+ /// </summary>
+ /// <param name="pszFile">The PSZ file.</param>
+ /// <param name="cchMaxPath">The CCH max path.</param>
+ /// <param name="pfd">The PFD.</param>
+ /// <param name="fFlags">The f flags.</param>
+ void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out WIN32_FIND_DATA pfd, SLGP_FLAGS fFlags);
+ /// <summary>
+ /// Retrieves the list of item identifiers for a Shell link object
+ /// </summary>
+ /// <param name="ppidl">The ppidl.</param>
+ void GetIDList(out IntPtr ppidl);
+ /// <summary>
+ /// Sets the pointer to an item identifier list (PIDL) for a Shell link object.
+ /// </summary>
+ /// <param name="pidl">The pidl.</param>
+ void SetIDList(IntPtr pidl);
+ /// <summary>
+ /// Retrieves the description string for a Shell link object
+ /// </summary>
+ /// <param name="pszName">Name of the PSZ.</param>
+ /// <param name="cchMaxName">Name of the CCH max.</param>
+ void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
+ /// <summary>
+ /// Sets the description for a Shell link object. The description can be any application-defined string
+ /// </summary>
+ /// <param name="pszName">Name of the PSZ.</param>
+ void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
+ /// <summary>
+ /// Retrieves the name of the working directory for a Shell link object
+ /// </summary>
+ /// <param name="pszDir">The PSZ dir.</param>
+ /// <param name="cchMaxPath">The CCH max path.</param>
+ void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
+ /// <summary>
+ /// Sets the name of the working directory for a Shell link object
+ /// </summary>
+ /// <param name="pszDir">The PSZ dir.</param>
+ void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
+ /// <summary>
+ /// Retrieves the command-line arguments associated with a Shell link object
+ /// </summary>
+ /// <param name="pszArgs">The PSZ args.</param>
+ /// <param name="cchMaxPath">The CCH max path.</param>
+ void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
+ /// <summary>
+ /// Sets the command-line arguments for a Shell link object
+ /// </summary>
+ /// <param name="pszArgs">The PSZ args.</param>
+ void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
+ /// <summary>
+ /// Retrieves the hot key for a Shell link object
+ /// </summary>
+ /// <param name="pwHotkey">The pw hotkey.</param>
+ void GetHotkey(out short pwHotkey);
+ /// <summary>
+ /// Sets a hot key for a Shell link object
+ /// </summary>
+ /// <param name="wHotkey">The w hotkey.</param>
+ void SetHotkey(short wHotkey);
+ /// <summary>
+ /// Retrieves the show command for a Shell link object
+ /// </summary>
+ /// <param name="piShowCmd">The pi show CMD.</param>
+ void GetShowCmd(out int piShowCmd);
+ /// <summary>
+ /// Sets the show command for a Shell link object. The show command sets the initial show state of the window.
+ /// </summary>
+ /// <param name="iShowCmd">The i show CMD.</param>
+ void SetShowCmd(int iShowCmd);
+ /// <summary>
+ /// Retrieves the location (path and index) of the icon for a Shell link object
+ /// </summary>
+ /// <param name="pszIconPath">The PSZ icon path.</param>
+ /// <param name="cchIconPath">The CCH icon path.</param>
+ /// <param name="piIcon">The pi icon.</param>
+ void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
+ int cchIconPath, out int piIcon);
+ /// <summary>
+ /// Sets the location (path and index) of the icon for a Shell link object
+ /// </summary>
+ /// <param name="pszIconPath">The PSZ icon path.</param>
+ /// <param name="iIcon">The i icon.</param>
+ void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
+ /// <summary>
+ /// Sets the relative path to the Shell link object
+ /// </summary>
+ /// <param name="pszPathRel">The PSZ path rel.</param>
+ /// <param name="dwReserved">The dw reserved.</param>
+ void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
+ /// <summary>
+ /// Attempts to find the target of a Shell link, even if it has been moved or renamed
+ /// </summary>
+ /// <param name="hwnd">The HWND.</param>
+ /// <param name="fFlags">The f flags.</param>
+ void Resolve(IntPtr hwnd, SLR_FLAGS fFlags);
+ /// <summary>
+ /// Sets the path and file name of a Shell link object
+ /// </summary>
+ /// <param name="pszFile">The PSZ file.</param>
+ void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
+
+ }
+
+ // CLSID_ShellLink from ShlGuid.h
+ /// <summary>
+ /// Class ShellLink
+ /// </summary>
+ [
+ ComImport,
+ Guid("00021401-0000-0000-C000-000000000046")
+ ]
+ public class ShellLink
+ {
+ }
+}
diff --git a/MediaBrowser.ServerApplication/Native/LoopUtil.cs b/MediaBrowser.ServerApplication/Native/LoopUtil.cs
index 7c7471231..0efdba389 100644
--- a/MediaBrowser.ServerApplication/Native/LoopUtil.cs
+++ b/MediaBrowser.ServerApplication/Native/LoopUtil.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
index 6d3d96e19..8933a5760 100644
--- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
+++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
@@ -13,7 +13,7 @@ namespace MediaBrowser.ServerApplication.Networking
/// <summary>
/// Class NetUtils
/// </summary>
- public class NetworkManager : Emby.Common.Implementations.Networking.NetworkManager
+ public class NetworkManager : Emby.Server.Implementations.Networking.NetworkManager
{
public NetworkManager(ILogger logger)
: base(logger)
diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs
index 7a35c5614..a6664c42f 100644
--- a/MediaBrowser.ServerApplication/WindowsAppHost.cs
+++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs
@@ -4,13 +4,13 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
-using Emby.Common.Implementations.IO;
using Emby.Server.CinemaMode;
using Emby.Server.Connect;
using Emby.Server.Core;
using Emby.Server.Implementations;
using Emby.Server.Implementations.EntryPoints;
using Emby.Server.Implementations.FFMpeg;
+using Emby.Server.Implementations.IO;
using Emby.Server.Sync;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Sync;
@@ -25,9 +25,10 @@ namespace MediaBrowser.ServerApplication
{
public class WindowsAppHost : ApplicationHost
{
- public WindowsAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, IMemoryStreamFactory memoryStreamFactory, MediaBrowser.Common.Net.INetworkManager networkManager, Action<string, string, string> certificateGenerator, Func<string> defaultUsernameFactory)
- : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, memoryStreamFactory, networkManager, certificateGenerator, defaultUsernameFactory)
+ public WindowsAppHost(ServerApplicationPaths applicationPaths, ILogManager logManager, StartupOptions options, IFileSystem fileSystem, IPowerManagement powerManagement, string releaseAssetFilename, IEnvironmentInfo environmentInfo, MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder, ISystemEvents systemEvents, MediaBrowser.Common.Net.INetworkManager networkManager)
+ : base(applicationPaths, logManager, options, fileSystem, powerManagement, releaseAssetFilename, environmentInfo, imageEncoder, systemEvents, networkManager)
{
+ fileSystem.AddShortcutHandler(new LnkShortcutHandler());
}
public override bool IsRunningAsService
diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config
index 0fa93db82..85d2613bb 100644
--- a/MediaBrowser.ServerApplication/packages.config
+++ b/MediaBrowser.ServerApplication/packages.config
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="NLog" version="4.4.11" targetFramework="net462" />
<package id="ServiceStack.Text" version="4.5.8" targetFramework="net462" />
<package id="SharpCompress" version="0.14.0" targetFramework="net462" />
<package id="SimpleInjector" version="4.0.8" targetFramework="net462" />
- <package id="SkiaSharp" version="1.58.0" targetFramework="net462" />
- <package id="SQLitePCLRaw.core" version="1.1.7" targetFramework="net462" />
- <package id="SQLitePCLRaw.provider.sqlite3.net45" version="1.1.7" targetFramework="net462" />
+ <package id="SkiaSharp" version="1.58.1" targetFramework="net462" />
+ <package id="SQLitePCLRaw.core" version="1.1.8" targetFramework="net462" />
+ <package id="SQLitePCLRaw.provider.sqlite3.net45" version="1.1.8" targetFramework="net462" />
</packages> \ No newline at end of file
diff --git a/MediaBrowser.ServerApplication/x64/libSkiaSharp.dll.REMOVED.git-id b/MediaBrowser.ServerApplication/x64/libSkiaSharp.dll.REMOVED.git-id
deleted file mode 100644
index 4027f61a0..000000000
--- a/MediaBrowser.ServerApplication/x64/libSkiaSharp.dll.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-20e469be83c5d41bb44d085c36550780e788a8ef \ No newline at end of file