添加项目文件。

This commit is contained in:
ShrlAlgo
2025-09-16 16:06:41 +08:00
parent 0e7807b826
commit 98c65ceb3d
922 changed files with 1009489 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Szmedi.RevitToolkit.Approval.Models;
namespace Szmedi.RevitToolkit.Approval.Assists
{
internal class IOAssists
{
public static string GetMvdLiteContent(string majorName)
{
var dir = Path.Combine(GlobalAssists.DirAssembly, "mvdlite");
var fileContent = Directory.GetFiles(dir, "*.mvdlite")
.FirstOrDefault(f => f.Contains(majorName)) switch
{
string file when !string.IsNullOrEmpty(file) => File.ReadAllText(file),
_ => throw new FileNotFoundException("未找到对应的MVDLite文件请检查目录或文件名。")
};
return fileContent;
}
public static string GetMvdLiteContent(Major major)
{
var fieldInfo = major.GetType().GetField(major.ToString());
DescriptionAttribute descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
var majorName = descriptionAttribute.Description;
return GetMvdLiteContent(majorName);
}
}
}