Files
octokit.net/Octokit/Models/Response/WeeklyHash.cs
Cédric Luthi c94cd05b8b Obsolete UnixTimestampExtensions methods (#2121)
* The equivalent of `public static DateTimeOffset FromUnixTime(this long unixTime)` exists in the framework since .NET Framework 4.6: https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.fromunixtimeseconds
* The equivalent of `public static long ToUnixTime(this DateTimeOffset date)` exists in the framework since .NET Framework 4.6: https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tounixtimeseconds
2020-03-03 09:30:30 -04:00

67 lines
2.0 KiB
C#

using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class WeeklyHash
{
public WeeklyHash() { }
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "w")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "a")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "d")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "c")]
public WeeklyHash(long w, int a, int d, int c)
{
W = w;
A = a;
D = d;
C = c;
}
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "W")]
public long W { get; protected set; }
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "A")]
public int A { get; protected set; }
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D")]
public int D { get; protected set; }
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "C")]
public int C { get; protected set; }
public DateTimeOffset Week
{
get { return DateTimeOffset.FromUnixTimeSeconds(W); }
}
public int Additions
{
get { return A; }
}
public int Deletions
{
get { return D; }
}
public int Commits
{
get { return C; }
}
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture,
"Week: {0} Commits: {1}", Week, Commits);
}
}
}
}