示例#1
0
        // Physically move the file from its source location to the target folder
        private static bool PhotoMove(CheckSum photo, string targetPath)
        {
            // construct the destPath including the file name
            string[] sourceFolderParts = photo.TheFileName.Split('\\');
            string   fileName          = sourceFolderParts[sourceFolderParts.Length - 1];
            string   destPath          = targetPath + "\\" + fileName;

            // instaniate a FileInfo object for the source file
            FileInfo sourcePath = new FileInfo(photo.FullName());

            try
            {
                // move the file from sourcePath to destPath
                sourcePath.MoveTo(destPath);

                string mess = $"{DateTime.Now} - INFO - File {photo.TheFileName} was moved to {destPath}.";
                Log(mess);

                return(true);
            }
            catch (Exception Ex)
            {
                string mess = $"{DateTime.Now} - ERROR - File {photo.TheFileName} was NOT moved.\r\n{Ex.ToString()}";
                Log(mess);

                return(false);
            }
        }
示例#2
0
        // write new row into the DupesAction table
        private void DupesAction_Insert(CheckSum photo, string duplicateOf)
        {
            // set up the parameters for the stored procedure
            var p = new DynamicParameters();

            p.Add("@TheFileName", photo.FullName());
            p.Add("@DuplicateOf", duplicateOf);
            p.Add("@SHA", $"Photos with the same EXIF DateTime: {photo.SCreateDateTime}");
            p.Add("@FileExt", photo.FileExt);
            p.Add("@FileSize", photo.FileSize);
            p.Add("@FileCreateDt", photo.CreateDateTime);
            p.Add("@OneDriveRemoved", "Y");
            p.Add("@GooglePhotosRemoved", "N");

            using (IDbConnection cnn = new SqlConnection(GetConnectionString()))
            {
                cnn.Execute("dbo.spDupesAction_ins", p, commandType: CommandType.StoredProcedure);
            }
        }