2026-01-02 11:14:44 +08:00
|
|
|
|
namespace AddInManager
|
2025-09-04 09:53:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class AddinsApplication : Addins
|
|
|
|
|
|
{
|
2026-01-20 16:03:27 +08:00
|
|
|
|
public void ReadItems(InitFile file)
|
2025-09-04 09:53:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
var num = file.ReadInt("ExternalApplications", "EACount");
|
|
|
|
|
|
var i = 1;
|
|
|
|
|
|
while (i <= num)
|
|
|
|
|
|
{
|
|
|
|
|
|
ReadExternalApplication(file, i++);
|
|
|
|
|
|
}
|
|
|
|
|
|
SortAddin();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 16:03:27 +08:00
|
|
|
|
private bool ReadExternalApplication(InitFile file, int nodeNumber)
|
2025-09-04 09:53:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
var text = file.ReadString("ExternalApplications", $"EAClassName{nodeNumber}");
|
|
|
|
|
|
var text2 = file.ReadString("ExternalApplications", $"EAAssembly{nodeNumber}");
|
|
|
|
|
|
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
AddItem(new AddinItem(AddinType.Application)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = string.Empty,
|
|
|
|
|
|
AssemblyPath = text2,
|
|
|
|
|
|
FullClassName = text
|
|
|
|
|
|
});
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 16:03:27 +08:00
|
|
|
|
public void Save(InitFile file)
|
2025-09-04 09:53:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
file.WriteSection("ExternalApplications");
|
|
|
|
|
|
file.Write("ExternalApplications", "EACount", m_maxCount);
|
|
|
|
|
|
var num = 0;
|
|
|
|
|
|
foreach (var addin in m_addinDict.Values)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var addinItem in addin.ItemList)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (num >= m_maxCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (addinItem.Save)
|
|
|
|
|
|
{
|
|
|
|
|
|
WriteExternalApplication(file, addinItem, ++num);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
file.Write("ExternalApplications", "EACount", num);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 16:03:27 +08:00
|
|
|
|
private bool WriteExternalApplication(InitFile file, AddinItem item, int number)
|
2025-09-04 09:53:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
file.Write("ExternalApplications", $"EAClassName{number}", item.FullClassName);
|
|
|
|
|
|
file.Write("ExternalApplications", $"EAAssembly{number}", item.AssemblyPath);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|