fixed for field duplication

This removes case-sensitivity when mapping.
This commit is contained in:
afkiwers 2023-09-27 10:38:25 +10:00 committed by Jon Evans
parent 3c40cb3fd3
commit c97db9b6c4
2 changed files with 15 additions and 16 deletions

View File

@ -390,40 +390,40 @@ LIB_SYMBOL* SCH_HTTP_LIB_PLUGIN::loadSymbolFromPart( const wxString& aS
for( auto& _field : aPart.fields )
{
std::string fieldName = _field.first;
std::tuple fieldProperties = _field.second;
wxString fieldName = wxString( _field.first );
std::tuple fieldProperties = _field.second;
if( fieldName == footprint_field )
if( fieldName.Lower() == footprint_field )
{
field = &symbol->GetFootprintField();
field->SetText( std::get<0>( fieldProperties ) );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( fieldName == description_field )
else if( fieldName.Lower() == description_field )
{
field = &symbol->GetDescriptionField();
field->SetText( std::get<0>( fieldProperties ) );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( fieldName == value_field )
else if( fieldName.Lower() == value_field )
{
field = &symbol->GetValueField();
field->SetText( std::get<0>( fieldProperties ) );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( fieldName == datasheet_field )
else if( fieldName.Lower() == datasheet_field )
{
field = &symbol->GetDatasheetField();
field->SetText( std::get<0>( fieldProperties ) );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( fieldName == reference_field )
else if( fieldName.Lower() == reference_field )
{
field = &symbol->GetReferenceField();
field->SetText( std::get<0>( fieldProperties ) );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( fieldName == keywords_field )
else if( fieldName.Lower() == keywords_field )
{
symbol->SetKeyWords( std::get<0>( fieldProperties ) );
}
@ -444,7 +444,6 @@ LIB_SYMBOL* SCH_HTTP_LIB_PLUGIN::loadSymbolFromPart( const wxString& aS
return symbol;
}
void SCH_HTTP_LIB_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
const STRING_UTF8_MAP* aProperties )
{

View File

@ -117,13 +117,13 @@ private:
wxString m_lastError;
std::string symbol_field = "symbol";
std::string footprint_field = "footprint";
std::string description_field = "description";
std::string keywords_field = "keywords";
std::string value_field = "value";
std::string datasheet_field = "datasheet";
std::string reference_field = "reference";
wxString symbol_field = "symbol";
wxString footprint_field = "footprint";
wxString description_field = "description";
wxString keywords_field = "keywords";
wxString value_field = "value";
wxString datasheet_field = "datasheet";
wxString reference_field = "reference";
};