using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.Win32; using System.IO; using System.Reflection; using System.Collections; using System.Runtime.InteropServices; namespace abPlayer { public partial class frmConvert : Form { cBasePersistancy fromLibrary = null; cBasePersistancy toLibrary = null; public frmConvert() { InitializeComponent(); } private void btnExit_Click(object sender, EventArgs e) { Close(); } private void btnConvert_Click(object sender, EventArgs e) { if (rdoToReg.Checked) { if (rdoFmReg.Checked) return; toLibrary = new cRegistryPersistancy(); if (rdoFmDB.Checked) fromLibrary = new cDatabasePersistantcy(); else fromLibrary = new cFileSystemPersistantcy(); } if (rdoToFS.Checked) { if (rdoFmFS.Checked) return; toLibrary = new cFileSystemPersistantcy(); if (rdoFmDB.Checked) fromLibrary = new cDatabasePersistantcy(); else fromLibrary = new cRegistryPersistancy(); } if (rdoToDB.Checked) { if (rdoFmDB.Checked) return; toLibrary = new cDatabasePersistantcy(); if (rdoFmReg.Checked) fromLibrary = new cRegistryPersistancy(); else fromLibrary = new cFileSystemPersistantcy(); } lsb.Items.Clear(); lsb.Items.Add("== begin =="); DoConversion(); fromLibrary = toLibrary = null; GC.Collect(); lsb.TopIndex = lsb.Items.Add("== done =="); } // do it void DoConversion() { // delete all from target foreach (String bookshelf in toLibrary.Bookshelves) if(bookshelf.Length > 0) toLibrary.DeleteBookshelf(bookshelf); foreach (String book in toLibrary.GetBookshelfBooks("")) if(book.Length > 0) toLibrary.DeleteBook(book); // now copy from source to target ArrayList bookshelves = new ArrayList(); bookshelves.AddRange(fromLibrary.Bookshelves); if(bookshelves.IndexOf("") == -1) bookshelves.Add(""); foreach (String bookshelf in bookshelves) { lsb.TopIndex = lsb.Items.Add("[BOOKSHELF]" + bookshelf); if(bookshelf.Length > 0) toLibrary.NewBookshelf(bookshelf); String[] books = fromLibrary.GetBookshelfBooks(bookshelf); foreach (String book in books) { if (book.Length == 0) break; lsb.Items.Add("[BOOK]" + book); Application.DoEvents(); toLibrary.NewBook(book, bookshelf); for (int i = 0; i < 4; i++) toLibrary.SetBookProperty((eBookProperty)i, fromLibrary.GetBookProperty((eBookProperty)i, book), book); toLibrary.SetBookFiles(fromLibrary.GetBookFiles(book), book); } } toLibrary.ActiveBookName = fromLibrary.ActiveBookName; toLibrary.BacklightTimeout = fromLibrary.BacklightTimeout; } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)