本文整理汇总了C#中IDirectoryService.GetFile方法的典型用法代码示例。如果您正苦于以下问题:C# IDirectoryService.GetFile方法的具体用法?C# IDirectoryService.GetFile怎么用?C# IDirectoryService.GetFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectoryService
的用法示例。
在下文中一共展示了IDirectoryService.GetFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetInitialItemValues
/// <summary>
/// Sets the initial item values.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="parent">The parent.</param>
/// <param name="fileSystem">The file system.</param>
/// <param name="libraryManager">The library manager.</param>
/// <param name="directoryService">The directory service.</param>
/// <exception cref="System.ArgumentException">Item must have a path</exception>
public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
{
// This version of the below method has no ItemResolveArgs, so we have to require the path already being set
if (string.IsNullOrWhiteSpace(item.Path))
{
throw new ArgumentException("Item must have a Path");
}
// If the resolver didn't specify this
if (parent != null)
{
item.Parent = parent;
}
item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
item.Parents.Any(i => i.IsLocked);
// Make sure DateCreated and DateModified have values
var fileInfo = directoryService.GetFile(item.Path);
item.DateModified = fileSystem.GetLastWriteTimeUtc(fileInfo);
SetDateCreated(item, fileSystem, fileInfo);
EnsureName(item, fileInfo);
}
示例2: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
if (item.EnableRefreshOnDateModifiedChange && !string.IsNullOrWhiteSpace(item.Path) && item.LocationType == LocationType.FileSystem)
{
var file = directoryService.GetFile(item.Path);
if (file != null && file.LastWriteTimeUtc != item.DateModified)
{
return true;
}
}
return false;
}
示例3: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var file = directoryService.GetFile(item.Path);
if (file != null && file.LastWriteTimeUtc != item.DateModified)
{
return true;
}
return false;
}