static void ParseTileset(XmlNode nodeData, Dictionary<int, string> gidToFiles, Dictionary<int, Dictionary<string, string>> gidToTileProperties, string dir, NSDictionary tilesetCaches){
XmlNode source = nodeData.SelectSingleNode("image");
int firstGid = int.Parse(nodeData.Attributes["firstgid"].InnerText);
int tileWidth = int.Parse(nodeData.Attributes["tilewidth"].InnerText);
int tileHeight = int.Parse(nodeData.Attributes["tileheight"].InnerText);
string filename = source.Attributes["source"].InnerText;
string ext = Path.GetExtension(filename);
if(ext!=null)
filename = filename.Replace (ext, "");
filename = dir + filename;
ParseImagePlist(firstGid, tileWidth, tileHeight, filename, gidToFiles, tilesetCaches);
//tile shared properties
XmlNodeList tileNodes = nodeData.SelectNodes("tile");
var enumerator = tileNodes.GetEnumerator();
while (enumerator.MoveNext()) {
XmlNode tileNode = (XmlNode)enumerator.Current;
string id = tileNode.Attributes["id"].InnerText;
if(id!=null && id.Trim().Length>0){
int idInt = int.Parse(id);
XmlNode propertiesNode = tileNode.SelectSingleNode("properties");
if(propertiesNode!=null){
XmlNodeList sharedPropertyNodes = propertiesNode.SelectNodes("property");
Dictionary<string, string> sharedProperties = new Dictionary<string, string>();
var sharedPropertyNodesEnumerator = sharedPropertyNodes.GetEnumerator();
while (sharedPropertyNodesEnumerator.MoveNext()) {
XmlNode sharedPropertyNode = (XmlNode)sharedPropertyNodesEnumerator.Current;
string name = sharedPropertyNode.Attributes["name"].InnerText;
string value = sharedPropertyNode.Attributes["value"].InnerText;
if(name!=null && value != null){
sharedProperties[name] = value;
}
}
gidToTileProperties[idInt + firstGid] = sharedProperties;
}
}
}
}