//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);
            });
        }
Esempio n. 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;
 }
Esempio n. 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();
        }
Esempio n. 4
0
 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;
     }
 }
        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);
            });
        }
        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);
        }
Esempio n. 7
0
 public Archivator(FileManagerOptions options)
 {
     archiveFolder = options["Archive"];
     extractFolder = options["Extract"];
     encryptor     = new Encryptor();
 }