public void InstallDefaultImages()
{
string imageFolder = this.deviceScale == 1 ? "StandardResolution" : "RetinaResolution";
var searchFolder = Path.Combine("Content/DefaultImages", imageFolder);
var folderList = Directory.EnumerateDirectories(searchFolder);
foreach (var folder in folderList)
{
var pictureID = Path.GetFileName(folder);
var imageDestination = Path.Combine(this.masterImagePath, String.Format("{0}.JPG", pictureID));
var imageSource = Path.Combine(folder, String.Format("{0}.JPG", pictureID));
if (!File.Exists(imageDestination) && File.Exists(imageSource))
{
// Copy the master jpg image
File.Copy(imageSource, imageDestination);
}
var destinationImageDataFolder = Path.Combine(this.imageDataPath, pictureID);
if (!File.Exists(destinationImageDataFolder))
{
// Ceate a folder for the data info file and undo/redo render buffer files...
Directory.CreateDirectory(destinationImageDataFolder);
}
foreach (string fileToCopy in new string[] { "DATA.INF", "0.REC", "0.PNG" })
{
// ... and then copy the data in.
var sourceDataFile = Path.Combine(folder, fileToCopy);
var destinationDataFile = Path.Combine(destinationImageDataFolder, fileToCopy);
if (!File.Exists(destinationDataFile) && File.Exists(sourceDataFile))
{
File.Copy(sourceDataFile, destinationDataFile);
}
}
}
}