本文整理汇总了C#中ResourcePath类的典型用法代码示例。如果您正苦于以下问题:C# ResourcePath类的具体用法?C# ResourcePath怎么用?C# ResourcePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourcePath类属于命名空间,在下文中一共展示了ResourcePath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoteFileResourceAccessor
protected RemoteFileResourceAccessor(string nativeSystemId, ResourcePath nativeResourcePath,
string resourcePathName, string resourceName, DateTime lastChanged, long size) :
base(nativeSystemId, nativeResourcePath, true, resourcePathName, resourceName)
{
_lastChanged = lastChanged;
_size = size;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:7,代码来源:RemoteFileResourceAccessor.cs
示例2: TryGetLocalBrowseViewPath
/// <summary>
/// Tries to find the resource path corresponding to the given media library <paramref name="viewSpecification"/>.
/// </summary>
/// <param name="viewSpecification">View specification to be examined.</param>
/// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a media library view specification (i.e. one of the
/// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param>
/// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications
/// of this view specification.</returns>
public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path)
{
MediaLibraryBrowseViewSpecification mlbvs = viewSpecification as MediaLibraryBrowseViewSpecification;
if (mlbvs != null)
{ // We're in some MediaLibrary browsing state
IServerConnectionManager serverConnectionManager = ServiceRegistration.Get<IServerConnectionManager>();
string localSystemId = ServiceRegistration.Get<ISystemResolver>().LocalSystemId;
if (mlbvs.SystemId != localSystemId && mlbvs.SystemId != serverConnectionManager.HomeServerSystemId)
{ // If the currently browsed system is a different one, the path must be set to null
path = null;
return true;
}
// In a browsing state for the local system, we can return the base path from the view specification
path = mlbvs.BasePath;
return true;
}
BrowseMediaRootProxyViewSpecification bmrvs = viewSpecification as BrowseMediaRootProxyViewSpecification;
SystemSharesViewSpecification ssvs = viewSpecification as SystemSharesViewSpecification;
AllSystemsViewSpecification asvs = viewSpecification as AllSystemsViewSpecification;
if (ssvs != null || asvs != null || bmrvs != null)
{ // If the current browsing state shows one of the root browse states, we can just set the path to null
path = null;
return true;
}
path = null;
return false;
}
开发者ID:HeinA,项目名称:MediaPortal-2,代码行数:36,代码来源:BrowseMediaRootProxyViewSpecification.cs
示例3: RemoteFileSystemResourceAccessor
protected RemoteFileSystemResourceAccessor(string nativeSystemId, ResourcePath nativeResourcePath, bool isFile,
string resourcePathName, string resourceName, long size, DateTime lastChanged) :
this(nativeSystemId, nativeResourcePath, isFile, resourcePathName, resourceName)
{
_lastChangedCache = lastChanged;
_sizeCache = size;
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:7,代码来源:RemoteFileSystemResourceAccessor.cs
示例4: GetChildDirectoriesData
public ICollection<ResourcePathMetadata> GetChildDirectoriesData(ResourcePath path)
{
CpAction action = GetAction("GetChildDirectoriesData");
IList<object> inParameters = new List<object> {path.Serialize()};
IList<object> outParameters = action.InvokeAction(inParameters);
return (ICollection<ResourcePathMetadata>) outParameters[0];
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:7,代码来源:UPnPResourceInformationServiceProxy.cs
示例5: GetResourceDisplayName
public string GetResourceDisplayName(ResourcePath path)
{
CpAction action = GetAction("GetResourceDisplayName");
IList<object> inParameters = new List<object> {path.Serialize()};
IList<object> outParameters = action.InvokeAction(inParameters);
return (string) outParameters[0];
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:7,代码来源:UPnPResourceInformationServiceProxy.cs
示例6: BestContainingPath
/// <summary>
/// Extension method which is added on <see cref="IEnumerable{Share}"/> to find that share in the given enumeration
/// which best matches the given <paramref name="path"/>.
/// </summary>
/// <remarks>
/// If there are shares where one share path contains the path of another share in the given <paramref name="shares"/> enumeration,
/// the algorithm will always find the share whose path is as close to the given <paramref name="path"/>. If more than one share match best,
/// the first best matching share is returned.
/// </remarks>
/// <param name="shares">Enumeration of shares to search through.</param>
/// <param name="path">Path to find a share for.</param>
/// <returns>Share which best matches the given <paramref name="path"/>, if one exists. Else, <c>null</c> will be returned.</returns>
public static Share BestContainingPath(this IEnumerable<Share> shares, ResourcePath path)
{
if (path == null)
return null;
int bestMatchPathLength = int.MaxValue;
Share bestMatchShare = null;
foreach (Share share in shares)
{
ResourcePath currentSharePath = share.BaseResourcePath;
if (!currentSharePath.IsSameOrParentOf(path))
// The path is not located in the current share
continue;
if (bestMatchShare == null)
{
bestMatchShare = share;
continue;
}
// We want to find a share which is as close as possible to the given path
int currentSharePathLength = currentSharePath.Serialize().Length;
if (bestMatchPathLength >= currentSharePathLength)
continue;
bestMatchShare = share;
bestMatchPathLength = currentSharePathLength;
}
return bestMatchShare;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:38,代码来源:SharesHelper.cs
示例7: SendPathChoosenMessage
public const string CHOOSEN_PATH = "ChoosenPath"; // Type: ResourcePath
public static void SendPathChoosenMessage(Guid dialogHandle, ResourcePath choosenPath)
{
SystemMessage msg = new SystemMessage(MessageType.PathChoosen);
msg.MessageData[DIALOG_HANDLE] = dialogHandle;
msg.MessageData[CHOOSEN_PATH] = choosenPath;
ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
}
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:9,代码来源:PathBrowserMessaging.cs
示例8: SendImportMessage
internal static void SendImportMessage(MessageType messageType, ResourcePath path, ImportJobType importJobType)
{
SystemMessage msg = new SystemMessage(messageType);
msg.MessageData[RESOURCE_PATH] = path;
msg.MessageData[IMPORT_JOB_TYPE] = importJobType;
ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:7,代码来源:ImporterWorkerMessaging.cs
示例9: RemoteResourceAccessorBase
protected Stream _underlayingStream = null; // Lazy initialized
protected RemoteResourceAccessorBase(string nativeSystemId, ResourcePath nativeResourcePath, bool isFile, string resourcePathName, string resourceName)
{
_nativeSystemId = nativeSystemId;
_nativeResourcePath = nativeResourcePath;
_isFile = isFile;
_resourcePathName = resourcePathName;
_resourceName = resourceName;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:10,代码来源:RemoteResourceAccessorBase.cs
示例10: LocalDirectoryViewSpecification
/// <summary>
/// Creates a new <see cref="LocalDirectoryViewSpecification"/> instance.
/// </summary>
/// <param name="overrideName">Overridden name for the view. If not set, the resource name of the specified
/// <paramref name="viewPath"/> will be used as <see cref="ViewDisplayName"/>.</param>
/// <param name="viewPath">Path of a directory in a local filesystem provider.</param>
/// <param name="necessaryMIATypeIds">Ids of the media item aspect types which should be extracted for all items and
/// sub views of this view.</param>
/// <param name="optionalMIATypeIds">Ids of the media item aspect types which may be extracted for items and
/// sub views of this view.</param>
public LocalDirectoryViewSpecification(string overrideName, ResourcePath viewPath,
IEnumerable<Guid> necessaryMIATypeIds, IEnumerable<Guid> optionalMIATypeIds) :
base(null, necessaryMIATypeIds, optionalMIATypeIds)
{
_overrideName = overrideName;
_viewPath = viewPath;
UpdateDisplayName();
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:18,代码来源:LocalDirectoryViewSpecification.cs
示例11: MediaLibraryBrowseViewSpecification
public MediaLibraryBrowseViewSpecification(string viewDisplayName, Guid directoryId,
string systemId, ResourcePath basePath,
IEnumerable<Guid> necessaryMIATypeIDs, IEnumerable<Guid> optionalMIATypeIDs) :
base(viewDisplayName, necessaryMIATypeIDs, optionalMIATypeIDs)
{
_directoryId = directoryId;
_systemId = systemId;
_basePath = basePath;
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:9,代码来源:MediaLibraryBrowseViewSpecification.cs
示例12: ToDosPath
/// <summary>
/// Transforms a resource path denoting a local filesystem path to a DOS path.
/// </summary>
/// <param name="resourcePath">Resource path to transform.</param>
/// <returns>Dos path to the given <paramref name="resourcePath"/> or <c>null</c>, if the given path is <c>null</c> or
/// doesn't denote a path in the local filesystem provider.</returns>
public static string ToDosPath(ResourcePath resourcePath)
{
if (resourcePath == null)
return null;
ProviderPathSegment lastSegment = resourcePath.LastPathSegment;
if (lastSegment.ProviderId != LOCAL_FS_RESOURCE_PROVIDER_ID)
return null;
return ToDosPath(lastSegment.Path);
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:15,代码来源:LocalFsResourceProviderBase.cs
示例13: LoadLocalItem
public MediaItem LoadLocalItem(ResourcePath path,
IEnumerable<Guid> necessaryRequestedMIATypeIDs, IEnumerable<Guid> optionalRequestedMIATypeIDs)
{
try
{
return _parent.LoadItem(_parent.LocalSystemId, path, necessaryRequestedMIATypeIDs, optionalRequestedMIATypeIDs);
}
catch (Exception)
{
throw new DisconnectedException();
}
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:12,代码来源:MediaLibrary.cs
示例14: PendingImportResourceNewGen
private DateTime _dateOfLastImport; // only valid for refresh imports
#endregion
#region Constructor
public PendingImportResourceNewGen(ResourcePath parentDirectory, IFileSystemResourceAccessor resourceAccessor, String currentBlock, ImportJobController parentImportJobController, Guid? parentDirectoryId = null, Guid? mediaItemId = null)
{
_parentDirectoryId = parentDirectoryId;
_mediaItemId = mediaItemId;
_parentDirectoryResourcePathString = (parentDirectory == null) ? "" : parentDirectory.Serialize();
_resourceAccessor = resourceAccessor;
_currentBlock = currentBlock;
_parentImportJobController = parentImportJobController;
_pendingImportResourceNumber = _parentImportJobController.GetNumberOfNextPendingImportResource();
_isValid = (_resourceAccessor != null);
_parentImportJobController.RegisterPendingImportResource(this);
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:20,代码来源:PendingImportResourceNewGen.cs
示例15: ParseResourceURI
public static bool ParseResourceURI(Uri resourceURI, out ResourcePath relativeResourcePath)
{
NameValueCollection query = HttpUtility.ParseQueryString(resourceURI.Query);
string resourcePathStr = query[RESOURCE_PATH_ARGUMENT_NAME];
try
{
relativeResourcePath = ResourcePath.Deserialize(resourcePathStr);
return true;
}
catch (ArgumentException)
{
relativeResourcePath = null;
return false;
}
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:15,代码来源:ResourceHttpAccessUrlUtils.cs
示例16: ConnectFile
public static bool ConnectFile(string nativeSystemId, ResourcePath nativeResourcePath, out IResourceAccessor result)
{
IRemoteResourceInformationService rris = ServiceRegistration.Get<IRemoteResourceInformationService>();
result = null;
bool isFileSystemResource;
bool isFile;
string resourcePathName;
string resourceName;
DateTime lastChanged;
long size;
if (!rris.GetResourceInformation(nativeSystemId, nativeResourcePath,
out isFileSystemResource, out isFile, out resourcePathName, out resourceName, out lastChanged, out size) ||
!isFile)
return false;
result = new RemoteFileResourceAccessor(nativeSystemId, nativeResourcePath, resourcePathName, resourceName, lastChanged, size);
return true;
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:17,代码来源:RemoteFileResourceAccessor.cs
示例17: TryExtractSystemAndPath
internal static bool TryExtractSystemAndPath(string providerPath, out string systemId, out ResourcePath nativeResourcePath)
{
systemId = null;
nativeResourcePath = null;
int sepIndex = providerPath.IndexOf(':');
if (sepIndex < 1)
return false;
systemId = providerPath.Substring(0, sepIndex);
try
{
nativeResourcePath = ResourcePath.Deserialize(providerPath.Substring(sepIndex + 1));
return true;
}
catch (ArgumentException)
{
return false;
}
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:18,代码来源:RemoteResourceProvider.cs
示例18: TryGetLocalBrowseViewPath
/// <summary>
/// Tries to find the resource path corresponding to the given local <paramref name="viewSpecification"/>.
/// </summary>
/// <param name="viewSpecification">View specification to be examined.</param>
/// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a local view specification (i.e. one of the
/// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param>
/// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications
/// of this view specification.</returns>
public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path)
{
LocalMediaRootProxyViewSpecification lmrpvs = viewSpecification as LocalMediaRootProxyViewSpecification;
LocalSharesViewSpecification lsvs = viewSpecification as LocalSharesViewSpecification;
if (lmrpvs != null || lsvs != null)
{ // If the current browsing state shows one of the root states, the path must be set to null
path = null;
return true;
}
LocalDirectoryViewSpecification ldvs = viewSpecification as LocalDirectoryViewSpecification;
if (ldvs != null)
{ // In a local browsing state, we can return the browsing path
path = ldvs.ViewPath;
return true;
}
path = null;
return false;
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:26,代码来源:LocalMediaRootProxyViewSpecification.cs
示例19: Navigate
/// <summary>
/// Helper method which simulates a user navigation under this view specification to the given <paramref name="targetPath"/>
/// under the given <paramref name="localShare"/>.
/// </summary>
/// <param name="localShare">Client or server share which is located at the local system.</param>
/// <param name="targetPath">Resource path to navigate to. This path must be located under the given <paramref name="localShare"/>'s base path.</param>
/// <param name="navigateToViewDlgt">Callback which will be called for each view specification to navigate to to do the actual navigation.</param>
public void Navigate(Share localShare, ResourcePath targetPath, NavigateToViewDlgt navigateToViewDlgt)
{
NavigateToLocalRootView(localShare, navigateToViewDlgt);
IResourceAccessor startRA;
if (!localShare.BaseResourcePath.TryCreateLocalResourceAccessor(out startRA))
return;
IFileSystemResourceAccessor current = startRA as IFileSystemResourceAccessor;
if (current == null)
{
// Wrong path resource, cannot navigate. Should not happen if the share is based on a filesystem resource,
// but might happen if we have found a non-standard share.
startRA.Dispose();
return;
}
while (true)
{
ICollection<IFileSystemResourceAccessor> children = FileSystemResourceNavigator.GetChildDirectories(current, false);
current.Dispose();
current = null;
if (children != null)
foreach (IFileSystemResourceAccessor childDirectory in children)
using (childDirectory)
{
if (childDirectory.CanonicalLocalResourcePath.IsSameOrParentOf(targetPath))
{
current = childDirectory;
break;
}
}
if (current == null)
break;
ViewSpecification newVS = NavigateCreateViewSpecification(localShare.SystemId, current);
if (newVS == null)
{
current.Dispose();
return;
}
navigateToViewDlgt(newVS);
}
}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:47,代码来源:AbstractMediaRootProxyViewSpecification.cs
示例20: ImportLocation
public void ImportLocation(ResourcePath path, IEnumerable<string> mediaCategories, ImportJobType importJobType)
{
CpAction action = GetAction("ImportLocation");
string importJobTypeStr;
switch (importJobType)
{
case ImportJobType.Import:
importJobTypeStr = "Import";
break;
case ImportJobType.Refresh:
importJobTypeStr = "Refresh";
break;
default:
throw new NotImplementedException(string.Format("Import job type '{0}' is not implemented", importJobType));
}
IList<object> inParameters = new List<object>
{
path.Serialize(),
StringUtils.Join(", ", mediaCategories),
importJobTypeStr
};
action.InvokeAction(inParameters);
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:23,代码来源:UPnPClientControllerServiceProxy.cs
注:本文中的ResourcePath类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论