public int GSaveDataOptions(ImageFile imageFile) { int op = IOUser.ConsoleReadInput(GeneralSaveDataList); switch (op) { case 0: IOUser.ClearConsole(); IOUser.ConsoleOutput("Changes Saved! Going back to editing options"); Thread.Sleep(2000); break; case 1: IOUser.ClearConsole(); IOUser.ConsoleOutput("Changes Discarded! Going back to text inserter"); Thread.Sleep(2000); break; case 2: IOUser.ClearConsole(); IOUser.ConsoleOutput("Changes Discarded! Going back to editing options"); Thread.Sleep(2000); break; case 3: IOUser.ClearConsole(); IOUser.ConsoleOutput("Going back to *SELECTED WORKING STATION*"); Thread.Sleep(2000); break; } return(op); }
public void ProductionAlterSaveDataOptions(ImageFile imageFile, Bitmap newBMP) { string newFileName; string newPath; int op = IOUser.ConsoleReadInput(ProductionSaveDataList); switch (op) { case 0: IOUser.ClearConsole(); Console.WriteLine("\nEnter a name for the new image (don't add .jpg):\n"); newFileName = IOUser.ConsoleSaveAs(imageFile.Origin, saveDirectory); newPath = Path.Combine(saveDirectory, newFileName); File.Copy(imageFile.Origin, newPath); IOUser.ConsoleOutput("Changes Saved! Going back to editing options"); imageFile.Bpm = newBMP; imageFile.Bpm.Save(newPath); Thread.Sleep(2000); break; case 1: IOUser.ClearConsole(); IOUser.ConsoleOutput("Changes Discarded! Going back to editing options"); Thread.Sleep(2000); break; } }
public string ImportPath(int op) { string workingPath = "/%void%/"; string path; switch (op) { case 0: break; case 1: path = IOUser.ConsoleReadPath(); if (path != "/%void%/") { File.Copy(path, Path.Combine(importDirectory, Path.GetFileName(path))); } return(workingPath); case 2: List <string> paths = IOUser.ConsoleReadDirectory(extensionTypes); if (paths[0] != "/%void%/") { foreach (string p in paths) { File.Copy(p, Path.Combine(importDirectory, Path.GetFileName(p))); } } return(workingPath); case 3: if (!Directory.EnumerateFiles(importDirectory).Any()) { IOUser.ConsoleError("Import directory is empty..."); Thread.Sleep(1500); IOUser.ClearConsole(); return(workingPath); } else { path = IOUser.ConsoleReadFileName(importDirectory, extensionTypes); return(path); } } return(workingPath); }
public void ProductionSaveDataOptions(string originBMPpath, Bitmap newBMP) { string newFileName; string newPath; string importFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\PM-Images\\Imports"); int op = IOUser.ConsoleReadInput(ProductionSaveDataList); switch (op) { case 0: IOUser.ClearConsole(); Console.WriteLine("\nEnter a name for the new image (don't add .jpg):\n"); newFileName = IOUser.ConsoleSaveAs(originBMPpath, saveDirectory); newPath = Path.Combine(saveDirectory, newFileName); importFolderPath = Path.Combine(importFolderPath, newFileName); File.Copy(originBMPpath, newPath); IOUser.ConsoleOutput("Changes Saved and Copy created! Going back to editing options"); newBMP.Save(newPath); newBMP.Save(importFolderPath); Thread.Sleep(2000); break; case 1: IOUser.ClearConsole(); Console.WriteLine("\nEnter a name for the new image (don't add .jpg):\n"); newFileName = IOUser.ConsoleSaveAs(originBMPpath, saveDirectory); newPath = Path.Combine(saveDirectory, newFileName); File.Copy(originBMPpath, newPath); IOUser.ConsoleOutput("Changes Saved! Going back to editing options"); newBMP.Save(newPath); Thread.Sleep(2000); break; case 2: IOUser.ClearConsole(); IOUser.ConsoleOutput("Changes Discarded! Going back to editing options"); Thread.Sleep(2000); break; } }
public List <string> MoreImages(int op, List <string> fusionImgs) { List <string> backOP = new List <string>() { "/%void%/" }; switch (op) { case 0: return(backOP); case 1: bool valid = false; int moreOption = -1; while (!valid) { while (moreOption == -1) { IOUser.ClearConsole(); string path = IOUser.ConsoleReadFileName(importDirectory, extensionTypes, "Enter the image name to select from import folder:\n"); if (path != "/%void%/" && !fusionImgs.Contains(path)) { fusionImgs.Add(path); break; } if (fusionImgs.Contains(path)) { IOUser.ConsoleError("Image already selected...\n"); Thread.Sleep(1000); } else { IOUser.ClearConsole(); IOUser.ConsoleListOutput("Go back to image production menu?", YNListI); moreOption = IOUser.ConsoleReadInput(YNListI) - 1; if (moreOption == 0) { return(new List <string>() { "/%void%/" }); } } } IOUser.ClearConsole(); IOUser.ConsoleListOutput("Use another image?", YNListI); moreOption = IOUser.ConsoleReadInput(YNListI); if (moreOption == 0) { return(fusionImgs); } else { IOUser.ClearConsole(); string path = IOUser.ConsoleReadFileName(importDirectory, extensionTypes, "Enter the image name to select from import folder:\n"); if (path != "/%void%/" && !fusionImgs.Contains(path)) { fusionImgs.Add(path); continue; } if (fusionImgs.Contains(path)) { IOUser.ConsoleError("Image already selected...\n"); Thread.Sleep(1000); } continue; } } return(backOP); //MORE CASES } return(backOP); }
public void Launch() { IOUser.ConsoleWelcome(); Importer importer = new Importer(); if (!Directory.Exists(importer.importDirectory)) { FileSystem.CreateDirectory(importer.importDirectory); } SaveEXIFData(); SaveData saveData = new SaveData(); if (!Directory.Exists(saveData.saveDirectory)) { FileSystem.CreateDirectory(saveData.saveDirectory); } List <ImageFile> imageFilesImportFolder = LoadEXIFData(); int searchOption = -1; while (searchOption != 0) { IOUser.ConsoleListOutput("Select one of the following options:", importer.ImportList); searchOption = IOUser.ConsoleReadInput(importer.ImportList); IOUser.ClearConsole(); if (searchOption == 0) { IOUser.ConsoleExit(); Thread.Sleep(2500); break; } string path = importer.ImportPath(searchOption); if (path == "/%void%/") { IOUser.ClearConsole(); continue; } SaveEXIFData(); ImageFile imageFile = new ImageFile(path); int editingOption = -1; while (editingOption != 0) { IOUser.ClearConsole(); IOUser.ConsoleListOutput("Select one of the following options:", EditingList); editingOption = IOUser.ConsoleReadInput(EditingList); switch (editingOption) //PHOTO EDITING OPTIONS { case 0: break; case 1: //IMAGE FILTERS int saveDataOption1 = 1; while ((saveDataOption1 == 1) || (saveDataOption1 == 3)) { IOUser.ClearConsole(); IOUser.ConsoleListOutput("Select one of the following filters:", FilterList); int filterOption = IOUser.ConsoleReadInput(FilterList); Bitmap filter = imageFile.Bpm; // switch (filterOption) { case 0: break; case 1: //GRAY SCALE filter = Filters.GreyScale(imageFile.Bpm); IOUser.ConsoleOutput("Filter applied successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); break; case 2: //NEGATIVE filter = Filters.Negative(imageFile.Bpm); IOUser.ConsoleOutput("Filter applied successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); break; case 3: //SEPIA filter = Filters.Sepia(imageFile.Bpm); IOUser.ConsoleOutput("Filter applied successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); break; case 4: //BLOSSOM filter = Filters.Blossom(imageFile.Bpm); IOUser.ConsoleOutput("Filter applied successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); break; case 5: //OLD MOVIE filter = Filters.OldMovie(imageFile.Bpm); IOUser.ConsoleOutput("Filter applied successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); break; } if (filterOption == 0) { break; } IOUser.ClearConsole(); IOUser.ConsoleListOutput("Apply changes?", saveData.FilterSaveDataList); saveDataOption1 = saveData.FilterSaveDataOptions(imageFile, filter); IOUser.ClearConsole(); } break; case 2: int productionOption = -1; while (productionOption != 0) { IOUser.ClearConsole(); IOUser.ConsoleListOutput("Select one of the following production options:", ProductionList); productionOption = IOUser.ConsoleReadInput(ProductionList); switch (productionOption) //IMAGE PRODUCTION { case 0: break; case 1: //FUSION IOUser.ClearConsole(); IOUser.ConsoleListOutput("Select one of the following options:", importer.SelectMoreImages); int moreImgOp = IOUser.ConsoleReadInput(importer.SelectMoreImages); if (moreImgOp == 0) { break; } List <string> fusionList = new List <string> { imageFile.Origin }; fusionList = importer.MoreImages(moreImgOp, fusionList); if (fusionList[0] == "/%void%/") { break; } List <Bitmap> fusionListBMP = new List <Bitmap>(); fusionListBMP.Add(imageFile.Bpm); foreach (string f in fusionList) { fusionListBMP.Add(new Bitmap(f)); } string productionBase = Editor.getSmallerImage(fusionList); Bitmap fusionBMP = Editor.Fusion(fusionListBMP); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); IOUser.ClearConsole(); IOUser.ConsoleListOutput("Apply changes?", saveData.ProductionSaveDataList); saveData.ProductionSaveDataOptions(productionBase, fusionBMP); IOUser.ClearConsole(); productionOption = 0; break; case 2: //MOSAIC IOUser.ClearConsole(); IOUser.ConsoleError("NOT YET IMPLEMENTED"); Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); productionOption = 0; break; case 3: //COLLAGE IOUser.ClearConsole(); IOUser.ConsoleError("NOT YET IMPLEMENTED"); Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); productionOption = 0; break; } } break; case 3: //TEXT INSERTER IOUser.ClearConsole(); IOUser.ConsoleOutput("Write the text you want to insert:\n"); string itText = Console.ReadLine(); List <string> ColorList = new List <string>() { "Black", "White", "Red", "Green", "Blue", "Gray" }; IOUser.ConsoleListOutput("Select a color:", ColorList); int colorOption = IOUser.ConsoleReadInput(ColorList); IOUser.ConsoleOutput("Insert font size (bigger font is recomended for large images):\n"); int itFontSize = IOUser.ConsoleReadNumber(); IOUser.ConsoleOutput($"Select x coordinates (for reference your image has {imageFile.Bpm.Width} of width):\n"); int itXCoordinates = IOUser.ConsoleReadNumber(); IOUser.ConsoleOutput($"Select y coordinates (for reference your image has {imageFile.Bpm.Height} of height):\n"); int itYCoordinates = IOUser.ConsoleReadNumber(); Bitmap textBMP = Editor.TEXT(imageFile.Bpm, itText, ColorList[colorOption], itFontSize, itXCoordinates, itYCoordinates); IOUser.ClearConsole(); IOUser.ConsoleOutput("Text inserted successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); IOUser.ClearConsole(); IOUser.ConsoleListOutput("Apply changes?", saveData.ProductionAlterSaveDataList); saveData.ProductionAlterSaveDataOptions(imageFile, textBMP); IOUser.ClearConsole(); break; case 4: //IMAGE ROTATOR IOUser.ClearConsole(); List <string> RotateList = new List <string>() { "By 270°", "By 90°", "By 180°" }; IOUser.ConsoleListOutput("By how many degrees you want to rotate the image (clockwise)?", RotateList); int rotateOption = IOUser.ConsoleReadInput(RotateList); RotateFlipType applyRotate = RotateFlipType.RotateNoneFlipNone; //BASE if (rotateOption == 1) { applyRotate = RotateFlipType.Rotate90FlipNone; } if (rotateOption == 2) { applyRotate = RotateFlipType.Rotate180FlipNone; } if (rotateOption == 0) { applyRotate = RotateFlipType.Rotate270FlipNone; } Bitmap rotate = imageFile.Bpm; // rotate.RotateFlip(applyRotate); IOUser.ConsoleOutput("Image rotated successfully!"); IOUser.ConsoleError("SHOW IMAGE"); //SHOW Console.WriteLine("\nPress any key to continue"); Console.ReadLine(); IOUser.ClearConsole(); IOUser.ConsoleListOutput("Apply changes?", saveData.ProductionAlterSaveDataList); saveData.ProductionAlterSaveDataOptions(imageFile, rotate); IOUser.ClearConsole(); break; //MORE CASES } IOUser.ClearConsole(); } } }