Пример #1
0
        public static IServiceCollection AddLocalFsStorage(this IServiceCollection services, LocalFsStorageConfiguration storageConfiguration)
        {
            var storageInfo = new LocalStorageInfo(storageConfiguration.Path);

            services.AddSingleton <LocalStorageInfo>(storageInfo);
            services.AddSingleton <IStorage <LocalStorageInfo>, LocalStorage <LocalStorageInfo> >();
            return(services);
        }
Пример #2
0
        internal static FileInfo ToFileInfo(this System.IO.FileInfo info, LocalStorageInfo storageInfo)
        {
            var relaivePath = info.FullName.Replace(storageInfo.StoragePath, "").EscapePath().StripPath();

            return(new FileInfo(relaivePath, info.Length, info.CreationTimeUtc));
        }