123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Linq;
- using MediaDevices;
- using Mtp2Dav.WebDAVSharp.Server._1d2086a502937936ebc6bfe19cfa15d855be1c31.Stores;
- namespace Mtp2Dav.MtpStore._1d2086a502937936ebc6bfe19cfa15d855be1c31
- {
- internal abstract class WebDavMtpStoreItem : IWebDavStoreItem
- {
- //------------- const and fields ---------
- private static readonly DateTime InvaliDateTime = new DateTime(1900, 1, 1);
- //------------- inhertable implement ---------
- protected WebDavMtpStore Store { get; }
- protected MediaFileInfo FileInfo { get; }
- public string ItemPath { get; }
- public string Name { get; set; }
- //------------- transparent implement ----------------
- public virtual int Hidden => 0;
- public virtual DateTime CreationDate => FileInfo?.CreationTime ?? InvaliDateTime;
- public virtual DateTime ModificationDate => FileInfo?.LastWriteTime ?? InvaliDateTime;
- public abstract bool IsCollection { get; }
- //------------- ctor -------------------------
- protected WebDavMtpStoreItem(WebDavMtpStore store, string path)
- {
- Store = store;
- ItemPath = path;
- Name = ItemPath.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault() ?? ItemPath;
- FileInfo = store.GetInfo(ItemPath);
- }
- }
- }
|