添加项目文件。

This commit is contained in:
GG Z
2024-09-22 11:05:41 +08:00
parent fb5d55723a
commit 49ceaae6a8
764 changed files with 78850 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
#region
using System;
using System.IO;
using Autodesk.RevitAddIns;
#endregion
namespace Sai.RvKits_Setup
{
public class AddInManager
{
private RevitAddInManifest Manifest { get; }
private string ManifestPath { get; }
internal AddInManager(string revitVersion, string addInName)
{
Manifest = new RevitAddInManifest();
ManifestPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
$@"Autodesk\ApplicationPlugins\{Settings.AddInAppName}.bundle\Contents", revitVersion, addInName);
//ManifestPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Autodesk\\Revit\\Addins", revitVersion, addInName);
}
internal void CreateApplication(string name, string assemblyPath, string fullClassName)
{
var item =
new RevitAddInApplication(name, assemblyPath, Guid.NewGuid(), fullClassName, Settings.VendorId)
{
VendorDescription = Settings.VendorDescription
};
Manifest.AddInApplications.Add(item);
}
internal void CreateCommand(string assemblyPath, string fullClassName)
{
var item = new RevitAddInCommand(assemblyPath, Guid.NewGuid(), fullClassName, Settings.VendorId)
{
VendorDescription = Settings.VendorDescription
};
Manifest.AddInCommands.Add(item);
}
internal void Install()
{
var directory = new FileInfo(ManifestPath).Directory;
if (directory == null)
{
return;
}
if (!directory.Exists)
{
Directory.CreateDirectory(directory.FullName);
}
Manifest.SaveAs(ManifestPath);
}
internal void Uninstall()
{
if (File.Exists(ManifestPath))
{
File.Delete(ManifestPath);
}
}
}
}