// Decompiled with JetBrains decompiler // Type: Autodesk.AutoCAD.ADMigrator.CUIFileMigrator // Assembly: ADMigrator, Version=18.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: 1EA8663B-E949-4FAD-ABC5-280393847F56 // Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Sality.sil-906e49d7772808af1fb67511fd33b01c809079fddb77015425883ca9739cad33.exe using Autodesk.AutoCAD.Customization; using Autodesk.AutoCAD.CustomMigrator; using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.IO; namespace Autodesk.AutoCAD.ADMigrator { public class CUIFileMigrator : IDisposable { public static ILogXML _logger; private bool _deleteGeneratedPackage; private bool _adskSourceFile; private bool LTConversion; public static ArrayList TargetFiles; private CustomizationSection sourceCUI; private CustomizationSection targetCUI; private ProductInfo _sourceInfo; private ProductInfo _destInfo; public CUIFileMigrator( string source, ILogXML mainFormLogger, ProductInfo srcInfo, ProductInfo dstInfo) { if (source == null || source.Length < 1) return; CUIFileMigrator._logger = mainFormLogger; this._sourceInfo = srcInfo; this._destInfo = dstInfo; try { this.sourceCUI = new CustomizationSection(source, true, false); if (string.Compare(Path.GetExtension(this.SourceFile), CustomizationSection.EXTENSION_XML, true) != 0) return; string str = Path.ChangeExtension(this.SourceFile, CustomizationSection.EXTENSION_OPC); this._deleteGeneratedPackage = this.sourceCUI.SaveAs(str); this.sourceCUI = new CustomizationSection(str, true, false); } catch (FileNotFoundException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_CUI_FILE_NOT_FOUND"), (object) source); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } public void Dispose() { if (!this._deleteGeneratedPackage || this.sourceCUI == null || string.Compare(this.sourceCUI.CUIFileName, this.targetCUI.CUIFileName, true, CultureInfo.InvariantCulture) == 0 || string.Compare(Path.GetExtension(this.SourceFile), CustomizationSection.EXTENSION_OPC, true) != 0) return; File.Delete(this.SourceFile); this.sourceCUI = (CustomizationSection) null; this._deleteGeneratedPackage = false; } public bool AutodeskSourceFile => this._adskSourceFile; public static void SetTargetFiles(StringCollection targetFiles) { if (CUIFileMigrator.TargetFiles == null) CUIFileMigrator.TargetFiles = new ArrayList(); foreach (string targetFile in targetFiles) { CustomizationSection customizationSection = (CustomizationSection) null; try { MainForm.isTarget = true; customizationSection = new CustomizationSection(targetFile, true, false); } catch (FileNotFoundException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_CUI_FILE_NOT_FOUND"), (object) targetFile); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); break; } finally { MainForm.isTarget = false; } if (customizationSection != null) CUIFileMigrator.TargetFiles.Add((object) customizationSection); } } public string SourceFile => this.sourceCUI != null ? this.sourceCUI.CUIFileName : (string) null; public string TargetFile => this.targetCUI != null ? this.targetCUI.CUIFileName : (string) null; public bool FindInitialTarget() { if (this.sourceCUI != null && this.sourceCUI.CuiFileVersion.UserVersion == 0) { string macroGroupName = (string) null; foreach (MacroGroup macroGroup in (CollectionBase) this.sourceCUI.MenuGroup.MacroGroups) { if (macroGroup.IsClassA()) macroGroupName = macroGroup.Name; } if (macroGroupName != null) { CUIFileMap mapFromMacroGroup = MainForm.GetFileMapFromMacroGroup(macroGroupName); if (mapFromMacroGroup != null) macroGroupName = mapFromMacroGroup.TargetMacroGroupName; this._adskSourceFile = true; foreach (CustomizationSection targetFile in CUIFileMigrator.TargetFiles) { if (targetFile.MenuGroup.MacroGroups.Contains(macroGroupName)) { this.targetCUI = targetFile; break; } } } } return this.targetCUI != null; } public bool MergeFiles() { if (this.sourceCUI == null || this.targetCUI == null) return false; if (!this._adskSourceFile) return true; this.MergeMacros(); this.MergeMenuGroup(); this.MergeWorkspaces(); this.MergePartialFiles(); this.MergeLSPFiles(); if (this.sourceCUI.MenuGroup.Name != this.targetCUI.MenuGroup.Name) { CUIFileMap mapFromMenuGroup = MainForm.GetFileMapFromMenuGroup(this.sourceCUI.MenuGroup.Name); if (mapFromMenuGroup != null) { if (this.targetCUI.MenuGroup.Name == mapFromMenuGroup.TargetMenuGroupName) { this.targetCUI.MenuGroup.Name = mapFromMenuGroup.SourceMenuGroupName; this.targetCUI.MenuGroup.Name = mapFromMenuGroup.TargetMenuGroupName; } } } try { MainForm.isTarget = true; this.targetCUI.Save(); if (this.targetCUI.ParentCUI != null) { if (this.targetCUI.ParentCUI.IsModified) this.targetCUI.ParentCUI.Save(); } } catch (FileSaveException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) this.targetCUI.CUIFileName); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); return false; } finally { MainForm.isTarget = false; } return true; } private void MergeMacros() { foreach (MacroGroup macroGroup1 in (CollectionBase) this.sourceCUI.MenuGroup.MacroGroups) { StringCollection stringCollection = new StringCollection(); MacroGroup macroGroup2 = (MacroGroup) null; CUIFileMap mapFromMacroGroup = MainForm.GetFileMapFromMacroGroup(macroGroup1.Name); foreach (MacroGroup macroGroup3 in (CollectionBase) this.targetCUI.MenuGroup.MacroGroups) { if (string.Compare(macroGroup1.Name, macroGroup3.Name, true, CultureInfo.InvariantCulture) == 0) { macroGroup2 = macroGroup3; break; } if (mapFromMacroGroup != null && mapFromMacroGroup.TargetMacroGroupName.Equals(macroGroup3.Name, StringComparison.InvariantCultureIgnoreCase)) { macroGroup2 = macroGroup3; if (!MainForm.isACAD) { this.LTConversion = true; break; } break; } } if (macroGroup2 != null) { foreach (MenuMacro menuMacro1 in (CollectionBase) macroGroup1.MenuMacros) { bool flag = false; foreach (VersionableElement macro in menuMacro1.Macros) { if (macro.UserModified()) flag = true; } if (flag) { MenuMacro menuMacro2 = this.targetCUI.FindMenuMacro(((CustomizationElement) menuMacro1).ElementID); if (menuMacro2 != null) { foreach (Macro macro in menuMacro1.Macros) { if (((VersionableElement) macro).UserModified()) { menuMacro2.Macros.Add(macro); if (!string.IsNullOrEmpty(macro.SmallImage) && macro.SmallImage.IndexOf('.') >= 0 && !StringArrayUtilities.Contains(stringCollection, macro.SmallImage, true)) stringCollection.Add(macro.SmallImage); if (!string.IsNullOrEmpty(macro.LargeImage) && macro.LargeImage.IndexOf('.') >= 0 && !StringArrayUtilities.Contains(stringCollection, macro.LargeImage, true)) stringCollection.Add(macro.LargeImage); } } } } } } else { this.targetCUI.MenuGroup.MacroGroups.Clone(macroGroup1); foreach (MenuMacro menuMacro in (CollectionBase) macroGroup1.MenuMacros) { foreach (Macro macro in menuMacro.Macros) { if (!string.IsNullOrEmpty(macro.SmallImage) && macro.SmallImage.IndexOf('.') >= 0 && !StringArrayUtilities.Contains(stringCollection, macro.SmallImage, true)) stringCollection.Add(macro.SmallImage); if (!string.IsNullOrEmpty(macro.LargeImage) && macro.LargeImage.IndexOf('.') >= 0 && !StringArrayUtilities.Contains(stringCollection, macro.LargeImage, true)) stringCollection.Add(macro.LargeImage); } } } if (stringCollection.Count > 0) { string[] strArray = new string[stringCollection.Count]; for (int index = 0; index < stringCollection.Count; ++index) strArray[index] = stringCollection[index]; MenuPackage.CopyPartsBetweenPackages(this.sourceCUI.CUIFileName, this.targetCUI.CUIFileName, strArray, true); } } } private void MergeMenuGroup() { if (this.LTConversion) { this.LTConvertMenuGroup(); } else { if (this.sourceCUI.MenuGroup.Accelerators != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.Accelerators, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.Accelerators); if (this.sourceCUI.MenuGroup.TemporaryOverrides != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.TemporaryOverrides, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.TemporaryOverrides); if (this.sourceCUI.MenuGroup.MouseButtons != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.MouseButtons, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.MouseButtons); if (this.sourceCUI.MenuGroup.DigitizerButtons != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.DigitizerButtons, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.DigitizerButtons); if (this.sourceCUI.MenuGroup.PopMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.PopMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.PopMenus); if (this.sourceCUI.MenuGroup.Toolbars != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.Toolbars, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.Toolbars); if (this.sourceCUI.MenuGroup.ScreenMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.ScreenMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.ScreenMenus); if (this.sourceCUI.MenuGroup.TabletMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.TabletMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.TabletMenus); if (this.sourceCUI.MenuGroup.QuickAccessToolbars != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.QuickAccessToolbars, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.QuickAccessToolbars); if (this.sourceCUI.MenuGroup.QuickPropertiesObjectTypes != null) this.GenericObjectTypes((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.QuickPropertiesObjectTypes, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.QuickPropertiesObjectTypes); if (this.sourceCUI.MenuGroup.RolloverTooltipObjectTypes != null) this.GenericObjectTypes((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.RolloverTooltipObjectTypes, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.RolloverTooltipObjectTypes); if (this.sourceCUI.MenuGroup.ImageMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.ImageMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.ImageMenus); if (this.sourceCUI.MenuGroup.DoubleClickActions == null) return; this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.DoubleClickActions, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.DoubleClickActions); } } private void MergeObjectProperty( ICustomizationContainer scontainer, ICustomizationContainer tcontainer) { if (scontainer == null || tcontainer == null) return; foreach (CustomizationElement container1 in (CollectionBase) scontainer.ContainerCollection) { if (container1 != null && ((VersionableElement) container1).UserModified()) { ObjectPropertyCategory propertyCategory1 = container1 as ObjectPropertyCategory; ObjectProperty objectProperty1 = container1 as ObjectProperty; if (propertyCategory1 != null || objectProperty1 != null) { if (propertyCategory1 != null) { PropertyCollection propertyList = propertyCategory1.PropertyList; if (propertyList != null) { foreach (ObjectProperty objectProperty2 in (CollectionBase) propertyList) { if (objectProperty2 != null && ((VersionableElement) objectProperty2).UserModified()) { ObjectPropertyCategory propertyCategory2 = (ObjectPropertyCategory) null; foreach (CustomizationElement container2 in (CollectionBase) tcontainer.ContainerCollection) { if (container2 is ObjectPropertyCategory propertyCategory3 && propertyCategory3.categoryId == propertyCategory1.categoryId) { propertyCategory2 = propertyCategory3; break; } } if (propertyCategory2 != null && propertyCategory2.PropertyList != null) { if (!propertyCategory2.PropertyList.Contains(((ObjectPropertyBase) objectProperty2).Name)) propertyCategory2.PropertyList.Add((ObjectPropertyBase) objectProperty2); } else if (propertyCategory2 == null) { ((IList) tcontainer.ContainerCollection).Add((object) propertyCategory1); break; } } } } } else if (objectProperty1 != null && ((VersionableElement) objectProperty1).UserModified()) { bool flag = false; foreach (CustomizationElement container3 in (CollectionBase) tcontainer.ContainerCollection) { if (container3 is ObjectProperty objectProperty3 && ((ObjectPropertyBase) objectProperty1).Name == ((ObjectPropertyBase) objectProperty3).Name) { flag = true; break; } } if (!flag) ((IList) tcontainer.ContainerCollection).Add((object) objectProperty1); } } } } ArrayList arrayList1 = new ArrayList(); ArrayList arrayList2 = new ArrayList(); foreach (CustomizationElement container4 in (CollectionBase) tcontainer.ContainerCollection) { ObjectPropertyCategory propertyCategory4 = container4 as ObjectPropertyCategory; ObjectProperty objectProperty4 = container4 as ObjectProperty; if (propertyCategory4 != null || objectProperty4 != null) { if (propertyCategory4 != null && ((VersionableElement) propertyCategory4).ModifiedRevision < 4) { ObjectPropertyCategory propertyCategory5 = (ObjectPropertyCategory) null; foreach (CustomizationElement container5 in (CollectionBase) scontainer.ContainerCollection) { if (container5 is ObjectPropertyCategory propertyCategory6 && propertyCategory6.categoryId == propertyCategory4.categoryId) { propertyCategory5 = propertyCategory6; break; } } if (propertyCategory5 == null) arrayList1.Add((object) ((CustomizationElement) propertyCategory4).ElementID); else if (propertyCategory5.PropertyList != null) { PropertyCollection propertyList = propertyCategory4.PropertyList; if (propertyList != null) { ArrayList arrayList3 = new ArrayList(); foreach (ObjectProperty objectProperty5 in (CollectionBase) propertyList) { if (objectProperty5 != null && !propertyCategory5.PropertyList.Contains(((ObjectPropertyBase) objectProperty5).Name)) arrayList3.Add((object) objectProperty5); } foreach (ObjectProperty objectProperty6 in arrayList3) propertyList.Remove((ObjectPropertyBase) objectProperty6); } } } else if (objectProperty4 != null && ((VersionableElement) objectProperty4).ModifiedRevision < 4 && scontainer.ContainerCollection.IndexOf(((ObjectPropertyBase) objectProperty4).Name) < 0) arrayList2.Add((object) ((ObjectPropertyBase) objectProperty4).Name); } } foreach (string str in arrayList1) { int index = tcontainer.ContainerCollection.IndexOf(str); if (index >= 0) ((CollectionBase) tcontainer.ContainerCollection).RemoveAt(index); } foreach (string str in arrayList2) { int index = tcontainer.ContainerCollection.IndexOf(str); if (index >= 0) ((CollectionBase) tcontainer.ContainerCollection).RemoveAt(index); } } private void GenericObjectTypes( MenuGroupItemsCollection smgCollection, MenuGroupItemsCollection tmgCollection) { foreach (CustomizationElement smg in (CollectionBase) smgCollection) { ObjectType objectType = smg as ObjectType; CustomizationElement withName = (CustomizationElement) (tmgCollection as ObjectTypeCollection).FindWithName(objectType.ClassName); ICustomizationContainer scontainer = (ICustomizationContainer) objectType; ICustomizationContainer tcontainer = withName as ICustomizationContainer; if (((VersionableElement) objectType).UserModified()) { if (withName == null) { ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; tmgCollection.Clone((CustomizationElement) objectType, (CustomizationElement) null, ref containerCloneAction); } else if (scontainer != null) this.MergeObjectProperty(scontainer, tcontainer); else withName.Replace((CustomizationElement) objectType); } else if (scontainer != null && tcontainer != null) this.MergeObjectProperty(scontainer, tcontainer); } } private void GenericMigration( MenuGroupItemsCollection smgCollection, MenuGroupItemsCollection tmgCollection) { foreach (CustomizationElement smg in (CollectionBase) smgCollection) { CustomizationElement menuObj1 = (CustomizationElement) this.targetCUI.getMenuObj(smg.ElementID); ICustomizationContainer icustomizationContainer1 = smg as ICustomizationContainer; ICustomizationContainer icustomizationContainer2 = menuObj1 as ICustomizationContainer; if (((VersionableElement) smg).UserModified()) { if (menuObj1 == null) { ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; tmgCollection.Clone(smg, (CustomizationElement) null, ref containerCloneAction); } else if (icustomizationContainer1 != null) { SortedList newItems = this.FindNewItems(icustomizationContainer1.ContainerCollection, icustomizationContainer2.ContainerCollection); menuObj1.Replace(smg); foreach (CustomizationElement container in (CollectionBase) icustomizationContainer1.ContainerCollection) { if (this.ValidReference(container)) ((IList) icustomizationContainer2.ContainerCollection).Add((object) container); } if (newItems.Count > 0) { foreach (DictionaryEntry dictionaryEntry in newItems) { if (dictionaryEntry.Value is CustElementLocation custElementLocation) { int num = icustomizationContainer2.ContainerCollection.IndexOf(custElementLocation.CustElement.ElementID); if (num > -1) { CustomizationElement container = icustomizationContainer2.ContainerCollection[num]; if (!((VersionableElement) container).UserModified()) icustomizationContainer2.ContainerCollection.Replace(container, custElementLocation.CustElement); } else { int index = custElementLocation.insertAfter != null ? icustomizationContainer2.ContainerCollection.IndexOf(custElementLocation.insertAfter.ElementID) + custElementLocation.offset : custElementLocation.offset; if (index > ((CollectionBase) icustomizationContainer2.ContainerCollection).Count) index = ((CollectionBase) icustomizationContainer2.ContainerCollection).Count; ((IList) icustomizationContainer2.ContainerCollection).Insert(index, (object) custElementLocation.CustElement); } } } } } else menuObj1.Replace(smg); } else if (icustomizationContainer1 != null && icustomizationContainer2 != null) { foreach (CustomizationElement container in (CollectionBase) icustomizationContainer1.ContainerCollection) { if (this.ValidReference(container)) { CustomizationElement menuObj2 = (CustomizationElement) this.targetCUI.getMenuObj(container.ElementID); if (menuObj2 != null) { if (((VersionableElement) container).UserModified()) icustomizationContainer2.ContainerCollection.Replace(menuObj2, container); if (!icustomizationContainer2.ContainerCollection.Contains(menuObj2) && ((VersionableElement) container).UserModified()) { int index = icustomizationContainer1.ContainerCollection.IndexOf(container.ElementID); if (index > ((CollectionBase) icustomizationContainer2.ContainerCollection).Count) index = ((CollectionBase) icustomizationContainer2.ContainerCollection).Count; if (((ElementBase) menuObj2).Parent is ICustomizationContainer parent) { ((IList) parent.ContainerCollection).Remove((object) menuObj2); ((IList) icustomizationContainer2.ContainerCollection).Insert(index, (object) container); } } } else if (container.ElementID != null && ((VersionableElement) container).UserModified()) { int index = icustomizationContainer1.ContainerCollection.IndexOf(container.ElementID); if (index > ((CollectionBase) icustomizationContainer2.ContainerCollection).Count) index = ((CollectionBase) icustomizationContainer2.ContainerCollection).Count; ((IList) icustomizationContainer2.ContainerCollection).Insert(index, (object) container); } } } ArrayList arrayList = new ArrayList(); for (int index = 0; index < ((CollectionBase) icustomizationContainer2.ContainerCollection).Count; ++index) { CustomizationElement container = icustomizationContainer2.ContainerCollection[index]; if (container.ElementID != null && icustomizationContainer1.ContainerCollection.IndexOf(container.ElementID) < 0 && ((VersionableElement) container).ModifiedRevision < 4) arrayList.Add((object) icustomizationContainer2.ContainerCollection[index]); } foreach (CustomizationElement customizationElement in arrayList) { int index = icustomizationContainer2.ContainerCollection.IndexOf(customizationElement.ElementID); if (index >= 0) ((CollectionBase) icustomizationContainer2.ContainerCollection).RemoveAt(index); } } } } private bool ValidReference(CustomizationElement ce) => !(ce is IReference ireference) || ireference.MacroID == null || this.targetCUI.FindMenuMacro(ireference.MacroID) != null; private void MergeWorkspaces() { string profileWorkspaceName = Migrator.GetCurrentProfileWorkspaceName(this._sourceInfo.m_regRootKey); bool flag = false; foreach (Workspace workspace in (CollectionBase) this.sourceCUI.Workspaces) { if (((VersionableElement) workspace).UserModified()) { string name = workspace.Name; string str = string.Format(LocalResources.GetString("RENAMED_WORKSPACE_SUFFIX"), (object) workspace.Name, (object) this._sourceInfo.m_productName); int num = 1; object[] objArray; for (; ((CustomizationCollection) this.targetCUI.Workspaces).IndexOf(str) >= 0; str = string.Concat(objArray)) objArray = new object[4] { (object) str, (object) " [", (object) num++.ToString(), (object) ']' }; workspace.Name = str; ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; this.targetCUI.Workspaces.MigrateWorkspace(workspace, (Workspace) null, ref containerCloneAction); workspace.Name = name; if (string.Compare(name, profileWorkspaceName, true) == 0) { Migrator.SetCurrentProfileWorkspaceName(this._destInfo.m_regRootKey, str); flag = true; } } } if (flag) return; Workspace workspace1 = (Workspace) null; foreach (Workspace workspace2 in (CollectionBase) this.sourceCUI.Workspaces) { if (workspace2.DefaultWorkspace) { workspace1 = workspace2; break; } } if (workspace1 == null) return; Migrator.SetCurrentProfileWorkspaceName(this._destInfo.m_regRootKey, workspace1.Name); } private void MergePartialFiles() { if (this.sourceCUI.PartialCuiFiles == null || ((StringCollection) this.sourceCUI.PartialCuiFiles).Count <= 0) return; foreach (string partialCuiFile1 in (StringCollection) this.sourceCUI.PartialCuiFiles) { string withoutExtension1; try { withoutExtension1 = Path.GetFileNameWithoutExtension(partialCuiFile1); } catch (ArgumentException ex) { continue; } if (!Util.IsEmpty(withoutExtension1) && (!this._sourceInfo.IsBeforeGator() || !withoutExtension1.Equals("ContentSearch", StringComparison.OrdinalIgnoreCase) && !withoutExtension1.Equals("AcImpression", StringComparison.OrdinalIgnoreCase) && !withoutExtension1.Equals("Acetmain", StringComparison.OrdinalIgnoreCase))) { bool flag = false; CUIFileMap fileMapFromFileName = MainForm.GetFileMapFromFileName(withoutExtension1); if (fileMapFromFileName != null) withoutExtension1 = Path.GetFileNameWithoutExtension(fileMapFromFileName.TargetFileName); foreach (string partialCuiFile2 in (StringCollection) this.targetCUI.PartialCuiFiles) { string withoutExtension2; try { withoutExtension2 = Path.GetFileNameWithoutExtension(partialCuiFile2); } catch (ArgumentException ex) { continue; } if (!Util.IsEmpty(withoutExtension2) && withoutExtension1.Equals(withoutExtension2, StringComparison.InvariantCultureIgnoreCase)) { flag = true; break; } } if (!flag) ((CuiFileCollectionBase) this.targetCUI.PartialCuiFiles).Add(Path.ChangeExtension(withoutExtension1, CustomizationSection.EXTENSION_OPC)); } } } private void MergeLSPFiles() { if (this.sourceCUI.MenuGroup.LspFiles == null || ((StringCollection) this.sourceCUI.MenuGroup.LspFiles).Count <= 0) return; foreach (string lspFile in (StringCollection) this.sourceCUI.MenuGroup.LspFiles) { if (!((CuiFileCollectionBase) this.targetCUI.MenuGroup.LspFiles).Contains(lspFile)) ((CuiFileCollectionBase) this.targetCUI.MenuGroup.LspFiles).Add(lspFile); } } private SortedList FindNewItems( CustomizationCollection sourceCollection, CustomizationCollection targetCollection) { SortedList newItems = new SortedList(); foreach (CustomizationElement target1 in (CollectionBase) targetCollection) { int num1 = sourceCollection.IndexOf(target1.ElementID); if (((VersionableElement) target1).ModifiedRevision == 4) { CustElementLocation custElementLocation = new CustElementLocation(target1); int key = targetCollection.IndexOf(target1.ElementID); if (num1 < 0) { int num2 = 0; while (num1 < 0) { ++num2; if (key - num2 >= 0) { CustomizationElement target2 = targetCollection[key - num2]; if (target2 != null && target2.ElementID != null) num1 = sourceCollection.IndexOf(target2.ElementID); } else break; } if (num1 > -1) { custElementLocation.insertAfter = sourceCollection[num1]; custElementLocation.offset = num2; } else custElementLocation.offset = key; } else custElementLocation.offset = 0; try { newItems.Add((object) key, (object) custElementLocation); } catch (ArgumentException ex) { } } } return newItems; } public static StringCollection FindTargetCUIFiles(string regRoot) { StringCollection targetCuiFiles = new StringCollection(); CUIFileMigrator.FindCUIFiles(Migrator.GetAppInstallDir(regRoot) + "UserDataCache", targetCuiFiles); CUIFileMigrator.SetTargetFiles(targetCuiFiles); return targetCuiFiles; } public static void FindCUIFiles(string rootPath, StringCollection installedFiles) { try { string searchPattern = string.Format("*{0}", (object) CustomizationSection.EXTENSION_OPC); string[] files = Directory.GetFiles(rootPath, searchPattern); if (files.Length > 0) { foreach (string path in files) { if (string.Compare(Path.GetExtension(path), CustomizationSection.EXTENSION_OPC, true, CultureInfo.InvariantCulture) == 0) installedFiles.Add(path); } } string[] directories = Directory.GetDirectories(rootPath); if (directories.Length <= 0) return; foreach (string rootPath1 in directories) CUIFileMigrator.FindCUIFiles(rootPath1, installedFiles); } catch (Exception ex) { string sLine = string.Format(LocalResources.GetString("ERROR_USERDATACACHE_NOT_FOUND")); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } public bool SetFinalTarget(ProfileMigrator pm, string targetRootKey) { string path = Migrator.GetRoamableRootFolder(targetRootKey) + "Backup\\"; string strA = pm.SourceEncode(this.SourceFile); string str1 = pm.TargetExpand(strA); if (File.Exists(str1)) { string str2 = Path.GetExtension(str1); if (Util.IsEmpty(str2)) str2 = CustomizationSection.EXTENSION_XML; string str3 = Path.GetDirectoryName(str1) + "\\" + Path.GetFileNameWithoutExtension(str1) + ".bak" + str2; try { File.Copy(str1, str3, true); if ((File.GetAttributes(str3) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str3, File.GetAttributes(str3) ^ FileAttributes.ReadOnly); } catch (UnauthorizedAccessException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str3); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } if (this._adskSourceFile && this.TargetFile != null) { if (string.Compare(this.SourceFile, str1, true, CultureInfo.InvariantCulture) != 0) { string str4 = path + Path.GetFileName(this.SourceFile); try { if (!Directory.Exists(path)) Directory.CreateDirectory(path); File.Copy(this.SourceFile, str4, true); if ((File.GetAttributes(str4) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str4, File.GetAttributes(str4) ^ FileAttributes.ReadOnly); } catch (Exception ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str4); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } if (MainForm.CUIFileMapArray.Count > 0) { CUIFileMap fileMapFromFileName = MainForm.GetFileMapFromFileName(Path.GetFileName(this.SourceFile)); if (fileMapFromFileName != null) str1 = str1.ToLower().Replace(fileMapFromFileName.SourceFileName.ToLower(), fileMapFromFileName.TargetFileName.ToLower()); } if (File.Exists(str1)) { string str5 = path + Path.GetFileName(str1); if (!File.Exists(str5)) { try { if (!Directory.Exists(path)) Directory.CreateDirectory(path); File.Copy(str1, str5, false); if ((File.GetAttributes(str5) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str5, File.GetAttributes(str5) ^ FileAttributes.ReadOnly); } catch (UnauthorizedAccessException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str5); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } } try { if (!Directory.Exists(Path.GetDirectoryName(str1))) Directory.CreateDirectory(Path.GetDirectoryName(str1)); File.Copy(this.TargetFile, str1, true); if ((File.GetAttributes(str1) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str1, File.GetAttributes(str1) ^ FileAttributes.ReadOnly); } catch (Exception ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str1); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } else { string marketReleaseVersion = this.GetProductMarketReleaseVersion(this._destInfo); int length = str1.LastIndexOf(CustomizationSection.EXTENSION_OPC); str1 = length <= -1 ? str1 + "_" + marketReleaseVersion + CustomizationSection.EXTENSION_OPC : str1.Substring(0, length) + "_" + marketReleaseVersion + CustomizationSection.EXTENSION_OPC; try { if (!Directory.Exists(Path.GetDirectoryName(str1))) Directory.CreateDirectory(Path.GetDirectoryName(str1)); File.Copy(this.TargetFile, str1, true); if ((File.GetAttributes(str1) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str1, File.GetAttributes(str1) ^ FileAttributes.ReadOnly); } catch (Exception ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str1); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } } else if (string.Compare(strA, str1, true, CultureInfo.InvariantCulture) != 0) { if (File.Exists(str1)) { string str6 = path + Path.GetFileName(str1); if (!File.Exists(str6)) { try { if (!Directory.Exists(Path.GetDirectoryName(path))) Directory.CreateDirectory(Path.GetDirectoryName(path)); File.Copy(str1, str6, false); if ((File.GetAttributes(str6) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str6, File.GetAttributes(str6) ^ FileAttributes.ReadOnly); } catch (UnauthorizedAccessException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str6); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } } try { if (!Directory.Exists(Path.GetDirectoryName(str1))) Directory.CreateDirectory(Path.GetDirectoryName(str1)); File.Copy(this.SourceFile, str1, true); if ((File.GetAttributes(str1) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) File.SetAttributes(str1, File.GetAttributes(str1) ^ FileAttributes.ReadOnly); } catch (Exception ex) { string sLine = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) str1); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); } } try { MainForm.isTarget = true; this.targetCUI = new CustomizationSection(str1, true, false); } catch (FileNotFoundException ex) { string sLine = string.Format(LocalResources.GetString("ERROR_CUI_FILE_NOT_FOUND"), (object) this.SourceFile); MainForm.Log2File(sLine); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, sLine); return false; } finally { MainForm.isTarget = false; } return true; } internal string GetProductMarketReleaseVersion(ProductInfo prod) { int num = prod.m_productName.LastIndexOf(" "); if (num != -1) { string marketReleaseVersion = prod.m_productName.Substring(num + 1).Trim(); if (!string.IsNullOrEmpty(marketReleaseVersion)) return marketReleaseVersion; } return prod.m_productName; } public StringCollection GetPartialsFromSource() { StringCollection partialsFromSource = new StringCollection(); if (this.sourceCUI.PartialCuiFiles != null && ((StringCollection) this.sourceCUI.PartialCuiFiles).Count > 0) { foreach (string partialCuiFile in (StringCollection) this.sourceCUI.PartialCuiFiles) partialsFromSource.Add(partialCuiFile); } return partialsFromSource; } public void CopyImagesDll() { if (this.AutodeskSourceFile) return; CUIFileMap cuiFileMap = (CUIFileMap) null; if (this.sourceCUI != null && this.sourceCUI.MenuGroup != null) cuiFileMap = MainForm.GetFileMapFromMenuGroup(this.sourceCUI.MenuGroup.Name); string str1 = Path.GetDirectoryName(this.SourceFile) + "\\" + Path.GetFileNameWithoutExtension(this.SourceFile) + ".dll"; if (!File.Exists(str1)) return; string destFileName = Path.GetDirectoryName(this.TargetFile) + "\\" + Path.GetFileNameWithoutExtension(cuiFileMap == null ? this.SourceFile : cuiFileMap.TargetFileName) + ".dll"; try { File.Copy(str1, destFileName, false); string str2 = string.Format(LocalResources.GetString("LOG_FILE_COPY"), (object) str1, (object) destFileName); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 3, str2); } catch (Exception ex) { string str3 = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) destFileName); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, str3); } } public static void RemoveUnresolvedReferences( CUIFileMigrator main, IList partials) { if (!main._sourceInfo.IsRaptor()) return; CUIFileMigrator.RemoveUnresolvedRibbonTabReferences(main, partials); } public static void RemoveUnresolvedRibbonTabReferences( CUIFileMigrator main, IList partials) { CustomizationSection targetCui1 = main.targetCUI; foreach (Workspace workspace in (CollectionBase) targetCui1.Workspaces) { IList tabSourceReferenceList = (IList) new List(); foreach (WSRibbonTabSourceReference workspaceTab in (CollectionBase) workspace.WorkspaceRibbonRoot.WorkspaceTabs) { bool flag = null != targetCui1.MenuGroup.RibbonRoot.FindTab(workspaceTab.TabId); if (!flag) { foreach (CUIFileMigrator partial in (IEnumerable) partials) { CustomizationSection targetCui2 = partial.targetCUI; if (targetCui2 != null && targetCui2.MenuGroup.RibbonRoot.FindTab(workspaceTab.TabId) != null) { flag = true; break; } } } if (!flag) ((ICollection) tabSourceReferenceList).Add(workspaceTab); } foreach (WSRibbonTabSourceReference tabSourceReference in (IEnumerable) tabSourceReferenceList) workspace.WorkspaceRibbonRoot.WorkspaceTabs.Remove(tabSourceReference); } if (!targetCui1.IsModified) return; targetCui1.Save(); } internal static void AddSldOrSlbPath(string s, StringCollection sArray) { if (s == null || s == string.Empty || s.IndexOf(".") == -1) return; string lower = Path.GetExtension(s).ToLower(); if (lower != ".sld" && lower != ".slb") return; bool flag = false; for (int index = 0; index < sArray.Count; ++index) { if (string.Compare(sArray[index], s, true, CultureInfo.InvariantCulture) == 0) { flag = true; break; } } if (flag) return; sArray.Add(s); } internal void CopySldAndSlbFiles() { if (this.targetCUI.MenuGroup.ImageMenus == null) return; StringCollection sArray = new StringCollection(); foreach (ImageMenu imageMenu in (CollectionBase) this.targetCUI.MenuGroup.ImageMenus) { foreach (ImageMenuItem imageMenuItem in (CollectionBase) imageMenu.ImageMenuItems) { CUIFileMigrator.AddSldOrSlbPath(imageMenuItem.SlideName, sArray); CUIFileMigrator.AddSldOrSlbPath(imageMenuItem.SlideLibrary, sArray); } } foreach (string path1 in sArray) { string str1 = (string) null; string destFileName = (string) null; if (!File.Exists(path1)) { string path2 = Path.GetDirectoryName(this.SourceFile) + (object) Path.DirectorySeparatorChar + Path.GetFileName(path1); if (File.Exists(path2)) { str1 = path2; destFileName = Path.GetDirectoryName(this.TargetFile) + (object) Path.DirectorySeparatorChar + Path.GetFileName(path1); } if (str1 == null) { str1 = Migrator.FindFirstProfileSupportFile(MainForm.isACAD, Path.GetFileName(path1), MainForm.CurrentSourceProfilePath); destFileName = Migrator.GetRoamableRootFolder(MainForm.customizationHostServices.RegProdRootKey) + "Support" + (object) Path.DirectorySeparatorChar + Path.GetFileName(path1); } if (str1 != null && destFileName != null) { if (File.Exists(str1)) { try { File.Copy(str1, destFileName, false); string str2 = string.Format(LocalResources.GetString("LOG_FILE_COPY"), (object) str1, (object) destFileName); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 3, str2); } catch (IOException ex) { string str3 = string.Format(LocalResources.GetString("ERROR_FILE_ACCESS_DENIED"), (object) destFileName); CUIFileMigrator._logger.LogXMLElement((LogOperation) 1, (LogCategory) 0, str3); } } } } } } private void LTConvertMenuGroup() { if (this.sourceCUI.MenuGroup.Accelerators != null) this.SimpleCloneModifiedItems((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.Accelerators, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.Accelerators); if (this.sourceCUI.MenuGroup.TemporaryOverrides != null) this.SimpleCloneModifiedItems((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.TemporaryOverrides, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.TemporaryOverrides); if (this.sourceCUI.MenuGroup.MouseButtons != null) this.SimpleCloneModifiedItems((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.MouseButtons, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.MouseButtons); if (this.sourceCUI.MenuGroup.DigitizerButtons != null) this.SimpleCloneModifiedItems((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.DigitizerButtons, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.DigitizerButtons); if (this.sourceCUI.MenuGroup.QuickAccessToolbars != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.QuickAccessToolbars, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.QuickAccessToolbars); if (this.sourceCUI.MenuGroup.PopMenus != null) { foreach (PopMenu popMenu in (CollectionBase) this.sourceCUI.MenuGroup.PopMenus) { if (this.targetCUI.MenuGroup.PopMenus.FindPopWithName(popMenu.Name) == null && !this.LTExcluded(popMenu.Name)) { ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; this.targetCUI.MenuGroup.PopMenus.Clone(popMenu, (PopMenu) null, ref containerCloneAction); } } foreach (PopMenu popMenu1 in (CollectionBase) this.sourceCUI.MenuGroup.PopMenus) { PopMenu popWithName = this.targetCUI.MenuGroup.PopMenus.FindPopWithName(popMenu1.Name); if (popWithName != null) { foreach (PopMenuItemBase popMenuItem1 in (CollectionBase) popMenu1.PopMenuItems) { if (popMenuItem1 is PopMenuItem popMenuItem4 && ((VersionableElement) popMenuItem4).UserModified() && !popMenuItem4.IsSeparator) { bool flag = false; foreach (PopMenuItemBase popMenuItem2 in (CollectionBase) popWithName.PopMenuItems) { if (popMenuItem2 is PopMenuItem popMenuItem3 && !popMenuItem3.IsSeparator && popMenuItem4.Name.Equals(popMenuItem3.Name, StringComparison.CurrentCultureIgnoreCase)) { ((CustomizationElement) popMenuItem3).Replace((CustomizationElement) popMenuItem4); flag = true; break; } } if (!flag) popWithName.PopMenuItems.Insert(popMenu1.PopMenuItems.IndexOf((PopMenuItemBase) popMenuItem4), (PopMenuItemBase) popMenuItem4); } } foreach (PopMenuItemBase popMenuItem5 in (CollectionBase) popMenu1.PopMenuItems) { if (popMenuItem5 is PopMenuRef popMenuRef1 && ((VersionableElement) popMenuRef1).UserModified()) { bool flag = false; PopMenu popMenu2 = this.sourceCUI.getPopMenu(popMenuRef1.MenuReference); if (popMenu2 != null) { foreach (PopMenuItemBase popMenuItem6 in (CollectionBase) popWithName.PopMenuItems) { if (popMenuItem6 is PopMenuRef popMenuRef) { PopMenu popMenu3 = this.targetCUI.getPopMenu(popMenuRef.MenuReference); if (popMenu3 != null && popMenu2.Name.Equals(popMenu3.Name, StringComparison.CurrentCultureIgnoreCase)) flag = true; } } if (!flag) popWithName.PopMenuItems.Insert(popMenu1.PopMenuItems.IndexOf((PopMenuItemBase) popMenuRef1), (PopMenuItemBase) popMenuRef1); } } } } } } if (this.sourceCUI.MenuGroup.Toolbars != null) { foreach (Toolbar toolbar in (CollectionBase) this.sourceCUI.MenuGroup.Toolbars) { if (this.targetCUI.MenuGroup.Toolbars.FindToolbarWithName(toolbar.Name) == null) { ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; this.targetCUI.MenuGroup.Toolbars.Clone(toolbar, (Toolbar) null, ref containerCloneAction); } } foreach (Toolbar toolbar1 in (CollectionBase) this.sourceCUI.MenuGroup.Toolbars) { Toolbar toolbarWithName = this.targetCUI.MenuGroup.Toolbars.FindToolbarWithName(toolbar1.Name); if (toolbarWithName != null) { foreach (ToolbarItemBase toolbarItem1 in (CollectionBase) toolbar1.ToolbarItems) { if (toolbarItem1 is ToolbarButton toolbarButton1 && ((VersionableElement) toolbarButton1).UserModified() && !toolbarButton1.IsSeparator) { bool flag = false; foreach (ToolbarItemBase toolbarItem2 in (CollectionBase) toolbarWithName.ToolbarItems) { if (toolbarItem2 is ToolbarButton toolbarButton && !toolbarButton.IsSeparator && toolbarButton1.Name.Equals(toolbarButton.Name, StringComparison.CurrentCultureIgnoreCase)) { ((CustomizationElement) toolbarButton).Replace((CustomizationElement) toolbarButton1); flag = true; break; } } if (!flag) toolbarWithName.ToolbarItems.Insert(toolbar1.ToolbarItems.IndexOf((ToolbarItemBase) toolbarButton1), (ToolbarItemBase) toolbarButton1); } } foreach (ToolbarItemBase toolbarItem3 in (CollectionBase) toolbar1.ToolbarItems) { if (toolbarItem3 is ToolbarFlyout toolbarFlyout1 && ((VersionableElement) toolbarFlyout1).UserModified()) { bool flag = false; Toolbar toolbar2 = this.sourceCUI.getToolbar(toolbarFlyout1.ToolbarReference); if (toolbar2 != null) { foreach (ToolbarItemBase toolbarItem4 in (CollectionBase) toolbarWithName.ToolbarItems) { if (toolbarItem4 is ToolbarFlyout toolbarFlyout) { Toolbar toolbar3 = this.targetCUI.getToolbar(toolbarFlyout.ToolbarReference); if (toolbar3 != null && toolbar2.Name.Equals(toolbar3.Name, StringComparison.CurrentCultureIgnoreCase)) flag = true; } } if (!flag) toolbarWithName.ToolbarItems.Insert(toolbar1.ToolbarItems.IndexOf((ToolbarItemBase) toolbarFlyout1), (ToolbarItemBase) toolbarFlyout1); } } } foreach (ToolbarItemBase toolbarItem5 in (CollectionBase) toolbar1.ToolbarItems) { if (toolbarItem5 is ToolbarControl toolbarControl1) { bool flag = false; foreach (ToolbarItemBase toolbarItem6 in (CollectionBase) toolbarWithName.ToolbarItems) { if (toolbarItem6 is ToolbarControl toolbarControl && toolbarControl1.ControlType == toolbarControl.ControlType) flag = true; } if (!flag) toolbarWithName.ToolbarItems.Insert(toolbar1.ToolbarItems.IndexOf((ToolbarItemBase) toolbarControl1), (ToolbarItemBase) toolbarControl1); } } } } } if (this.sourceCUI.MenuGroup.ScreenMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.ScreenMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.ScreenMenus); if (this.sourceCUI.MenuGroup.ImageMenus != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.ImageMenus, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.ImageMenus); if (this.sourceCUI.MenuGroup.DoubleClickActions != null) this.GenericMigration((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.DoubleClickActions, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.DoubleClickActions); if (this.sourceCUI.MenuGroup.QuickPropertiesObjectTypes != null) this.GenericObjectTypes((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.QuickPropertiesObjectTypes, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.QuickPropertiesObjectTypes); if (this.sourceCUI.MenuGroup.RolloverTooltipObjectTypes == null) return; this.GenericObjectTypes((MenuGroupItemsCollection) this.sourceCUI.MenuGroup.RolloverTooltipObjectTypes, (MenuGroupItemsCollection) this.targetCUI.MenuGroup.RolloverTooltipObjectTypes); } private bool LTExcluded(string menuName) => menuName.Equals("Block Objects Menu", StringComparison.CurrentCultureIgnoreCase) || menuName.Equals("&Viewports", StringComparison.CurrentCultureIgnoreCase) || menuName.Equals("&Layout", StringComparison.CurrentCultureIgnoreCase) || menuName.Equals("Ne&w UCS", StringComparison.CurrentCultureIgnoreCase) || menuName.Equals("Unmaximized Viewport Menu", StringComparison.CurrentCultureIgnoreCase) || menuName.Equals("L&ayer tools", StringComparison.CurrentCultureIgnoreCase); private void SimpleCloneModifiedItems( MenuGroupItemsCollection smgCollection, MenuGroupItemsCollection tmgCollection) { foreach (CustomizationElement smg in (CollectionBase) smgCollection) { if (((VersionableElement) smg).UserModified()) { ContainerCloneAction containerCloneAction = (ContainerCloneAction) 1; tmgCollection.Clone(smg, (CustomizationElement) null, ref containerCloneAction); } } } internal void setParentCUIFile(CUIFileMigrator parent) { if (parent == null || parent.targetCUI == null || this.targetCUI == null) return; this.targetCUI.ParentCUI = parent.targetCUI; } } }