Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinsyncEntry"/> class.
 /// </summary>
 /// <param name="fileSystem">The file system this entry belongs to</param>
 /// <param name="parent">The parent collection</param>
 /// <param name="path">The root-relative path of this entry</param>
 /// <param name="name">The name of the entry</param>
 protected BinsyncEntry(BinsyncFileSystem fileSystem, ICollection parent, Uri path, string name)
 {
     _parent         = parent;
     Name            = name;
     FileSystem      = BinsyncFS = fileSystem;
     Path            = path;
     CreationTimeUtc = LastWriteTimeUtc = new DateTime(1970, 1, 1);            //DateTime.UtcNow;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinsyncDirectory"/> class.
 /// </summary>
 /// <param name="fileSystem">The file system this collection belongs to</param>
 /// <param name="parent">The parent collection</param>
 /// <param name="path">The root-relative path of this collection</param>
 /// <param name="name">The name of the collection</param>
 /// <param name="isRoot">Is this the file systems root directory?</param>
 public BinsyncDirectory(
     BinsyncFileSystem fileSystem,
     ICollection parent,
     Uri path,
     string name,
     bool isRoot = false)
     : base(fileSystem, parent, path, name)
 {
     _isRoot = isRoot;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BinsyncFile"/> class.
        /// </summary>
        /// <param name="fileSystem">The file system this document belongs to</param>
        /// <param name="parent">The parent collection</param>
        /// <param name="path">The root-relative path of this document</param>
        /// <param name="name">The name of this document</param>
        public BinsyncFile(BinsyncFileSystem fileSystem, ICollection parent, Uri path, string name, long?fileSize = null)
            : /* this */ base(fileSystem, parent, path, name /*, new byte[0]*/)
        {
            Length = fileSize ?? -1;

            var p = System.Net.WebUtility.UrlDecode(this.Path.ToString());

            if (p.Length > 0 && p.Substring(p.Length - 1, 1) == "/")
            {
                p = p.Substring(0, p.Length - 1);
            }
            pathString = p;
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public virtual IFileSystem CreateFileSystem(ICollection mountPoint, IPrincipal principal)
        {
            var userName = !principal.Identity.IsAnonymous()
                                ? principal.Identity.Name
                                : string.Empty;

            var key = new FileSystemKey(userName, mountPoint?.Path.OriginalString ?? string.Empty);
            BinsyncFileSystem fileSystem;

            if (!_fileSystems.TryGetValue(key, out fileSystem))
            {
                fileSystem = new BinsyncFileSystem(mountPoint, _pathTraversalEngine, _systemClock, _lockManager, _propertyStoreFactory);
                _fileSystems.Add(key, fileSystem);
                InitializeFileSystem(mountPoint, principal, fileSystem);
            }
            else
            {
                UpdateFileSystem(mountPoint, principal, fileSystem);
            }

            return(fileSystem);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Called when the file system will be updated
 /// </summary>
 /// <param name="mountPoint">The mount point</param>
 /// <param name="principal">The principal the file system was created for</param>
 /// <param name="fileSystem">The created file system</param>
 protected virtual void UpdateFileSystem(ICollection mountPoint, IPrincipal principal, BinsyncFileSystem fileSystem)
 {
 }