using JD.Core; namespace JDSongConverter { public class AppDefinitions : JDDefinitions { static AppDefinitions() { Default = new AppDefinitions(); } protected AppDefinitions() { } private string MapPath(MapPathType type, string mapName, JDSongVersion version, JDFolderLayout jdFolderLayout, PlatformId platform = PlatformId.UNDEFINED) { var platformString = platform != PlatformId.UNDEFINED ? platform.ToString() : ""; if (jdFolderLayout == JDFolderLayout.Engine) { return MapPath(type, mapName, "", version.WithoutJdPrefix(), platformString).Replace(@"\\", @"\"); } else if (jdFolderLayout == JDFolderLayout.CatalogProd) { return MapPath(type, mapName, "", "Catalog", platformString).Replace(@"\\", @"\"); } return ""; } public string AbsoluteMapPath(MapPathType type, JDSong song, PlatformId platform = PlatformId.UNDEFINED) { return System.IO.Path.Combine(song.RootPath, MapPath(type, song.Name, song.Version, song.FolderLayout, platform).TrimStart('\\')); } public string AbsoluteMapPath(MapPathType type, string mapRootPath, string songName, JDSongVersion version, JDFolderLayout jdFolderLayout, PlatformId platform = PlatformId.UNDEFINED) { return System.IO.Path.Combine(mapRootPath, MapPath(type, songName, version, jdFolderLayout, platform).TrimStart('\\')); } public string AbsoluteMapPath(MapPathType type, JDSong song, JDSongVersion version, JDFolderLayout jdFolderLayout, PlatformId platform = PlatformId.UNDEFINED) { return System.IO.Path.Combine(song.RootPath, MapPath(type, song.Name, version, jdFolderLayout, platform).TrimStart('\\')); } public string RelativeMapPath(MapPathType type, JDSong song, PlatformId platform = PlatformId.UNDEFINED) { return MapPath(type, song.Name, song.Version, song.FolderLayout, platform); } #region Public properties public static AppDefinitions Default { get; } #endregion } }