Click here to Skip to main content
11,494,407 members (63,109 online)
Click here to Skip to main content
Add your own
alternative version

Audio Book Player

, 11 Jun 2009 CPOL 120.4K 2.3K 82
Audio player designed specifically for listening to audio books
abPlayer.zip
Skins
Color
battery.jpg
cancel.jpg
clock.jpg
dark.jpg
exit.jpg
library.jpg
light.jpg
media.jpg
menu.jpg
next.jpg
ok.jpg
play.jpg
prev.jpg
props.jpg
remove.jpg
sleep.jpg
stop.jpg
switch.jpg
vol.jpg
Grayscale
battery.jpg
cancel.jpg
clock.bmp
dark.jpg
exit.jpg
library.jpg
light.jpg
media.jpg
menu.jpg
next.jpg
ok.jpg
play.jpg
prev.jpg
Props.jpg
remove.bmp
sleep.jpg
stop.jpg
switch.jpg
vol.jpg
abPlayer.suo
abPlayer
abPlayer.csproj.user
abPlayer.csproj.vspscc
bin
Release
abPlayer.pdb
abPlayer_exe
OcxControls.dll
OpenNETCF.Windows.Forms.AxHost.dll
Resources
System.Data.SqlServerCe.dll
WMPLib.dll
Properties
DLLs
ComLib.dll
ComLib.PocketPC.asmmeta.dll
OcxControls.dll
OcxControls.PocketPC.asmmeta.dll
OpenNETCF.Windows.Forms.AxHost.dll
OpenNETCF.Windows.Forms.AxHost.PocketPC.asmmeta.dll
WMPLib.dll
Graphics
book.bmp
bookshelf.jpg
check.png
dirclosed.bmp
diropen.bmp
uncheck.png
up.jpg
Submission_Form.zip
abPlayer_files
image001.jpg
image002.jpg
image003.jpg
image004.jpg
themedata.thmx
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

brochpirate

Israel Israel
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 11 Jun 2009
Article Copyright 2008 by brochpirate
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid