/// <summary> /// Loads all custom sprites /// </summary> private void LoadSprites() { bool spriteSuccess = true; PropConfig.LoadPropInfo(); String[] files = Directory.GetFiles(FileUtils.GetModPath() + Path.DirectorySeparatorChar + FileUtils.IMAGES_DIR); foreach (string file in files) { string[] splitValues = file[0] == Path.DirectorySeparatorChar ? file.Substring(1).Split(Path.DirectorySeparatorChar) : file.Split(Path.DirectorySeparatorChar); string fileName = splitValues[splitValues.Length - 1]; string fileKey = fileName.Split('.')[0]; spriteSuccess = TextureUtils.AddTexture(file, fileKey) && spriteSuccess; } files = Directory.GetFiles(FileUtils.GetAltPath(true)); foreach (string file in files) { string[] splitValues = file[0] == Path.DirectorySeparatorChar ? file.Substring(1).Split(Path.DirectorySeparatorChar) : file.Split(Path.DirectorySeparatorChar); string fileName = splitValues[splitValues.Length - 1]; string fileKey = fileName.Split('.')[0]; spriteSuccess = TextureUtils.AddTexture(file, fileKey) && spriteSuccess; } if (!spriteSuccess) { LoggerUtils.LogError("Failed to load some sprites!"); } }