public HomeController(ILogger <HomeController> logger, IMemoryCache memoryCache, IHostEnvironment hostEnvironment, IMemoryCacheTest memoryCacheTest) { _logger = logger; _cache = memoryCache; _filePath = Path.Combine(hostEnvironment.ContentRootPath, "wwwroot", "test", TestFileName); _memoryCacheTest = memoryCacheTest; }
public FileWatcher(IMemoryCacheTest memoryCacheTest, IHostEnvironment hostEnvironment) { _memoryCacheTest = memoryCacheTest; // Create a new FileSystemWatcher and set its properties. _watcher = new FileSystemWatcher { Path = Path.Combine(hostEnvironment.ContentRootPath, "wwwroot", "test"), /* Watch for changes in LastAccess and LastWrite times, and the renaming of files or directories. */ NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName, // Only watch text files. Filter = "*.txt" }; }