/* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
namespace Alphaleonis.Win32.Filesystem
{
/// Class for CopyMoveResult that contains the results for the Copy or Move action.
public sealed class CopyMoveResult
{
/// Create a CopyMoveResult class instance for the Copy or Move action.
/// Indicates the source file or directory.
/// Indicates the destination file or directory.
/// Indicates if the action was canceled.
/// The error code encountered during the Copy or Move action.
public CopyMoveResult(string source, string destination, bool isCanceled, int errorCode)
{
Source = source;
Destination = destination;
IsCanceled = isCanceled;
ErrorCode = errorCode;
}
/// The error code encountered during the Copy or Move action.
/// 0 (zero) indicates success.
public int ErrorCode { get; internal set; }
/// The error message from the that was encountered during the Copy or Move action.
/// A message describing the error.
[SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
public string ErrorMessage
{
get { return new Win32Exception(ErrorCode).Message; }
}
/// When true indicates that the Copy or Move action was canceled.
/// when the Copy/Move action was canceled. Otherwise .
public bool IsCanceled { get; internal set; }
/// Indicates the source file or directory.
public string Source { get; private set; }
/// Indicates the destination file or directory.
public string Destination { get; private set; }
/// The total number of folders copied.
public long TotalFolders { get; internal set; }
/// The total number of files copied.
public long TotalFiles { get; internal set; }
/// The total number of bytes copied.
public long TotalBytes { get; internal set; }
}
}