本文整理汇总了C#中ResourcePath类的典型用法代码示例。如果您正苦于以下问题:C# ResourcePath类的具体用法?C# ResourcePath怎么用?C# ResourcePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourcePath类属于命名空间,在下文中一共展示了ResourcePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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];
}
示例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];
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
}
示例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);
}
示例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;
}
}