mirror of
https://github.com/ShrlAlgo/AddinManager.git
synced 2026-03-07 08:28:53 +00:00
优化
This commit is contained in:
6
.idea/.idea.AddInManager/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.AddInManager/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -84,10 +84,7 @@ namespace AddInManager
|
||||
{
|
||||
lock (typeof(AIM))
|
||||
{
|
||||
if (m_inst == null)
|
||||
{
|
||||
m_inst = new AIM();
|
||||
}
|
||||
m_inst ??= new AIM();
|
||||
}
|
||||
}
|
||||
return m_inst;
|
||||
|
||||
@@ -26,11 +26,6 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>-->
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<!-- <Compile Update="Wpf\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
</Compile>-->
|
||||
@@ -74,9 +69,5 @@
|
||||
<None Update="PackageContents.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -34,13 +34,13 @@ namespace AddInManager
|
||||
private void GetIniFilePaths()
|
||||
{
|
||||
var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
var text = Path.Combine(folderPath, Settings.Default.AppFolder);
|
||||
var text2 = Path.Combine(text, "AimInternal.ini");
|
||||
AimIniFile = new IniFile(text2);
|
||||
var appFolder = Path.Combine(folderPath, Resources.AppFolder);
|
||||
var iniFilePath = Path.Combine(appFolder, "AimInternal.ini");
|
||||
AimIniFile = new IniFile(iniFilePath);
|
||||
var currentProcess = Process.GetCurrentProcess();
|
||||
var fileName = currentProcess.MainModule.FileName;
|
||||
var text3 = fileName.Replace(".exe", ".ini");
|
||||
RevitIniFile = new IniFile(text3);
|
||||
var revitIniFilePath = fileName.Replace(".exe", ".ini");
|
||||
RevitIniFile = new IniFile(revitIniFilePath);
|
||||
}
|
||||
|
||||
public void ReadAddinsFromAimIni()
|
||||
@@ -66,8 +66,8 @@ namespace AddInManager
|
||||
}
|
||||
Path.GetFileName(filePath);
|
||||
var assemLoader = new AssemLoader();
|
||||
List<AddinItem> list = null;
|
||||
List<AddinItem> list2 = null;
|
||||
List<AddinItem> cmdItems = null;
|
||||
List<AddinItem> appItems = null;
|
||||
try
|
||||
{
|
||||
assemLoader.HookAssemblyResolve();
|
||||
@@ -76,8 +76,8 @@ namespace AddInManager
|
||||
{
|
||||
return addinType;
|
||||
}
|
||||
list = Commands.LoadItems(assembly, StaticUtil.m_ecFullName, filePath, AddinType.Command);
|
||||
list2 = Applications.LoadItems(assembly, StaticUtil.m_eaFullName, filePath, AddinType.Application);
|
||||
cmdItems = Commands.LoadItems(assembly, StaticUtil.m_ecFullName, filePath, AddinType.Command);
|
||||
appItems = Applications.LoadItems(assembly, StaticUtil.m_eaFullName, filePath, AddinType.Application);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -86,16 +86,16 @@ namespace AddInManager
|
||||
{
|
||||
assemLoader.UnhookAssemblyResolve();
|
||||
}
|
||||
if (list != null && list.Count > 0)
|
||||
if (cmdItems != null && cmdItems.Count > 0)
|
||||
{
|
||||
var addin = new Addin(filePath, list);
|
||||
Commands.AddAddIn(addin);
|
||||
var cmdAddin = new Addin(filePath, cmdItems);
|
||||
Commands.AddAddIn(cmdAddin);
|
||||
addinType |= AddinType.Command;
|
||||
}
|
||||
if (list2 != null && list2.Count > 0)
|
||||
if (appItems != null && appItems.Count > 0)
|
||||
{
|
||||
var addin2 = new Addin(filePath, list2);
|
||||
Applications.AddAddIn(addin2);
|
||||
var appAddin = new Addin(filePath, appItems);
|
||||
Applications.AddAddIn(appAddin);
|
||||
addinType |= AddinType.Application;
|
||||
}
|
||||
return addinType;
|
||||
@@ -105,8 +105,7 @@ namespace AddInManager
|
||||
{
|
||||
if (!File.Exists(RevitIniFile.FilePath))
|
||||
{
|
||||
throw new System.IO.FileNotFoundException(
|
||||
$"can't find the revit.ini file from: {RevitIniFile.FilePath}",
|
||||
throw new System.IO.FileNotFoundException($"路径{RevitIniFile.FilePath}中未找到revit.ini: ",
|
||||
RevitIniFile.FilePath
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace AddInManager
|
||||
stringBuilder.AppendLine($"文件夹[{folderPath}]");
|
||||
stringBuilder.AppendLine($"有{sizeInMB}MB大小");
|
||||
stringBuilder.AppendLine("AddinManager尝试复制所有文件到临时文件夹");
|
||||
stringBuilder.AppendLine("选择[Yes]复制所有文件到临时文件夹");
|
||||
stringBuilder.AppendLine("选择[No]仅复制测试DLL文件到临时文件夹");
|
||||
stringBuilder.AppendLine("选择[Cancel]取消操作");
|
||||
stringBuilder.AppendLine("选择[是(Y)]复制所有文件到临时文件夹");
|
||||
stringBuilder.AppendLine("选择[否(N)]仅复制测试DLL文件到临时文件夹");
|
||||
stringBuilder.AppendLine("选择[取消]取消操作");
|
||||
var text = stringBuilder.ToString();
|
||||
return MessageBox.Show(text, Resources.AppName, MessageBoxButton.YesNoCancel, MessageBoxImage.Information, MessageBoxResult.Yes);
|
||||
}
|
||||
|
||||
15
AddInManager/Properties/Resources.Designer.cs
generated
15
AddInManager/Properties/Resources.Designer.cs
generated
@@ -19,7 +19,7 @@ namespace AddInManager.Properties {
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
@@ -61,7 +61,16 @@ namespace AddInManager.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 AddinManager 的本地化字符串。
|
||||
/// 查找类似 RevitAddInManager 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string AppFolder {
|
||||
get {
|
||||
return ResourceManager.GetString("AppFolder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 插件管理 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string AppName {
|
||||
get {
|
||||
@@ -108,7 +117,7 @@ namespace AddInManager.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Revit Addin Files(*.dll)|*.dll 的本地化字符串。
|
||||
/// 查找类似 外部程序集(*.dll)|*.dll 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string LoadFileFilter {
|
||||
get {
|
||||
|
||||
@@ -117,8 +117,11 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AppFolder" xml:space="preserve">
|
||||
<value>RevitAddInManager</value>
|
||||
</data>
|
||||
<data name="AppName" xml:space="preserve">
|
||||
<value>AddinManager</value>
|
||||
<value>插件管理</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Develop_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
@@ -134,7 +137,7 @@
|
||||
<value>加载失败</value>
|
||||
</data>
|
||||
<data name="LoadFileFilter" xml:space="preserve">
|
||||
<value>Revit Addin Files(*.dll)|*.dll</value>
|
||||
<value>外部程序集(*.dll)|*.dll</value>
|
||||
</data>
|
||||
<data name="LoadSucceed" xml:space="preserve">
|
||||
<value>加载成功</value>
|
||||
|
||||
38
AddInManager/Properties/Settings.Designer.cs
generated
38
AddInManager/Properties/Settings.Designer.cs
generated
@@ -1,38 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddInManager.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("RevitAddInManager")]
|
||||
public string AppFolder {
|
||||
get {
|
||||
return ((string)(this["AppFolder"]));
|
||||
}
|
||||
set {
|
||||
this["AppFolder"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AddInManager.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="AppFolder" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">RevitAddInManager</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -69,7 +69,7 @@
|
||||
Margin="2"
|
||||
Click="SelectAllButton_Click"
|
||||
Style="{StaticResource ToolbarButton}"
|
||||
ToolTip="选择所有命令项">
|
||||
ToolTip="选中所有命令">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
@@ -81,7 +81,7 @@
|
||||
x:Name="selectNoneButton"
|
||||
Click="SelectNoneButton_Click"
|
||||
Style="{StaticResource ToolbarButton}"
|
||||
ToolTip="取消所有选择">
|
||||
ToolTip="取消选中应用">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
@@ -133,7 +133,6 @@
|
||||
MouseDoubleClick="CommandsTreeView_MouseDoubleClick"
|
||||
PreviewMouseRightButtonDown="CommandsTreeView_PreviewMouseRightButtonDown"
|
||||
SelectedItemChanged="CommandsTreeView_SelectedItemChanged">
|
||||
<!-- 为 TreeViewItem 定义右键菜单 (已更新图标) -->
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu x:Name="commandsTreeViewContextMenu">
|
||||
<MenuItem
|
||||
@@ -238,7 +237,7 @@
|
||||
Margin="2"
|
||||
Click="AppSelectAllButton_Click"
|
||||
Style="{StaticResource ToolbarButton}"
|
||||
ToolTip="选择所有命令项">
|
||||
ToolTip="选中所有应用">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
@@ -250,7 +249,7 @@
|
||||
x:Name="appSelectNoneButton"
|
||||
Click="AppSelectNoneButton_Click"
|
||||
Style="{StaticResource ToolbarButton}"
|
||||
ToolTip="取消所有选择">
|
||||
ToolTip="取消选中应用">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user