コード例 #1
0
        //public static void UseRichFileManagerUI(this FileManagerOptions app)
        //{
        //    app.Fun = new System.Action(() =>
        //    {
        //        app.ApplicationBuilder.UseFileManager(app.PathMatch);
        //    });
        //}

        //public static IAppBuilder UseFileManager(this IAppBuilder app, string pathMatch, string webRootPath = "", string webPath = "", bool publicPath = false, string[] allowedExtensions = null, IEnumerable<IDashboardAuthorizationFilter> authorization = null)
        //{
        //    //            if (app == null) throw new ArgumentNullException(nameof(app));
        //    //            if (pathMatch == null) throw new ArgumentNullException(nameof(pathMatch));
        //    //            if (string.IsNullOrWhiteSpace(webRootPath))
        //    //            {
        //    //#if !NETFULL
        //    //                var env = app.ApplicationServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>();
        //    //                webRootPath = env.WebRootPath;
        //    //#else
        //    //                webRootPath = Environment.CurrentDirectory;
        //    //#endif
        //    //            }
        //    //            var Provider = new FileManager.FileStorage.PhysicalFileSystemStore(webRootPath);
        //    //            app.UseFileManager(pathMatch, Provider, "", webPath, publicPath, allowedExtensions, authorization);
        //    return app;
        //}
        //#if !NETFULL
        //        public static IAppBuilder UseFileManager(this IAppBuilder app,
        //           string pathMatch,
        //           Microsoft.Extensions.FileProviders.IFileProvider fileProvider,
        //           string webRootPath = null,
        //           string webPath = "",
        //           bool publicPath = false,
        //           string[] allowedExtensions = null,
        //           IEnumerable<IDashboardAuthorizationFilter> authorization = null)
        //        {
        //            if (app == null) throw new ArgumentNullException(nameof(app));
        //            if (pathMatch == null) throw new ArgumentNullException(nameof(pathMatch));
        //            //if (string.IsNullOrWhiteSpace(webRootPath))
        //            //{
        //            //    var env = app.ApplicationServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>();
        //            //    webRootPath = env.WebRootPath;
        //            //}
        //            var Provider = new FileManagerProvider(fileProvider, webRootPath, webPath, publicPath, allowedExtensions);
        //            app.UseFileManager(pathMatch, Provider, authorization);
        //            return app;
        //        }
        //#endif
        //public static IAppBuilder UseFileManager(this IAppBuilder app, string pathMatch, IFileStore fileStore, string webRootPath = "", string webPath = "", bool publicPath = false, string[] allowedExtensions = null, IEnumerable<IDashboardAuthorizationFilter> authorization = null)
        //{
        //    //if (app == null) throw new ArgumentNullException(nameof(app));
        //    //if (pathMatch == null) throw new ArgumentNullException(nameof(pathMatch));
        //    //if (fileStore == null) throw new ArgumentNullException(nameof(fileStore));

        //    //webRootPath = webRootPath ?? "";
        //    //webPath = webPath ?? "";
        //    //var Provider = new FileManagerProvider(fileStore, webRootPath, webPath, publicPath, allowedExtensions);
        //    //app.UseFileManager(pathMatch, Provider, authorization);
        //    return app;
        //}
        public static void UseRichFileManagerUI(this FileManagerOptions app)
        {
            app.Fun = new System.Action(() =>
            {
                app.ApplicationBuilder.UseFileManager(app.PathMatch);
            });
        }
コード例 #2
0
 public Logger(FileManagerOptions options)
 {
     archivator              = new Archivator(options);
     sourceWatcher           = new FileSystemWatcher(options["Source"]);
     archiveWatcher          = new FileSystemWatcher(options["Archive"]);
     sourceWatcher.Created  += SourceWatcher_CreatedAsync;
     archiveWatcher.Renamed += TargetWatcher_RenamedAsync;
 }
コード例 #3
0
        private async Task StartAsync()
        {
            OptionsManager optionsManager = new OptionsManager(@"E:\LR5\FileManager\bin\Release\AppSettings.json");

            options = await optionsManager.GetOptionsAsync <FileManagerOptions>();

            logger = new Logger(options);
            Thread loggerThread = new Thread(new ThreadStart(logger.Start));

            loggerThread.Start();
        }
コード例 #4
0
ファイル: FileManagerService.cs プロジェクト: shprexen/Labs
 protected override void OnStart(string[] args)
 {
     try
     {
         OptionsManager optionsManager = new OptionsManager(@"D:\Lab4\DataManagerService\bin\Release\AppSettings.json");
         options = optionsManager.GetOptions <FileManagerOptions>();
         logger  = new Logger(options);
         Thread loggerThread = new Thread(new ThreadStart(logger.Start));
         loggerThread.Start();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
        public static void UseDefaultFileManagerUI(this FileManagerOptions app)
        {
            app.Fun = new System.Action(() =>
            {
                var fileStore = app.ApplicationBuilder.ApplicationServices.GetService <FileStorage.IFileStore>();
                var option    = new FileServerOptions
                {
                    FileProvider            = new FileStorage.StoreFileProvider(fileStore),
                    RequestPath             = app.PathMatch,
                    EnableDefaultFiles      = true,
                    EnableDirectoryBrowsing = true
                };
                option.StaticFileOptions.ServeUnknownFileTypes = true;

                app.ApplicationBuilder.UseFileServer(option);
            });
        }
コード例 #6
0
        public static IApplicationBuilder UseFileManagerUI(this IApplicationBuilder app, PathString pathMatch, System.Action <FileManagerOptions> action = null)
        {
            var r = new FileManagerOptions()
            {
                PathMatch = pathMatch, ApplicationBuilder = app
            };

            if (action == null)
            {
                UseDefaultFileManagerUI(r);
            }
            else
            {
                action?.Invoke(r);
            }
            r.Fun();
            return(app);
        }
コード例 #7
0
ファイル: Archivator.cs プロジェクト: shprexen/Labs
 public Archivator(FileManagerOptions options)
 {
     archiveFolder = options["Archive"];
     extractFolder = options["Extract"];
     encryptor     = new Encryptor();
 }