| 304 | } |
| 305 | |
| 306 | bool PackingInfo::GetPackUnpackPlugin(const String& filteredFilenames, bool bUrl, bool bReverse, |
| 307 | std::vector<std::tuple<PluginInfo*, uint8_t, std::vector<String>, bool>>& plugins, |
| 308 | String *pPluginPipelineResolved, String& errorMessage) const |
| 309 | { |
| 310 | auto result = ExpandAliases(this->m_PluginPipeline, filteredFilenames, L"ALIAS_PACK_UNPACK", errorMessage); |
| 311 | if (!errorMessage.empty()) |
| 312 | return false; |
| 313 | if (bUrl) |
| 314 | { |
| 315 | uint8_t targetFlags = 0xff; |
| 316 | std::vector<String> args; |
| 317 | const auto filenames = strutils::split(filteredFilenames, '|'); |
| 318 | std::vector<std::pair<PluginInfo*, bool>> pluginInfos; |
| 319 | for (int i = 0; i < filenames.size(); ++i) |
| 320 | { |
| 321 | bool bWithFile = true; |
| 322 | const String filename{ filenames[i].data(), filenames[i].size() }; |
| 323 | PluginInfo* plugin = nullptr; |
| 324 | plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"URL_PACK_UNPACK", filename); |
| 325 | pluginInfos.push_back({ plugin, bWithFile }); |
| 326 | } |
| 327 | if (!filenames.empty() && |
| 328 | std::all_of(pluginInfos.begin() + 1, pluginInfos.end(), |
| 329 | [&](const auto& elem) { return elem == pluginInfos.front(); })) |
| 330 | { |
| 331 | const auto& pluginInfo = pluginInfos.front(); |
| 332 | if (pluginInfo.first) |
| 333 | { |
| 334 | plugins.insert(bReverse ? plugins.begin() : plugins.end(), |
| 335 | { pluginInfo.first, targetFlags, args, pluginInfo.second }); |
| 336 | } |
| 337 | } |
| 338 | else |
| 339 | { |
| 340 | for (int i = 0; i < pluginInfos.size(); ++i) |
| 341 | { |
| 342 | const auto& pluginInfo = pluginInfos[i]; |
| 343 | if (isTargetInFlags(i, targetFlags) && pluginInfo.first) |
| 344 | { |
| 345 | uint8_t targetFlags2 = 1 << i; |
| 346 | plugins.insert(bReverse ? plugins.begin() : plugins.end(), |
| 347 | { pluginInfo.first, targetFlags2, args, pluginInfo.second }); |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | std::vector<PluginForFile::PipelineItem> pipelineResolved; |
| 353 | for (auto& [pluginName, targetFlags, args, quoteChar] : result) |
| 354 | { |
| 355 | PluginInfo* plugin = nullptr; |
| 356 | if (pluginName == _T("<None>") || pluginName == _("<None>")) |
| 357 | ; |
| 358 | else if (pluginName == _T("<Automatic>") || pluginName == _("<Automatic>")) |
| 359 | { |
| 360 | const auto filenames = strutils::split(filteredFilenames, '|'); |
| 361 | std::vector<std::pair<PluginInfo*, bool>> pluginInfos; |
| 362 | for (int i = 0; i < filenames.size(); ++i) |
| 363 | { |
nothing calls this directly
no test coverage detected