private void MoveFilesFromStageDBDataToResultDBData() { FileMover fileMover = new FileMover(); fileMover.MoveImageFilesFromFolderToFolder(@"C:\TrashDetector\Data\StageDBData\uncertain", @"C:\TrashDetector\Data\ResultDBData\uncertain\"); fileMover.MoveImageFilesFromFolderToFolder(@"C:\TrashDetector\Data\StageDBData\non_cigarettes", @"C:\TrashDetector\Data\ResultDBData\non_cigarettes\"); fileMover.MoveImageFilesFromFolderToFolder(@"C:\TrashDetector\Data\StageDBData\cigarettes", @"C:\TrashDetector\Data\ResultDBData\cigarettes\"); }
internal void BigReset() { ResetSourceDB(); ResetStageDB(); ResetResultDB(); FileMover fileMover = new FileMover(); fileMover.DeleteEveryJpgFileInFolderAndSubFolders(@"C:\TrashDetector\Data\StageDBData"); fileMover.DeleteEveryJpgFileInFolderAndSubFolders(@"C:\TrashDetector\Data\ResultDBData"); fileMover.UpdateTxtFile("", StageDB.stageDBDataLog); }
public void CopyJpgFiles(string sourceFilePath, string destFilePath, int amount) { FileMover fileMover = new FileMover(); StreamReader sr = new StreamReader(StageDB.stageDBDataLog); string line = sr.ReadLine(); int lastImageFileIndex = 0; if (line != null) { lastImageFileIndex = Int32.Parse(line); } sr.Close(); for (int i = 1; i <= amount; i++) { SourceDB sourceDB = new SourceDB(); ImageFile imageFile = sourceDB.GetImageFile(lastImageFileIndex + i); fileMover.CopyImageFile(imageFile, stageDBDataUnporssedFolder); } if (lastImageFileIndex == 0) { lastImageFileIndex = amount; } else { lastImageFileIndex += amount; } fileMover.UpdateTxtFile(lastImageFileIndex.ToString(), StageDB.stageDBDataLog); //StageDB.stageDBDataLog //fileMover.CopyJpgFiles(sourceFilePath, destFilePath, amount); }
public void SortFilesInStageDBData() { StageDB stageDB = new StageDB(); List <ImageInfo> imageInfos = new List <ImageInfo>(); imageInfos = stageDB.GetAllImageInfos(); FileMover fileMover = new FileMover(); decimal isCigDecider = new decimal(0.70); decimal isNonCigDecider = new decimal(0.70); foreach (ImageInfo imageInfo in imageInfos) { //{ LessThan = -1, Equals = 0, GreaterThan = 1 } if (Decimal.Compare(imageInfo.IsCig, isCigDecider) == 1 || Decimal.Compare(imageInfo.IsCig, isCigDecider) == 0) { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\cigarettes\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\cigarettes\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } else if (Decimal.Compare(imageInfo.IsNotCig, isNonCigDecider) == 1 || Decimal.Compare(imageInfo.IsCig, isNonCigDecider) == 0) { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\non_cigarettes\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\non_cigarettes\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } else { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\uncertain\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\uncertain\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } } }