public IEnumerable <FileSystemPackage> GetPackages(FileSystemApplication application, Version since = null)
        {
            List <FileSystemPackage> packages = new List <FileSystemPackage>();

            foreach (string packageFolder in Directory.EnumerateDirectories(Path.Combine(application.Directory, "bin")))
            {
                Version version;
                string  packageFolderName = Path.GetFileName(packageFolder);
                if (!Version.TryParse(packageFolderName, out version))
                {
                    Logger.Warn(this, "Package folder " + packageFolder + " could not be parsed as a " + typeof(Version).FullName);
                    continue;
                }
                if (since == null || version > since)
                {
                    FileSystemPackage package = new FileSystemPackage {
                        Version     = version,
                        Directory   = Path.GetFullPath(packageFolder),
                        Application = application
                    };
                    packages.Add(package);
                }
            }
            return(packages.OrderBy(p => p.Version));
        }
		public IEnumerable<FileSystemPackage> GetPackages(FileSystemApplication application, Version since = null) {
			List<FileSystemPackage> packages = new List<FileSystemPackage>();
			foreach(string packageFolder in Directory.EnumerateDirectories(Path.Combine(application.Directory, "bin"))) {
				Version version;
				string packageFolderName = Path.GetFileName(packageFolder);
				if (!Version.TryParse(packageFolderName, out version)) {
					Logger.Warn(this, "Package folder " + packageFolder + " could not be parsed as a " + typeof(Version).FullName);
					continue;
				}
				if (since == null || version > since) {
					FileSystemPackage package = new FileSystemPackage {
						Version = version,
						Directory = Path.GetFullPath(packageFolder),
						Application = application
					};
					packages.Add(package);
				}
			}
			return (packages.OrderBy(p => p.Version));
		}
        public FileSystemPackage GetPackage(FileSystemApplication application, Version version = null)
        {
            List <FileSystemPackage> packages = this.GetPackages(application).OrderBy(p => p.Version).ToList();

            if (packages.Count > 0)
            {
                if (version != null)
                {
                    FileSystemPackage package = packages.FirstOrDefault(p => p.Version == version);
                    if (package != null)
                    {
                        return(package);
                    }
                }
                else
                {
                    FileSystemPackage package = packages.Last();
                    return(package);
                }
            }
            throw new ObjectNotFoundException("Package version " + version + " does not exist for application " + application.Name);
        }