From 97ab72660f10fb438b775e8c4bb61bc8ffc58fb2 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 6 Dec 2015 17:37:08 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/NetworkCredential.cs | 75 +++++++++++++----------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/websocket-sharp/Net/NetworkCredential.cs b/websocket-sharp/Net/NetworkCredential.cs index e66394a9..d2d392ce 100644 --- a/websocket-sharp/Net/NetworkCredential.cs +++ b/websocket-sharp/Net/NetworkCredential.cs @@ -4,7 +4,7 @@ * * The MIT License * - * Copyright (c) 2014 sta.blockhead + * Copyright (c) 2014-2015 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,69 +31,76 @@ using System; namespace WebSocketSharp.Net { /// - /// Provides the credentials for HTTP authentication (Basic/Digest). + /// Provides the credentials for the HTTP authentication (Basic/Digest). /// public class NetworkCredential { #region Private Fields - private string _domain; - private string _password; - private string [] _roles; - private string _username; + private string _domain; + private string _password; + private string[] _roles; + private string _username; #endregion #region Public Constructors /// - /// Initializes a new instance of the class - /// with the specified user name and password. + /// Initializes a new instance of the class with + /// the specified user name and password. /// /// - /// A that represents the user name associated with the - /// credentials. + /// A that represents the user name associated with the credentials. /// /// - /// A that represents the password for the user name - /// associated with the credentials. + /// A that represents the password for the user name associated with + /// the credentials. /// + /// + /// is . + /// /// - /// is or empty. + /// is empty. /// public NetworkCredential (string username, string password) - : this (username, password, null, new string [0]) + : this (username, password, null, new string[0]) { } /// - /// Initializes a new instance of the class - /// with the specified user name, password, domain, and roles. + /// Initializes a new instance of the class with + /// the specified user name, password, domain, and roles. /// /// - /// A that represents the user name associated with the - /// credentials. + /// A that represents the user name associated with the credentials. /// /// - /// A that represents the password for the user name - /// associated with the credentials. + /// A that represents the password for the user name associated with + /// the credentials. /// /// - /// A that represents the name of the user domain - /// associated with the credentials. + /// A that represents the name of the user domain associated with + /// the credentials. /// /// /// An array of that contains the role names to which /// the user associated with the credentials belongs if any. /// + /// + /// is . + /// /// - /// is or empty. + /// is empty. /// public NetworkCredential ( - string username, string password, string domain, params string [] roles) + string username, string password, string domain, params string[] roles) { - if (username == null || username.Length == 0) - throw new ArgumentException ("Must not be null or empty.", "username"); + if (username == null) + throw new ArgumentNullException ("username"); + + if (username.Length == 0) + throw new ArgumentException ("An empty string.", "username"); _username = username; _password = password; @@ -109,8 +116,8 @@ namespace WebSocketSharp.Net /// Gets the name of the user domain associated with the credentials. /// /// - /// A that represents the name of the user domain - /// associated with the credentials. + /// A that represents the name of the user domain associated with + /// the credentials. /// public string Domain { get { @@ -126,8 +133,8 @@ namespace WebSocketSharp.Net /// Gets the password for the user name associated with the credentials. /// /// - /// A that represents the password for the user name - /// associated with the credentials. + /// A that represents the password for the user name associated with + /// the credentials. /// public string Password { get { @@ -140,14 +147,13 @@ namespace WebSocketSharp.Net } /// - /// Gets the role names to which the user associated with the credentials - /// belongs. + /// Gets the role names to which the user associated with the credentials belongs. /// /// /// An array of that contains the role names to which /// the user associated with the credentials belongs. /// - public string [] Roles { + public string[] Roles { get { return _roles; } @@ -161,8 +167,7 @@ namespace WebSocketSharp.Net /// Gets the user name associated with the credentials. /// /// - /// A that represents the user name associated with the - /// credentials. + /// A that represents the user name associated with the credentials. /// public string UserName { get {