/// <summary>
        /// Converts the array of files to an array of versioned files
        /// </summary>
        /// <param name="files"></param>
        /// <returns></returns>
        public static VersionedFile[] CreateVersionedFiles(FileInfo[] files)
        {
            ArrayList array = new ArrayList();

            foreach (FileInfo file in files)
            {
                try
                {
                    string        name    = file.Name.Replace(file.Extension, null);
                    Version       version = new Version(name);
                    VersionedFile vf      = new VersionedFile(version, file);
                    array.Add(vf);
                }
                catch {}
            }
            return(array.ToArray(typeof(VersionedFile)) as VersionedFile[]);
        }
 public static VersionedFile[] Sort(VersionedFile[] files)
 {
     // front to back - 1
     for (int i = 0; i < files.Length - 1; i++)
     {
         // front + 1 to back
         for (int j = i + 1; j < files.Length; j++)
         {
             if (files[i].Version < files[j].Version)
             {
                 // swap i with j, where i=1 and j=2
                 VersionedFile file = files[j];
                 files[j] = files[i];
                 files[i] = file;
             }
         }
     }
     return(files);
 }
		public static VersionedFile[] Sort(VersionedFile[] files)
		{
			// front to back - 1 
			for(int i = 0; i < files.Length - 1; i++)
			{
				// front + 1 to back
				for(int j = i + 1; j < files.Length; j++)
				{			
					if (files[i].Version < files[j].Version)
					{											 
						// swap i with j, where i=1 and j=2
						VersionedFile file = files[j];
						files[j] = files[i];
						files[i] = file;
					}													
				}
			}
			return files;
		}
        public static VersionedFile[] CreateVersionedFiles(string prependedTextToRemove, FileInfo[] files)
        {
            ArrayList array = new ArrayList();

            foreach (FileInfo file in files)
            {
                try
                {
                    // strip the file extention
                    string name = file.Name.Replace(file.Extension, null);

                    // remove prepended text here
                    name = name.Replace(prependedTextToRemove, null);

                    // create a version from the file name that's remaining
                    Version       version = new Version(name);
                    VersionedFile vf      = new VersionedFile(version, file);
                    array.Add(vf);
                }
                catch {}
            }
            return(array.ToArray(typeof(VersionedFile)) as VersionedFile[]);
        }
		public static VersionedFile[] CreateVersionedFiles(string prependedTextToRemove, FileInfo[] files)
		{
			ArrayList array = new ArrayList();
			foreach(FileInfo file in files)
			{				
				try
				{
					// strip the file extention
					string name = file.Name.Replace(file.Extension, null);
					
					// remove prepended text here
					name = name.Replace(prependedTextToRemove, null);
					
					// create a version from the file name that's remaining
					Version version = new Version(name);
					VersionedFile vf = new VersionedFile(version, file);
					array.Add(vf);
				}
				catch{}
			}
			return array.ToArray(typeof(VersionedFile)) as VersionedFile[];
		}
		/// <summary>
		/// Converts the array of files to an array of versioned files
		/// </summary>
		/// <param name="files"></param>
		/// <returns></returns>
		public static VersionedFile[] CreateVersionedFiles(FileInfo[] files)
		{			
			ArrayList array = new ArrayList();
			foreach(FileInfo file in files)
			{				
				try
				{
					string name = file.Name.Replace(file.Extension, null);
					Version version = new Version(name);
					VersionedFile vf = new VersionedFile(version, file);
					array.Add(vf);
				}
				catch{}
			}
			return array.ToArray(typeof(VersionedFile)) as VersionedFile[];
		}
		/// <summary>
		/// Returns the latest version available in the array of files
		/// </summary>
		/// <param name="versionedFiles"></param>
		/// <returns></returns>
		public static VersionedFile GetLatestVersion(VersionedFile[] versionedFiles)
		{
			if (versionedFiles != null)
			{ 
				if (versionedFiles.Length > 0)
				{
					return versionedFiles[0];
				}
			}
			return null;
		}