Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TransferProgress.cs « LibGit2Sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 29638103ae102cfa1f2c64caeedcc3c5d4fa2909 (plain)
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
using System.Diagnostics;
using System.Globalization;
using LibGit2Sharp.Core;

namespace LibGit2Sharp
{
    /// <summary>
    /// Expose progress values from a fetch operation.
    /// </summary>
    [DebuggerDisplay("{DebuggerDisplay,nq}")]
    public class TransferProgress
    {
        private GitTransferProgress gitTransferProgress;

        /// <summary>
        /// Empty constructor.
        /// </summary>
        protected TransferProgress()
        { }

        /// <summary>
        /// Constructor.
        /// </summary>
        internal TransferProgress(GitTransferProgress gitTransferProgress)
        {
            this.gitTransferProgress = gitTransferProgress;
        }

        /// <summary>
        /// Total number of objects.
        /// </summary>
        public virtual int TotalObjects
        {
            get
            {
                return (int) gitTransferProgress.total_objects;
            }
        }

        /// <summary>
        /// Number of objects indexed.
        /// </summary>
        public virtual int IndexedObjects
        {
            get
            {
                return (int) gitTransferProgress.indexed_objects;
            }
        }

        /// <summary>
        /// Number of objects received.
        /// </summary>
        public virtual int ReceivedObjects
        {
            get
            {
                return (int) gitTransferProgress.received_objects;
            }
        }

        /// <summary>
        /// Number of bytes received.
        /// </summary>
        public virtual long ReceivedBytes
        {
            get
            {
                return (long) gitTransferProgress.received_bytes;
            }
        }

        private string DebuggerDisplay
        {
            get
            {
                return string.Format(CultureInfo.InvariantCulture,
                                     "{0}/{1}, {2} bytes", ReceivedObjects, TotalObjects, ReceivedBytes);
            }
        }
    }
}