File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,10 +466,17 @@ protected void Parse (ByteVector data, int offset)
466466
467467 Size = pos + 1 + ( int ) value_length - offset ;
468468
469- if ( Type == ItemType . Binary )
470- this . data = new ReadOnlyByteVector ( data . Mid ( pos + 1 , ( int ) value_length ) ) ;
471- else
472- text = data . Mid ( pos + 1 , ( int ) value_length ) . ToStrings ( StringType . UTF8 , 0 ) ;
469+ // Store both the binary and string representation, because APE v1. tags don't use the flags.
470+ // Because of this the parser can't differentiate between string and binary.
471+ // In this case sting is assumed (because flags == 0).
472+ //
473+ // If we write both string and binary data, the application can still access the binary data by setting the Type to binary.
474+
475+ // Binary representation
476+ this . data = new ReadOnlyByteVector ( data . Mid ( pos + 1 , ( int ) value_length ) ) ;
477+
478+ // String representation
479+ text = data . Mid ( pos + 1 , ( int ) value_length ) . ToStrings ( StringType . UTF8 , 0 ) ;
473480 }
474481
475482 #endregion
You can’t perform that action at this time.
0 commit comments