油漆
This commit is contained in:
28
server/ZR.Common/JnHelper.cs
Normal file
28
server/ZR.Common/JnHelper.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine($"未找到路径{fullName}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user