L1SvrFileProvider.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using LJProxy.Services;
  2. using Microsoft.Extensions.FileProviders;
  3. using Microsoft.Extensions.Primitives;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. namespace LJProxy.Providers
  9. {
  10. public class L1SvrFileProvider : IFileProvider
  11. {
  12. private string _contentRoot;
  13. private LJClientPoolService _ljClient;
  14. public L1SvrFileProvider(string contentRoot, LJClientPoolService ljClient)
  15. {
  16. _contentRoot = contentRoot;
  17. _ljClient = ljClient;
  18. }
  19. public IDirectoryContents GetDirectoryContents(string subpath)
  20. {
  21. throw new NotImplementedException();
  22. }
  23. public IFileInfo GetFileInfo(string subpath)
  24. {
  25. string physicSubpath = subpath.Replace("/","\\");
  26. string directory = @$"{_contentRoot}\wwwroot";
  27. var fullFilepath = @$"{directory}{physicSubpath}";
  28. var result = new L1SvrFileInfo(fullFilepath, physicSubpath,_ljClient.Pool);
  29. return result;
  30. }
  31. public IChangeToken Watch(string filter)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. }
  36. }