You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.3 KiB

namespace EnterpriseCoreV3.Controllers
{
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.IO;
public class MainController : Controller
{
// GET: Main
public ActionResult Index()
{
string s = User.Identity.Name;
if (!string.IsNullOrEmpty(s))
{
s = s.Replace("\\", "\\\\");
}
ViewBag.ADUser = s;
string sJSFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Views", "Main");
int PathLength = sJSFolder.Length;
string [] saJSFiles = Directory.GetFiles(sJSFolder, "*.js");
string[] saFind = { "runtime", "polyfills", "styles", "scripts", "main" };
List<string> lsJSPath = new List<string>();
foreach(string sFind in saFind)
{
foreach(string sJSPath in saJSFiles)
{
if(sJSPath.IndexOf($"{sFind}.") != -1)
{
lsJSPath.Add(sJSPath.Substring(PathLength+1));
break;
}
}
}
ViewBag.JSImports = lsJSPath;
return View();
}
}
}