The Free Software Media System - Server Backend & API
removed network option from directory picker due to unreliability
Luke Pulverenti7b6bf545dad2
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.csindex d88d855940..985e3c89b0 100644--- a/MediaBrowser.Api/EnvironmentService.cs+++ b/MediaBrowser.Api/EnvironmentService.cs@@ -55,15 +55,6 @@ namespace MediaBrowser.Api{}- /// <summary>- /// Class GetNetworkComputers- /// </summary>- [Route("/Environment/NetworkDevices", "GET")]- [Api(Description = "Gets a list of devices on the network")]- public class GetNetworkDevices : IReturn<List<FileSystemEntryInfo>>- {- }-/// <summary>/// Class EnvironmentService/// </summary>@@ -131,18 +122,6 @@ namespace MediaBrowser.Apireturn ToOptimizedResult(result);}- /// <summary>- /// Gets the specified request.- /// </summary>- /// <param name="request">The request.</param>- /// <returns>System.Object.</returns>- public object Get(GetNetworkDevices request)- {- var result = GetNetworkDevices().OrderBy(i => i.Path).ToList();-- return ToOptimizedResult(result);- }-/// <summary>/// Gets the list that is returned when an empty path is supplied/// </summary>@@ -159,20 +138,6 @@ namespace MediaBrowser.Api});}- /// <summary>- /// Gets the network computers.- /// </summary>- /// <returns>IEnumerable{FileSystemEntryInfo}.</returns>- private IEnumerable<FileSystemEntryInfo> GetNetworkDevices()- {- return _networkManager.GetNetworkDevices().Select(c => new FileSystemEntryInfo- {- Name = c,- Path = NetworkPrefix + c,- Type = FileSystemEntryType.NetworkComputer- });- }-/// <summary>/// Gets the name./// </summary>diff --git a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.csindex 6d35d5f861..71e2ec85a8 100644--- a/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs+++ b/MediaBrowser.Common.Implementations/NetworkManagement/NetworkManager.cs@@ -57,68 +57,6 @@ namespace MediaBrowser.Common.Implementations.NetworkManagement.FirstOrDefault();}- /// <summary>- /// Uses the DllImport : NetServerEnum with all its required parameters- /// (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netserverenum.asp- /// for full details or method signature) to retrieve a list of domain SV_TYPE_WORKSTATION- /// and SV_TYPE_SERVER PC's- /// </summary>- /// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER- /// PC's in the Domain</returns>- public IEnumerable<string> GetNetworkDevices()- {- //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;- var entriesRead = 0;- var totalEntries = 0;- var resHandle = 0;- var sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100));-- try- {- //call the DllImport : NetServerEnum with all its required parameters- //see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netserverenum.asp- //for full details of method signature- var ret = NativeMethods.NetServerEnum(null, 100, ref buffer, MAX_PREFERRED_LENGTH, out entriesRead, out totalEntries, SV_TYPE_WORKSTATION | SV_TYPE_SERVER, null, out resHandle);-- //if the returned with a NERR_Success (C++ term), =0 for C#- if (ret == 0)- {- //loop through all SV_TYPE_WORKSTATION and SV_TYPE_SERVER PC's- for (var i = 0; i < totalEntries; i++)- {- //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));- //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- //managed object, again using STRUCTURE to ensure the correct data- //is marshalled- var svrInfo = (_SERVER_INFO_100)Marshal.PtrToStructure(tmpBuffer, typeof(_SERVER_INFO_100));-- //add the PC names to the ArrayList- if (!string.IsNullOrEmpty(svrInfo.sv100_name))- {- yield return svrInfo.sv100_name;- }- }- }- }- finally- {- //The NetApiBufferFree function frees- //the memory that the NetApiBufferAllocate function allocates- NativeMethods.NetApiBufferFree(buffer);- }- }--/// <summary>/// Gets the network shares./// </summary>diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.csindex 83099e1f9f..6cda54606c 100644--- a/MediaBrowser.Common/Net/INetworkManager.cs+++ b/MediaBrowser.Common/Net/INetworkManager.cs@@ -23,12 +23,6 @@ namespace MediaBrowser.Common.Net/// <returns>[string] MAC Address</returns>string GetMacAddress();- /// <summary>- /// Gets available devices within the domain- /// </summary>- /// <returns>PC's in the Domain</returns>- IEnumerable<string> GetNetworkDevices();-/// <summary>/// Gets the network shares./// </summary>diff --git a/MediaBrowser.Controller/IO/NativeMethods.cs b/MediaBrowser.Controller/IO/NativeMethods.csindex 5b9bf52a8b..97c7dfe875 100644--- a/MediaBrowser.Controller/IO/NativeMethods.cs+++ b/MediaBrowser.Controller/IO/NativeMethods.cs@@ -12,47 +12,6 @@ namespace MediaBrowser.Controller.IO[SuppressUnmanagedCodeSecurity]public static class NativeMethods{- //declare the Netapi32 : NetServerEnum method import- /// <summary>- /// Nets the server enum.- /// </summary>- /// <param name="ServerName">Name of the server.</param>- /// <param name="dwLevel">The dw level.</param>- /// <param name="pBuf">The p buf.</param>- /// <param name="dwPrefMaxLen">The dw pref max len.</param>- /// <param name="dwEntriesRead">The dw entries read.</param>- /// <param name="dwTotalEntries">The dw total entries.</param>- /// <param name="dwServerType">Type of the dw server.</param>- /// <param name="domain">The domain.</param>- /// <param name="dwResumeHandle">The dw resume handle.</param>- /// <returns>System.Int32.</returns>- [DllImport("Netapi32", CharSet = CharSet.Auto, SetLastError = true),- SuppressUnmanagedCodeSecurityAttribute]-- public static extern int NetServerEnum(- string ServerName, // must be null- int dwLevel,- ref IntPtr pBuf,- int dwPrefMaxLen,- out int dwEntriesRead,- out int dwTotalEntries,- int dwServerType,- string domain, // null for login domain- out int dwResumeHandle- );-- //declare the Netapi32 : NetApiBufferFree method import- /// <summary>- /// Nets the API buffer free.- /// </summary>- /// <param name="pBuf">The p buf.</param>- /// <returns>System.Int32.</returns>- [DllImport("Netapi32", SetLastError = true),- SuppressUnmanagedCodeSecurityAttribute]-- public static extern int NetApiBufferFree(- IntPtr pBuf);-/// <summary>/// The MA x_ PATH/// </summary>@@ -71,83 +30,6 @@ namespace MediaBrowser.Controller.IOpublic const uint STGM_READ = 0;}- //create a _SERVER_INFO_100 STRUCTURE- /// <summary>- /// Struct _SERVER_INFO_100- /// </summary>- [StructLayout(LayoutKind.Sequential)]- public struct _SERVER_INFO_100- {- /// <summary>- /// The sv100_platform_id- /// </summary>- internal int sv100_platform_id;- /// <summary>- /// The sv100_name- /// </summary>- [MarshalAs(UnmanagedType.LPWStr)]- internal string sv100_name;- }-- /// <summary>- /// Class FindFirstFileExFlags- /// </summary>- public class FindFirstFileExFlags- {- /// <summary>- /// The NONE- /// </summary>- public const int NONE = 0;-- /// <summary>- /// Searches are case-sensitive.Searches are case-sensitive.- /// </summary>- public const int FIND_FIRST_EX_CASE_SENSITIVE = 1;-- /// <summary>- /// Uses a larger buffer for directory queries, which can increase performance of the find operation.- /// </summary>- public const int FIND_FIRST_EX_LARGE_FETCH = 2;- }-- /// <summary>- /// Enum FINDEX_INFO_LEVELS- /// </summary>- public enum FINDEX_INFO_LEVELS- {- /// <summary>- /// The FindFirstFileEx function retrieves a standard set of attribute information. The data is returned in a WIN32_FIND_DATA structure.- /// </summary>- FindExInfoStandard = 0,-- /// <summary>- /// The FindFirstFileEx function does not query the short file name, improving overall enumeration speed. The data is returned in a WIN32_FIND_DATA structure, and the cAlternateFileName member is always a NULL string.- /// </summary>- FindExInfoBasic = 1- }-- /// <summary>- /// Enum FINDEX_SEARCH_OPS- /// </summary>- public enum FINDEX_SEARCH_OPS- {- /// <summary>- /// The search for a file that matches a specified file name.- /// The lpSearchFilter parameter of FindFirstFileEx must be NULL when this search operation is used.- /// </summary>- FindExSearchNameMatch = 0,-- /// <summary>- /// The find ex search limit to directories- /// </summary>- FindExSearchLimitToDirectories = 1,-- /// <summary>- /// This filtering type is not available.- /// </summary>- FindExSearchLimitToDevices = 2- }-/// <summary>/// Struct FILETIME/// </summary>diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.jsindex 26aad2efbf..29bfb1068f 100644--- a/MediaBrowser.WebDashboard/ApiClient.js+++ b/MediaBrowser.WebDashboard/ApiClient.js@@ -496,20 +496,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {});};- /**- * Gets a list of network devices from the server- */- self.getNetworkDevices = function () {-- var url = self.getUrl("Environment/NetworkDevices");-- return self.ajax({- type: "GET",- url: url,- dataType: "json"- });- };-/*** Cancels a package installation*/diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.configindex 505dcab952..49180aa52e 100644--- a/MediaBrowser.WebDashboard/packages.config+++ b/MediaBrowser.WebDashboard/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="MediaBrowser.ApiClient.Javascript" version="3.0.167" targetFramework="net45" />+ <package id="MediaBrowser.ApiClient.Javascript" version="3.0.168" targetFramework="net45" /><package id="ServiceStack.Common" version="3.9.58" targetFramework="net45" /><package id="ServiceStack.Text" version="3.9.58" targetFramework="net45" /></packages>\ No newline at end of file