diff --git a/.idea/.idea.AddInManager/.idea/vcs.xml b/.idea/.idea.AddInManager/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.AddInManager/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AddInManager/AIM.cs b/AddInManager/AIM.cs index 9a200d1..63fbe47 100644 --- a/AddInManager/AIM.cs +++ b/AddInManager/AIM.cs @@ -84,10 +84,7 @@ namespace AddInManager { lock (typeof(AIM)) { - if (m_inst == null) - { - m_inst = new AIM(); - } + m_inst ??= new AIM(); } } return m_inst; diff --git a/AddInManager/AddInManager.csproj b/AddInManager/AddInManager.csproj index 4d2495b..213e96a 100644 --- a/AddInManager/AddInManager.csproj +++ b/AddInManager/AddInManager.csproj @@ -26,11 +26,6 @@ MSBuild:Compile Designer --> - - True - True - Settings.settings - @@ -74,9 +69,5 @@ PreserveNewest - - SettingsSingleFileGenerator - Settings.Designer.cs - \ No newline at end of file diff --git a/AddInManager/AddinManager.cs b/AddInManager/AddinManager.cs index a246471..7c1cc7a 100644 --- a/AddInManager/AddinManager.cs +++ b/AddInManager/AddinManager.cs @@ -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 list = null; - List list2 = null; + List cmdItems = null; + List 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 ); } diff --git a/AddInManager/FolderTooBigDialog.cs b/AddInManager/FolderTooBigDialog.cs index 4456102..c127490 100644 --- a/AddInManager/FolderTooBigDialog.cs +++ b/AddInManager/FolderTooBigDialog.cs @@ -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); } diff --git a/AddInManager/Properties/Resources.Designer.cs b/AddInManager/Properties/Resources.Designer.cs index 0f42d68..b0bdbd0 100644 --- a/AddInManager/Properties/Resources.Designer.cs +++ b/AddInManager/Properties/Resources.Designer.cs @@ -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 { } /// - /// 查找类似 AddinManager 的本地化字符串。 + /// 查找类似 RevitAddInManager 的本地化字符串。 + /// + internal static string AppFolder { + get { + return ResourceManager.GetString("AppFolder", resourceCulture); + } + } + + /// + /// 查找类似 插件管理 的本地化字符串。 /// internal static string AppName { get { @@ -108,7 +117,7 @@ namespace AddInManager.Properties { } /// - /// 查找类似 Revit Addin Files(*.dll)|*.dll 的本地化字符串。 + /// 查找类似 外部程序集(*.dll)|*.dll 的本地化字符串。 /// internal static string LoadFileFilter { get { diff --git a/AddInManager/Properties/Resources.resx b/AddInManager/Properties/Resources.resx index c51c79b..e24b8f4 100644 --- a/AddInManager/Properties/Resources.resx +++ b/AddInManager/Properties/Resources.resx @@ -117,8 +117,11 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + RevitAddInManager + - AddinManager + 插件管理 @@ -134,7 +137,7 @@ 加载失败 - Revit Addin Files(*.dll)|*.dll + 外部程序集(*.dll)|*.dll 加载成功 diff --git a/AddInManager/Properties/Settings.Designer.cs b/AddInManager/Properties/Settings.Designer.cs deleted file mode 100644 index d24e934..0000000 --- a/AddInManager/Properties/Settings.Designer.cs +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -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; - } - } - } -} diff --git a/AddInManager/Properties/Settings.settings b/AddInManager/Properties/Settings.settings deleted file mode 100644 index 7d75a79..0000000 --- a/AddInManager/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - RevitAddInManager - - - \ No newline at end of file diff --git a/AddInManager/Wpf/MainWindow.xaml b/AddInManager/Wpf/MainWindow.xaml index f175165..b162fab 100644 --- a/AddInManager/Wpf/MainWindow.xaml +++ b/AddInManager/Wpf/MainWindow.xaml @@ -69,7 +69,7 @@ Margin="2" Click="SelectAllButton_Click" Style="{StaticResource ToolbarButton}" - ToolTip="选择所有命令项"> + ToolTip="选中所有命令"> + ToolTip="取消选中应用"> - + ToolTip="选中所有应用"> + ToolTip="取消选中应用">