|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace DevWilson
{
class Tests
{
public static int Test1(string imagesFolder)
{
List<string> imagePaths = new List<string>(Directory.GetFiles(imagesFolder, "*.jpg", SearchOption.AllDirectories));
ImageOrientationSlow slow = new ImageOrientationSlow();
List<string> landscapes = new List<string>();
foreach (string imagePath in imagePaths)
{
if (slow.IsLandscape(imagePath))
{
landscapes.Add(imagePath);
}
}
return landscapes.Count;
}
public static int Test2(string imagesFolder)
{
List<string> imagePaths = new List<string>(Directory.GetFiles(imagesFolder, "*.jpg", SearchOption.AllDirectories));
ImageOrientationThreaded threaded = new ImageOrientationThreaded();
threaded.GetLandscapeThreaded(imagePaths);
List<string> landscapes = threaded.Landscapes;
return landscapes.Count;
}
public static int Test3(string imagesFolder, string cachePath)
{
ImageList images = new ImageList(cachePath);
if (File.Exists(cachePath))
{
ImageListToXml.LoadFromXml(cachePath, images);
}
ImageFolderQuickCheck.QuickCheck(images, imagesFolder);
return images.Count(i => i.Orientation == ImageOrientation.Landscape);
}
}
}
|
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.
Hi, my name's Andy Wilson and I live in Cambridge, UK where I work as a Senior C# Software Developer.