//using System; //using System.Collections.Generic; //using System.IO; //using System.Linq; //using Microsoft.AspNetCore.Mvc; //namespace Win_in.Sfs.Wms.Print.Host.Controllers //{ // [Route("/")] // public class InitActiveReportsController : Controller // { // private IList list_report_name = new List();//存储report文件夹下所有模板 // private static string EmbeddedReportsPrefix = "Reports/"; // //[HttpGet] // //public object Index() => Resource("index.html"); // //[HttpGet("{file}")] // //public object Resource(string file) // //{ // // using (Stream stream = new FileStream(Startup.AppPath + "//wwwroot//" + file, FileMode.Open)) // // { // // if (stream == null) // // return new NotFoundResult(); // // if (Path.GetExtension(file) == ".html") // // return new ContentResult() { Content = new StreamReader(stream).ReadToEnd(), ContentType = "text/html" }; // // if (Path.GetExtension(file) == ".ico") // // using (var memoryStream = new MemoryStream()) // // { // // stream.CopyTo(memoryStream); // // return new FileContentResult(memoryStream.ToArray(), "image/x-icon") { FileDownloadName = file }; // // } // // using (var streamReader = new StreamReader(stream)) // // return new FileContentResult(System.Text.Encoding.UTF8.GetBytes(streamReader.ReadToEnd()), // // GetMimeType(file)) // // { FileDownloadName = file }; // // } // //} // private static string GetMimeType(string fileName) // { // if (fileName.EndsWith(".css")) // return "text/css"; // if (fileName.EndsWith(".js")) // return "text/javascript"; // return "text/html"; // } // /// // /// Gets report names from assembly resources // /// // /// Report names // private static string[] GetEmbeddedReports(string[] validExtensions) // { // return // typeof(HomeController).Assembly.GetManifestResourceNames() // .Where(x => x.StartsWith(EmbeddedReportsPrefix) && validExtensions.Any(ext => x.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))) // .Select(x => x.Substring(EmbeddedReportsPrefix.Length + 1)) // .ToArray(); // } // private void ForFileLength(DirectoryInfo directory) // { // DirectoryInfo[] directorys = directory.GetDirectories(); // FileInfo[] files; // foreach (DirectoryInfo di in directorys) // { // ForFileLength(di); // } // files = directory.GetFiles(); // foreach (FileInfo file in files) // { // if (file.Extension.ToLower() == ".rdl" || file.Extension.ToLower() == ".rdlx" || file.Extension.ToLower() == ".rdlx-master" || file.Extension.ToLower() == ".rpx") // { // list_report_name.Add(file.Name); // } // string temp = file.DirectoryName; // 当前路径件 // string name = file.Name; // name 文件名 // } // } // } //}