Skip to content

Commit b0d0613

Browse files
author
ThisWillDoIt
committed
removed now obsolete .NET 4.0 polyfill
1 parent 0248320 commit b0d0613

File tree

12 files changed

+20
-30
lines changed

12 files changed

+20
-30
lines changed

BlogEngine/BlogEngine.Core/Data/RolesRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public RoleItem Add(Data.Models.RoleItem role)
6767
{
6868
throw new System.UnauthorizedAccessException();
6969
}
70-
else if (Utils.StringIsNullOrWhitespace(role.RoleName))
70+
else if (String.IsNullOrWhiteSpace(role.RoleName))
7171
{
7272
throw new ApplicationException("Role name is required");
7373
}
@@ -121,7 +121,7 @@ public bool Remove(string id)
121121
if (!Security.IsAuthorizedTo(Rights.DeleteRoles))
122122
throw new System.UnauthorizedAccessException();
123123

124-
if (Utils.StringIsNullOrWhitespace(id))
124+
if (String.IsNullOrWhiteSpace(id))
125125
throw new ApplicationException("Role name is required");
126126

127127
try
@@ -234,7 +234,7 @@ public bool SaveRights(List<Data.Models.Group> rights, string id)
234234
{
235235
throw new System.UnauthorizedAccessException();
236236
}
237-
else if (Utils.StringIsNullOrWhitespace(id))
237+
else if (String.IsNullOrWhiteSpace(id))
238238
{
239239
throw new ApplicationException("Invalid role name");
240240
}

BlogEngine/BlogEngine.Core/Data/UsersRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public bool Remove(string id){
226226

227227
static Profile GetProfile(string id)
228228
{
229-
if (!Utils.StringIsNullOrWhitespace(id))
229+
if (!String.IsNullOrWhiteSpace(id))
230230
{
231231
var pf = AuthorProfile.GetProfile(id);
232232
if (pf == null)

BlogEngine/BlogEngine.Core/Helpers/Utils.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public static Dictionary<Uri, XmlDocument> FindSemanticDocuments(Uri url, string
675675
public static CultureInfo GetDefaultCulture()
676676
{
677677
var settingsCulture = BlogSettings.Instance.Culture;
678-
if (Utils.StringIsNullOrWhitespace(settingsCulture) ||
678+
if (String.IsNullOrWhiteSpace(settingsCulture) ||
679679
settingsCulture.Equals("Auto", StringComparison.OrdinalIgnoreCase))
680680
{
681681
return CultureInfo.InstalledUICulture;
@@ -1232,16 +1232,6 @@ public static bool SetConditionalGetHeaders(DateTime date)
12321232
return false;
12331233
}
12341234

1235-
/// <summary>
1236-
/// Returns whether a string is null, empty, or whitespace. Same implementation as in String.IsNullOrWhitespace in .Net 4.0
1237-
/// </summary>
1238-
/// <param name="value"></param>
1239-
/// <returns></returns>
1240-
public static bool StringIsNullOrWhitespace(string value)
1241-
{
1242-
return ((value == null) || (value.Trim().Length == 0));
1243-
}
1244-
12451235
/// <summary>
12461236
/// Strips all HTML tags from the specified string.
12471237
/// </summary>
@@ -1253,7 +1243,7 @@ public static bool StringIsNullOrWhitespace(string value)
12531243
/// </returns>
12541244
public static string StripHtml(string html)
12551245
{
1256-
return Utils.StringIsNullOrWhitespace(html) ? string.Empty : RegexStripHtml.Replace(html, string.Empty).Trim();
1246+
return String.IsNullOrWhiteSpace(html) ? string.Empty : RegexStripHtml.Replace(html, string.Empty).Trim();
12571247
}
12581248

12591249
/// <summary>

BlogEngine/BlogEngine.Core/Providers/XmlProvider/XmlRoleProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames
412412
/// </param>
413413
public override bool RoleExists(string roleName)
414414
{
415-
if (Utils.StringIsNullOrWhitespace(roleName))
415+
if (String.IsNullOrWhiteSpace(roleName))
416416
{
417417
throw new ArgumentNullException("roleName");
418418
}

BlogEngine/BlogEngine.Core/Services/Security/CustomIdentity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public CustomIdentity(string username, bool isAuthenticated)
6464
/// <param name="password">The user's password.</param>
6565
public CustomIdentity(string username, string password)
6666
{
67-
if (Utils.StringIsNullOrWhitespace(username))
67+
if (String.IsNullOrWhiteSpace(username))
6868
throw new ArgumentNullException("username");
6969

70-
if (Utils.StringIsNullOrWhitespace(password))
70+
if (String.IsNullOrWhiteSpace(password))
7171
throw new ArgumentNullException("password");
7272

7373
if (!Membership.ValidateUser(username, password)) { return; }

BlogEngine/BlogEngine.Core/Services/Security/Right.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public static void OnRoleDeleting(string roleName)
347347
/// <returns></returns>
348348
private static string PrepareRoleName(string roleName)
349349
{
350-
if (Utils.StringIsNullOrWhitespace(roleName))
350+
if (String.IsNullOrWhiteSpace(roleName))
351351
{
352352
throw new ArgumentNullException("roleName");
353353
}
@@ -373,7 +373,7 @@ public static IEnumerable<Right> GetAllRights()
373373
/// <returns></returns>
374374
public static Right GetRightByName(string rightName)
375375
{
376-
if (Utils.StringIsNullOrWhitespace(rightName))
376+
if (String.IsNullOrWhiteSpace(rightName))
377377
{
378378
throw new ArgumentNullException("rightName");
379379
}

BlogEngine/BlogEngine.Core/Services/Security/SecuritySiteMapProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
3333
}
3434
}
3535

36-
if (!Utils.StringIsNullOrWhitespace(node["rights"]))
36+
if (!String.IsNullOrWhiteSpace(node["rights"]))
3737
{
3838
// By default, all specified Rights must exist.
3939
// We allow this to be overridden via the "rightsAuthorizationCheck"
4040
// attribute.
4141

4242
AuthorizationCheck authCheck = AuthorizationCheck.HasAll;
43-
if (!Utils.StringIsNullOrWhitespace(node["rightsAuthorizationCheck"]))
43+
if (!String.IsNullOrWhiteSpace(node["rightsAuthorizationCheck"]))
4444
{
4545
authCheck = Utils.ParseEnum<AuthorizationCheck>(node["rightsAuthorizationCheck"], AuthorizationCheck.HasAll);
4646
}

BlogEngine/BlogEngine.Core/Services/Syndication/BlogML/BlogReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private Guid GetGuid(string type, string value)
121121

122122
// Value might be a GUID, or it could be a simple integer.
123123

124-
if (!Utils.StringIsNullOrWhitespace(value) &&
124+
if (!String.IsNullOrWhiteSpace(value) &&
125125
value.Length == 36)
126126
{
127127
return new Guid(value);
@@ -160,7 +160,7 @@ private DateTime GetDate(XmlAttribute attr)
160160
DateTime defaultDate = DateTime.Now;
161161

162162
DateTime dt = defaultDate;
163-
if (!Utils.StringIsNullOrWhitespace(value))
163+
if (!String.IsNullOrWhiteSpace(value))
164164
{
165165
if (!DateTime.TryParseExact(value, "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
166166
dt = defaultDate;

BlogEngine/BlogEngine.NET/Custom/Extensions/SendCommentMail.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static void PostCommentAdded(object sender, EventArgs e)
5858
// If moderation is on, send the email if the comment hasn't been moderated (so
5959
// the blog owner can determine if the comment should be approved/rejected).
6060
if (BlogSettings.Instance.EnableCommentsModeration &&
61-
!Utils.StringIsNullOrWhitespace(comment.ModeratedBy))
61+
!String.IsNullOrWhiteSpace(comment.ModeratedBy))
6262
{
6363
return;
6464
}

BlogEngine/BlogEngine.NET/Custom/Widgets/Newsletter/Newsletter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static void SendEmails(IPublishable publishable)
7777
{
7878
foreach (var email in emails)
7979
{
80-
if (!Utils.StringIsNullOrWhitespace(email) && Utils.IsEmailValid(email))
80+
if (!String.IsNullOrWhiteSpace(email) && Utils.IsEmailValid(email))
8181
{
8282
MailMessage message = CreateEmail(publishable);
8383
message.To.Add(email);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy