/// <summary> /// Performs an action to copy files. /// </summary> /// <param name="t">Single IO target.</param> /// <param name="srcObjPath">Path to source object.</param> /// <param name="dstObjPath">Path to destination object.</param> /// <param name="overwrite">Overwrite end point object or not.</param> protected override void OnProcess(BaseActionTarget t, string srcObjPath, string dstObjPath, bool overwrite) { if (t.IsFile) { File.Copy(srcObjPath, dstObjPath, overwrite); } else { FileIO.CopyAll(srcObjPath, dstObjPath, overwriteFiles: overwrite); } }
/// <summary> /// Performs an action to move files. /// </summary> /// <param name="t">Single IO target.</param> /// <param name="srcObjPath">Path to source object.</param> /// <param name="dstObjPath">Path to destination object.</param> /// <param name="overwrite">Overwrite end point object or not.</param> protected override void OnProcess(BaseActionTarget t, string srcObjPath, string dstObjPath, bool overwrite) { if (t.IsFile) { if (File.Exists(dstObjPath)) { File.Delete(dstObjPath); File.Move(srcObjPath, dstObjPath); } else { File.Move(srcObjPath, dstObjPath); } } else { FileIO.CopyAll(srcObjPath, dstObjPath, overwrite); Directory.Delete(srcObjPath, true); // Remove folder because the move folder method does not exists by default. } }
/// <summary> /// Custom method for processing the single target object. /// </summary> /// <param name="t">The info about target.</param> /// <param name="srcObjPath">The source path to the object.</param> /// <param name="dstObjPath">The destination path to the object.</param> /// <param name="overwrite">Overwrite end point object or not.</param> protected abstract void OnProcess(BaseActionTarget t, string srcObjPath, string dstObjPath, bool overwrite);