-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackgroundCopyFileProgress.cs
99 lines (72 loc) · 2.79 KB
/
BackgroundCopyFileProgress.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// @(#) BackgroundCopyFileProgress.cs
//
// Project: usis.Net.Bits
// System: Microsoft Visual Studio 2017
// Author: Udo Schäfer
//
// Copyright (c) 2017,2018 usis GmbH. All rights reserved.
using System.Globalization;
using usis.Net.Bits.Interop;
namespace usis.Net.Bits
{
// --------------------------------
// BackgroundCopyFileProgress class
// --------------------------------
/// <summary>
/// Provides file-related progress information,
/// such as the number of bytes transferred.
/// </summary>
public class BackgroundCopyFileProgress
{
#region fields
private BG_FILE_PROGRESS progress;
#endregion fields
#region construction
// ------------
// construction
// ------------
internal BackgroundCopyFileProgress(BG_FILE_PROGRESS progress) => this.progress = progress;
#endregion construction
#region properties
// -------------------
// BytesTotal property
// -------------------
/// <summary>
/// Gets the size of the file in bytes.
/// If the value is -1, the total size of the file has not been determined.
/// BITS does not set this value if it cannot determine the size of the file.
/// For example, if the specified file or server does not exist,
/// BITS cannot determine the size of the file.
/// </summary>
public long BytesTotal => progress.bytesTotal;
// -------------------------
// BytesTransferred property
// -------------------------
/// <summary>
/// Gets the number of bytes transferred.
/// </summary>
public long BytesTransferred => progress.bytesTransferred;
// ------------------
// Completed property
// ------------------
/// <summary>
/// Gets a value indicating whether the file is available to the user.
/// </summary>
public bool Completed => progress.completed;
#endregion properties
#region methods
// ---------------
// ToString method
// ---------------
/// <summary>
/// Returns a <see cref="string" /> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="string" /> that represents this instance.
/// </returns>
public override string ToString() => string.Format(CultureInfo.InvariantCulture, "{0}: {1} bytes of {2}; {3}completed.", nameof(BackgroundCopyFileProgress), BytesTransferred, BytesTotal, Completed ? string.Empty : "not ");
#endregion methods
}
}
// eof "BackgroundCopyFileProgress.cs"