private static void CopySectionData(SectionInfo from, SectionInfo to, bool unsetAsRoot) { if (from == to) return; to.dataContainer = from.dataContainer; to.isSectionRoot = true; from.isSectionRoot = !unsetAsRoot; }
private static void CopySectionData(SectionInfo from, SectionInfo to, bool unsetAsRoot) { if (from == to) { return; } to.dataContainer = from.dataContainer; to.isSectionRoot = true; from.isSectionRoot = !unsetAsRoot; }
protected static void CopySectionDataToOtherPartInSection(SectionInfo info, bool unsetAsRoot) { if (info.isSectionRoot && API.PartsBySection.Count() > 0) { var otherPartInSection = API.PartsBySection.First(section => section.Key == info.section).FirstOrDefault(part => part != info.part); if (otherPartInSection != null) { CopySectionData(info, otherPartInSection.FindModuleImplementing <SectionInfo>(), unsetAsRoot); } } }
protected static void CopySectionDataToOtherPartInSection(SectionInfo info, bool unsetAsRoot) { if (info.isSectionRoot) { var otherPartInSection = API.PartsBySection.First(section => section.Key == info.section).FirstOrDefault(part => part != info.part); if (otherPartInSection != null) { CopySectionData(info, otherPartInSection.FindModuleImplementing<SectionInfo>(), unsetAsRoot); } } }
private static void EnsureOnlyOneSectionRoot(SectionInfo sectionInfo) { var sectionName = sectionInfo.section; var sectionRoots = API.PartsBySection.First(section => section.Key == sectionName) .SelectMany(part => part.FindModulesImplementing<SectionInfo>()) .Where(info => info.isSectionRoot); sectionRoots.Where(info => info != sectionInfo).ToList().ForEach(info => { info.dataContainer = new SectionDataContainer(); info.isSectionRoot = false; }); }
private static void EnsureOnlyOneSectionRoot(SectionInfo sectionInfo) { var sectionName = sectionInfo.section; var sectionRoots = API.PartsBySection.First(section => section.Key == sectionName) .SelectMany(part => part.FindModulesImplementing <SectionInfo>()) .Where(info => info.isSectionRoot); sectionRoots.Where(info => info != sectionInfo).ToList().ForEach(info => { info.dataContainer = new SectionDataContainer(); info.isSectionRoot = false; }); }