From 33fff6be51aec7ec491b61952ea1c0d47f43ff47 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 18 Dec 2019 13:04:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A9=20Deprecating=20API=20found=20in?= =?UTF-8?q?=20Humanizer=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- X10D/src/DateTimeExtensions.cs | 24 +++++++++ X10D/src/Int16Extensions.cs | 48 ++++++++++++++++++ X10D/src/Int32Extensions.cs | 92 ++++++++++++++++++++++++++++++++++ X10D/src/Int64Extensions.cs | 44 ++++++++++++++++ X10D/src/StringExtensions.cs | 8 +++ 5 files changed, 216 insertions(+) diff --git a/X10D/src/DateTimeExtensions.cs b/X10D/src/DateTimeExtensions.cs index 0cf8d16..e505b80 100644 --- a/X10D/src/DateTimeExtensions.cs +++ b/X10D/src/DateTimeExtensions.cs @@ -77,6 +77,10 @@ /// Gets a representing midnight on the current date. /// /// The current date. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime Midnight(this DateTime current) { return new DateTime(current.Year, current.Month, current.Day, 0, 0, 0); @@ -105,6 +109,10 @@ /// Gets a representing noon on the current date. /// /// The current date. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime Noon(this DateTime current) { return new DateTime(current.Year, current.Month, current.Day, 12, 0, 0); @@ -129,6 +137,10 @@ /// The to copy. /// The year to set. /// Returns a . + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime WithYear(this DateTime date, int year) { return new DateTime(year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Millisecond); @@ -140,6 +152,10 @@ /// The current date. /// The hour. /// The minute. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime WithTime(this DateTime current, int hour, int minute) { return current.WithTime(hour, minute, 0); @@ -153,6 +169,10 @@ /// The minute. /// The second. /// + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime WithTime(this DateTime current, int hour, int minute, int second) { return current.WithTime(hour, minute, second, 0); @@ -166,6 +186,10 @@ /// The minute. /// The second. /// The millisecond. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime WithTime(this DateTime current, int hour, int minute, int second, int millisecond) { return new DateTime(current.Year, current.Month, current.Day, hour, minute, second, millisecond); diff --git a/X10D/src/Int16Extensions.cs b/X10D/src/Int16Extensions.cs index 9c598f9..a4272cd 100644 --- a/X10D/src/Int16Extensions.cs +++ b/X10D/src/Int16Extensions.cs @@ -15,61 +15,109 @@ // TODO change + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this ushort number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this ushort number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this ushort number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this ushort number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this ushort number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Ticks(this ushort number) { return TimeSpan.FromTicks(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this short number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this short number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this short number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this short number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this short number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Ticks(this short number) { return TimeSpan.FromTicks(number); diff --git a/X10D/src/Int32Extensions.cs b/X10D/src/Int32Extensions.cs index 571714d..c8b7a2d 100644 --- a/X10D/src/Int32Extensions.cs +++ b/X10D/src/Int32Extensions.cs @@ -21,6 +21,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime January(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 1, day, hour, minute, second); @@ -34,6 +38,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime February(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 2, day, hour, minute, second); @@ -47,6 +55,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime March(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 3, day, hour, minute, second); @@ -60,6 +72,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime April(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 4, day, hour, minute, second); @@ -73,6 +89,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime May(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 5, day, hour, minute, second); @@ -86,6 +106,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime June(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 6, day, hour, minute, second); @@ -112,6 +136,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime August(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 8, day, hour, minute, second); @@ -125,6 +153,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime September(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 9, day, hour, minute, second); @@ -138,6 +170,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime October(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 10, day, hour, minute, second); @@ -151,6 +187,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime November(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 11, day, hour, minute, second); @@ -164,6 +204,10 @@ /// The hour. /// The minute. /// The second. + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static DateTime December(this int day, int year, int hour = 0, int minute = 0, int second = 0) { return new DateTime(year, 12, day, hour, minute, second); @@ -175,61 +219,109 @@ // TODO change + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this uint number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this uint number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this uint number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this uint number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this uint number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Ticks(this uint number) { return TimeSpan.FromTicks(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this int number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this int number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this int number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this int number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this int number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Ticks(this int number) { return TimeSpan.FromTicks(number); diff --git a/X10D/src/Int64Extensions.cs b/X10D/src/Int64Extensions.cs index 8161763..4424e37 100644 --- a/X10D/src/Int64Extensions.cs +++ b/X10D/src/Int64Extensions.cs @@ -15,56 +15,100 @@ // TODO change + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this ulong number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this ulong number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this ulong number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this ulong number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this ulong number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Days(this long number) { return TimeSpan.FromDays(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Hours(this long number) { return TimeSpan.FromHours(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Milliseconds(this long number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Minutes(this long number) { return TimeSpan.FromMinutes(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Seconds(this long number) { return TimeSpan.FromSeconds(number); } + [Obsolete( + "This method has been deprecated in favor of Humanizer's fluent DateTime API. " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static TimeSpan Ticks(this long number) { return TimeSpan.FromTicks(number); diff --git a/X10D/src/StringExtensions.cs b/X10D/src/StringExtensions.cs index cd2a63d..ea2e50e 100644 --- a/X10D/src/StringExtensions.cs +++ b/X10D/src/StringExtensions.cs @@ -41,6 +41,10 @@ /// The type of the Enum /// String value to parse /// The Enum corresponding to the stringExtensions + [Obsolete( + "This method has been deprecated in favor of Humanizer.DehumanizeTo(). "+ + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static T EnumParse(this string value) { return value.EnumParse(false); @@ -53,6 +57,10 @@ /// String value to parse /// Whether or not to ignore casing. /// The Enum corresponding to the stringExtensions + [Obsolete( + "This method has been deprecated in favor of Humanizer.DehumanizeTo(). " + + "Please consider downloading the Humanizer package for more stable implementations of this method." + )] public static T EnumParse(this string value, bool ignoreCase) { if (value == null)