diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-23 16:51:10 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-23 16:51:10 -0400 |
| commit | f218e6b5832ad2eec2c6391bf2f942ecd6a0330f (patch) | |
| tree | 34b3de714c5769da5e2f50aece3aa56b4af58c41 /MediaBrowser.Controller/Library | |
| parent | 8d693fd2ab2fecb4e15801c5d7104678ca791432 (diff) | |
More comments and cleanup. Added special feature provider for movies
Diffstat (limited to 'MediaBrowser.Controller/Library')
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemController.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemResolveEventArgs.cs | 125 |
2 files changed, 125 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Library/ItemController.cs b/MediaBrowser.Controller/Library/ItemController.cs index df7cf8810..fdc2276d0 100644 --- a/MediaBrowser.Controller/Library/ItemController.cs +++ b/MediaBrowser.Controller/Library/ItemController.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Entities;
diff --git a/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs b/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs new file mode 100644 index 000000000..0daca3b44 --- /dev/null +++ b/MediaBrowser.Controller/Library/ItemResolveEventArgs.cs @@ -0,0 +1,125 @@ +using System;
+using System.IO;
+using MediaBrowser.Controller.IO;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Controller.Library
+{
+ /// <summary>
+ /// This is an EventArgs object used when resolving a Path into a BaseItem
+ /// </summary>
+ public class ItemResolveEventArgs : PreBeginResolveEventArgs
+ {
+ public WIN32_FIND_DATA[] FileSystemChildren { get; set; }
+
+ public WIN32_FIND_DATA? GetFileSystemEntry(string path)
+ {
+ for (int i = 0; i < FileSystemChildren.Length; i++)
+ {
+ WIN32_FIND_DATA entry = FileSystemChildren[i];
+
+ if (entry.Path.Equals(path, StringComparison.OrdinalIgnoreCase))
+ {
+ return entry;
+ }
+ }
+
+ return null;
+ }
+
+ public bool ContainsFile(string name)
+ {
+ for (int i = 0; i < FileSystemChildren.Length; i++)
+ {
+ if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public bool ContainsFolder(string name)
+ {
+ for (int i = 0; i < FileSystemChildren.Length; i++)
+ {
+ if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// This is an EventArgs object used before we begin resolving a Path into a BaseItem
+ /// File system children have not been collected yet, but consuming events will
+ /// have a chance to cancel resolution based on the Path, Parent and FileAttributes
+ /// </summary>
+ public class PreBeginResolveEventArgs : EventArgs
+ {
+ public Folder Parent { get; set; }
+
+ public bool Cancel { get; set; }
+
+ public WIN32_FIND_DATA FileInfo { get; set; }
+
+ public string Path { get; set; }
+
+ public bool IsDirectory
+ {
+ get
+ {
+ return FileInfo.dwFileAttributes.HasFlag(FileAttributes.Directory);
+ }
+ }
+
+ public VirtualFolder VirtualFolder
+ {
+ get
+ {
+ if (Parent != null)
+ {
+ return Parent.VirtualFolder;
+ }
+
+ return null;
+ }
+ }
+
+ public string VirtualFolderCollectionType
+ {
+ get
+ {
+ VirtualFolder vf = VirtualFolder;
+
+ if (vf == null)
+ {
+ return null;
+ }
+
+ return vf.CollectionType;
+ }
+ }
+
+ public bool IsHidden
+ {
+ get
+ {
+ return FileInfo.IsHidden;
+ }
+ }
+
+ public bool IsSystemFile
+ {
+ get
+ {
+ return FileInfo.IsSystemFile;
+ }
+ }
+
+ }
+}
|
