shgx_tz_mom/ZR.Common/JnHelper.cs

29 lines
810 B
C#
Raw Normal View History

2022-07-05 18:04:59 +08:00
using JinianNet.JNTemplate;
using System;
using System.IO;
namespace ZR.Common
{
public class JnHelper
{
/// <summary>
/// 读取Jn模板
/// </summary>
/// <param name="dirPath"></param>
/// <param name="tplName"></param>
/// <returns></returns>
public static ITemplate ReadTemplate(string dirPath, string tplName)
{
string path = Environment.CurrentDirectory;
string fullName = Path.Combine(path, "wwwroot", dirPath, tplName);
if (File.Exists(fullName))
{
return Engine.LoadTemplate(fullName);
}
2022-12-20 16:06:59 +08:00
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"未找到路径{fullName}");
2022-07-05 18:04:59 +08:00
return null;
}
}
}