protected string GetSpriteName(string imagePath) { int index = imagePath.LastIndexOf('/') + 1; string file = index == -1 ? imagePath : imagePath.Substring(index); return file.Substring(0, file.LastIndexOf('.')); }