/// <summary> /// Convert Xml-based files to binary. /// </summary> public static void ConvertXmlFiles(PlaylistManager playlistManager, LibraryManager libraryManager) { var playlistsDirectory = Path.Combine(TabsterEnvironment.GetEnvironmentDirectoryPath(TabsterEnvironmentDirectory.UserData), "Playlists"); // playlists are no longer stored as files, but are now stored in database if (Directory.Exists(playlistsDirectory)) { #pragma warning disable 612 var playlistProcessor = new TabsterFileProcessor <TablaturePlaylistDocument>(TablaturePlaylistDocument.FileVersion); #pragma warning restore 612 foreach (var file in Directory.GetFiles(playlistsDirectory, string.Format("*{0}", Constants.TablaturePlaylistFileExtension), SearchOption.AllDirectories)) { var playlistFile = playlistProcessor.Load(file); if (playlistFile != null) { var playlist = new TablaturePlaylist(playlistFile.Name) { Created = playlistFile.FileAttributes.Created }; foreach (var item in playlistFile) { playlist.Add(item); } playlistManager.Update(playlist); try { File.Delete(file); } catch (Exception ex) { Logging.GetLogger().Error(string.Format("Error occured during playlist conversion: {0}", file), ex); } } } } if (Directory.Exists(libraryManager.TablatureDirectory)) { foreach (var file in Directory.GetFiles(libraryManager.TablatureDirectory, string.Format("*{0}", Constants.TablatureFileExtension), SearchOption.AllDirectories)) { var tablatureFile = TabsterXmlFileConverter.ConvertTablatureDocument(file); if (tablatureFile != null) { tablatureFile.Save(file); } } } }
// Gets current executable path in order to determine where to read and write the config file public virtual string GetAppPath() { var dir = TabsterEnvironment.GetEnvironmentDirectoryPath(TabsterEnvironmentDirectory.ApplicatonData); if (!(Directory.Exists(dir))) { Directory.CreateDirectory(dir); } return(dir); }
private static string GetHeaderInfo() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Tabster {0}", TabsterEnvironment.GetVersion().ToString(TabsterVersionFormatFlags.BuildString))); var types = new[] { typeof(IAsciiTablature), // Tabster.Core typeof(Data.ITablatureFile), // Tabster.Data typeof(WinForms.TablatureTextEditorBase), // Tabster.WinForms typeof(Printing.TablaturePrintDocument), // Tabster.Printing }; foreach (var type in types) { var assembly = Assembly.GetAssembly(type); var version = new TabsterVersion(assembly.GetName().Version); sb.AppendLine(string.Format("Referenced: {0} - {1}", assembly.GetName().Name, version)); } return(sb.ToString()); }