public static ReskinFile tryLoadReskin(Tex2D texture, bool loadHat = true) { try{ return(ReskinFile.ParseFile(TextureHelper.getBitmap(texture), loadHat)); } catch { } return(null); }
void LoadTextures(string folder, string prefix) { var rootFolder = folder.Remove(0, prefix.Length); DirectoryInfo dir = new DirectoryInfo(folder); foreach (FileInfo file in dir.GetFiles("*.png")) { Textures.Add(rootFolder.TrimStart('\\') + file.Name.Substring(0, file.Name.Length - 4), TextureHelper.getTex2D(ContentPack.LoadTexture2D(file.FullName))); } foreach (var d in dir.GetDirectories()) { LoadTextures(folder + '\\' + d.Name + '\\', prefix); } }