diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index 9039f293..106c3a04 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -449,7 +449,7 @@ namespace Vocaluxe.Screens foreach (CAvatar avatar in avatars) { _SelectSlides[_SelectSlideAvatars].AddValue( - Path.GetFileName(avatar.FileName), + avatar.GetDisplayName(), null, avatar.ID, -1); diff --git a/VocaluxeLib/Profile/CAvatar.cs b/VocaluxeLib/Profile/CAvatar.cs index 9418a034..1daba02e 100644 --- a/VocaluxeLib/Profile/CAvatar.cs +++ b/VocaluxeLib/Profile/CAvatar.cs @@ -15,6 +15,8 @@ // along with Vocaluxe. If not, see . #endregion +using System.Diagnostics; +using System.IO; using VocaluxeLib.Draw; namespace VocaluxeLib.Profile @@ -22,8 +24,9 @@ namespace VocaluxeLib.Profile public class CAvatar { public int ID; - private string _FileName = ""; + private readonly string _FileName = ""; private CTexture _Texture; + private const int _MaxNameLen = 12; public CTexture Texture { @@ -42,13 +45,9 @@ namespace VocaluxeLib.Profile private CAvatar(CTexture texture, string fileName, int id = -1) { - ID = id; - } - - public bool LoadFromFile(string fileName) - { + _Texture = texture; _FileName = fileName; - return Reload(); + ID = id; } public bool Reload() @@ -63,5 +62,14 @@ namespace VocaluxeLib.Profile { CBase.Drawing.RemoveTexture(ref _Texture); } + + public string GetDisplayName() + { + string name = Path.GetFileNameWithoutExtension(_FileName); + Debug.Assert(name != null); + if (name.Length > _MaxNameLen) + name = name.Substring(0, _MaxNameLen); + return name; + } } } \ No newline at end of file