private void LoadMapData(string FriendlyName, string FilePath, string FileName, string FileExtension) { // make sure resource exists var fullDirectory = ReadWrite.CreateIfNotExists(FilePath, FileName, FileExtension, false); if (!string.IsNullOrEmpty(fullDirectory)) { var mapData = ReadWrite.ReadJson <LevelObj>(FilePath, FileName, FileExtension, false); if (mapData != null) { MapData.Add(FriendlyName, mapData); } else { ReadWrite.WriteToLog(String.Format("LoadMapData - Data is null. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } } else { ReadWrite.WriteToLog(String.Format("LoadMapData - Could not load resource. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } }
private void LoadSprite(string FriendlyName, string FilePath, string FileName, string FileExtension) { // make sure resource exists var fullDirectory = ReadWrite.CreateIfNotExists(FilePath, FileName, FileExtension, false); if (!string.IsNullOrEmpty(fullDirectory)) { var sprite = Sprite.Load(fullDirectory); MapSprites.Add(FriendlyName, sprite); } else { ReadWrite.WriteToLog(String.Format("LoadSprite - Could not load resource. FriendlyName: {0}. Root: {1}. Path: {2}. FileName: {3}. FileExtension: {4}", FriendlyName, ReadWrite.GetRoot, FilePath, FileName, FileExtension)); throw new FileLoadException("Could not Load resource"); } }