Click here to Skip to main content
15,892,746 members
Articles / Desktop Programming / Windows Forms

Autogenerate Playlists for iTunes in Directory Order

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 Jan 2010GPL38 min read 30K   533   4  
This article demonstrates a tool which can auto-generate playlists for iTunes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Threading;

namespace ItnuesPlayListManager
{
    public static class InteractionUtils
    {
        /// <summary>
        /// Returns a string array of specifed filesystem path elemets starting with drive letter and ending 
        /// </summary>
        /// <param name="path">A valid file path</param>
        /// <returns>array of path elements starting with drive letter and ending with file name with extention</returns>
        public static List<string> GetBrokenPaths(string path)
        {
            List<string> list = new List<string>();
            string[] str = path.Split(new char[] { '\\', ':' }, 999, StringSplitOptions.RemoveEmptyEntries);
            list.AddRange(str.AsEnumerable());
            return list;
        }

         /// <summary>
        /// This Extention is used to do some operations which is in another thread.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="operation">lambada expression or Action reference to the method</param>
        /// <example>
        /// lstOutput.InvokeIfRequired(() => { lstOutput.Items.Add(e.Message); });
        /// </example>
        public static void RemoteThreadUpdate(this Dispatcher ctrlControl, Action mtdLambadaExpression)
        {
            if (ctrlControl.CheckAccess())
            {
                mtdLambadaExpression();
            }
            else
            {
                ctrlControl.BeginInvoke(DispatcherPriority.Normal, mtdLambadaExpression);
            }
        }
     }

    /// <summary>
    /// A generic Dataevent Argument
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DataEventArgs<T> : EventArgs
    {
        public DataEventArgs(T data)
        {
            this.Data = data;
        }
        public T Data { get; set; }
    }
}

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 GNU General Public License (GPLv3)


Written By
Technical Lead
United States United States
Started Programming career with VB 6 and VC++ and now Into .Net Development. Working with .Net since its first release (Version 1.0 Beta). Lucky enough to continue always with most updated versions of .Net and as of now; May 2007, fighting with .Net 3.0 (WPF,WCF...etc) and it's next most anticipated version LINQ.

Got familiarity up on the .Net Technologies and Guidelines like CAB, and Patterns and Practices, Enterprise Library and now with it's WPF version etc.

Specialized in Windows and Distributed and Service oriented applications.

Comments and Discussions