| 1814 | } |
| 1815 | |
| 1816 | PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEnabled, |
| 1817 | bool forceDisabled, const QString& originName, |
| 1818 | const QString& fullPath, bool hasIni, |
| 1819 | std::set<QString> archives, bool lightSupported, |
| 1820 | bool mediumSupported) |
| 1821 | : name(name), fullPath(fullPath), enabled(forceLoaded), forceLoaded(forceLoaded), |
| 1822 | forceEnabled(forceEnabled), forceDisabled(forceDisabled), priority(0), |
| 1823 | loadOrder(-1), originName(originName), hasIni(hasIni), |
| 1824 | archives(archives.begin(), archives.end()), modSelected(false) |
| 1825 | { |
| 1826 | try { |
| 1827 | ESP::File file(ToWString(fullPath)); |
| 1828 | auto extension = name.right(3).toLower(); |
| 1829 | hasMasterExtension = (extension == "esm"); |
| 1830 | hasLightExtension = (extension == "esl"); |
| 1831 | isMasterFlagged = file.isMaster(); |
| 1832 | isLightFlagged = lightSupported && file.isLight(mediumSupported); |
| 1833 | isMediumFlagged = mediumSupported && file.isMedium(); |
| 1834 | hasNoRecords = file.isDummy(); |
| 1835 | |
| 1836 | author = QString::fromLatin1(file.author().c_str()); |
| 1837 | description = QString::fromLatin1(file.description().c_str()); |
| 1838 | |
| 1839 | for (auto&& m : file.masters()) { |
| 1840 | masters.insert(QString::fromStdString(m)); |
| 1841 | } |
| 1842 | } catch (const std::exception& e) { |
| 1843 | log::error("failed to parse plugin file {}: {}", fullPath, e.what()); |
| 1844 | hasMasterExtension = false; |
| 1845 | hasLightExtension = false; |
| 1846 | isMasterFlagged = false; |
| 1847 | isMediumFlagged = false; |
| 1848 | isLightFlagged = false; |
| 1849 | hasNoRecords = false; |
| 1850 | } |
| 1851 | } |
| 1852 | |
| 1853 | void PluginList::managedGameChanged(const IPluginGame* gamePlugin) |
| 1854 | { |