@@ -624,17 +624,36 @@ def __init__(self, map_file, filename=None, gateway=None, map_hash=None, **optio
624
624
game_strings = self .archive .read_file ('enUS.SC2Data\LocalizedData\GameStrings.txt' )
625
625
if game_strings :
626
626
for line in game_strings .split ('\r \n ' ):
627
- parts = line .split ('=' )
628
- if parts [0 ] == 'DocInfo/Name' :
629
- self .name = parts [1 ]
630
- elif parts [0 ] == 'DocInfo/Author' :
631
- self .author = parts [1 ]
632
- elif parts [0 ] == 'DocInfo/DescLong' :
633
- self .description = parts [1 ]
627
+ if len (line ) == 0 :
628
+ continue
629
+
630
+ key , value = line .split ('=' )
631
+ if key == 'DocInfo/Name' :
632
+ self .name = value
633
+ elif key == 'DocInfo/Author' :
634
+ self .author = value
635
+ elif key == 'DocInfo/DescLong' :
636
+ self .description = value
637
+ elif key == 'DocInfo/Website' :
638
+ self .website = value
634
639
635
640
#: A reference to the map's :class:`~sc2reader.objects.MapInfo` object
636
641
self .map_info = MapInfo (self .archive .read_file ('MapInfo' ))
637
642
643
+ doc_info = ElementTree .fromstring (self .archive .read_file ('DocumentInfo' ))
644
+
645
+ icon_path_node = doc_info .find ('Icon/Value' )
646
+ #: (Optional) The path to the icon for the map, relative to the archive root
647
+ self .icon_path = icon_path_node .text if icon_path_node is not None else None
648
+
649
+ #: (Optional) The icon image for the map in tga format
650
+ self .icon = self .archive .read_file (self .icon_path ) if self .icon_path is not None else None
651
+
652
+ #: A list of module names this map depends on
653
+ self .dependencies = list ()
654
+ for dependency_node in doc_info .findall ('Dependencies/Value' ):
655
+ self .dependencies .append (dependency_node .text )
656
+
638
657
@classmethod
639
658
def get_url (cls , gateway , map_hash ):
640
659
"""Builds a download URL for the map from its components."""
0 commit comments