Example #1
0
        public static EfsStoreItem Create(QcdmManager manager, string name, string uniqueKey, string path,
                                          bool isReadOnly, Logger logger, LogLevel logLevel)
        {
            var item = new EfsStoreItem(manager, name, uniqueKey, path, isReadOnly, logger, logLevel);

            item.Initialize();
            return(item);
        }
Example #2
0
        public Task <IStoreItem> GetItemAsync(Uri uri, IHttpContext httpContext)
        {
            LogInfo(Strings.WebDavProcessingItemRequestFormat, uri, httpContext.Request.HttpMethod);
            var path = uri.LocalPath;
            var name = Path.GetFileName(path);

            if (IsIgnoredFile(name))
            {
                return(Task.FromResult((IStoreItem)null));
            }
            return(Task.Run(() =>
            {
                try
                {
                    var stat = EfsFileManager.Instance.GetEntry(_manager, path);
                    if (stat.Mode == 0)
                    {
                        LogWarning(Strings.WebDavWarningPathNotFoundFormat, path);
                        return null;
                    }

                    if (EfsFileManager.Instance.IsDirectory(_manager, path))
                    {
                        var dirItem = EfsStoreCollection.Create(_manager, name, path, path, _readOnly, _logger, _logLevel);
                        return (IStoreItem)dirItem;
                    }

                    var item = EfsStoreItem.Create(_manager, name, path, path, _readOnly, _logger, _logLevel);
                    return (IStoreItem)item;
                }
                catch (Exception ex)
                {
                    LogError(Strings.WebDavErrorOnProcessItemRequestFormat, ex.Message);
                    return null;
                }
            }));
        }