blob: 7f0ea12b80558c697693c3336255392b6ec06636 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.IO;
namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Provides a base entity for all of our types
/// </summary>
public abstract class BaseEntity
{
public string Name { get; set; }
public Guid Id { get; set; }
public string Path { get; set; }
public Folder Parent { get; set; }
public string PrimaryImagePath { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
public override string ToString()
{
return Name;
}
protected ItemResolveEventArgs _resolveArgs;
/// <summary>
/// We attach these to the item so that we only ever have to hit the file system once
/// (this includes the children of the containing folder)
/// Use ResolveArgs.FileSystemChildren to check for the existence of files instead of File.Exists
/// </summary>
public ItemResolveEventArgs ResolveArgs
{
get
{
if (_resolveArgs == null)
{
_resolveArgs = new ItemResolveEventArgs()
{
FileInfo = FileData.GetFileData(this.Path),
Parent = this.Parent,
Cancel = false,
Path = this.Path
};
_resolveArgs = FileSystemHelper.FilterChildFileSystemEntries(_resolveArgs, (this.Parent != null && this.Parent.IsRoot));
}
return _resolveArgs;
}
set
{
_resolveArgs = value;
}
}
/// <summary>
/// Refresh metadata on us by execution our provider chain
/// </summary>
/// <returns>true if a provider reports we changed</returns>
public bool RefreshMetadata()
{
Kernel.Instance.ExecuteMetadataProviders(this).ConfigureAwait(false);
return true;
}
}
}
|