示例#1
0
        private static void MergeSections(string currentSection, string newSection)
        {
            var currentSectionParts    = PartsBySection.First(section => section.Key == currentSection);
            var currentSectionRootInfo = currentSectionParts.SelectMany(part => part.FindModulesImplementing <SectionInfo>()).First(info => info.isSectionRoot);
            var newSectionParts        = PartsBySection.First(section => section.Key == newSection);
            var newSectionRootInfo     = newSectionParts.SelectMany(part => part.FindModulesImplementing <SectionInfo>()).First(info => info.isSectionRoot);

            foreach (var sectionData in currentSectionRootInfo.dataContainer.GetAllSectionDatas())
            {
                newSectionRootInfo.dataContainer.AddOrUpdateSectionDataForMod(sectionData);
            }
            currentSectionRootInfo.isSectionRoot = false;
            currentSectionRootInfo.dataContainer = new SectionDataContainer();
            ChangeSectionNameCore(currentSectionParts, newSection);
            SectionsMerged.Fire(currentSection, newSection);
        }
示例#2
0
 private static void RenameSection(string oldSectionName, string newSectionName)
 {
     ChangeSectionNameCore(PartsBySection.First(group => group.Key == oldSectionName), newSectionName);
     SectionRenamed.Fire(oldSectionName, newSectionName);
 }