namespace VideoBrowser.Core
{
using System;
///
/// Defines the
///
public class YoutubeAuthentication
{
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The username
/// The password
/// The twoFactor
public YoutubeAuthentication(string username, string password, string twoFactor)
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
{
throw new Exception($"{this.GetType().Name}: {nameof(username)} and {nameof(password)} can't be empty or null.");
}
this.Username = username;
this.Password = password;
this.TwoFactor = twoFactor;
}
#endregion Constructors
#region Properties
///
/// Gets the Password
///
public string Password { get; private set; }
///
/// Gets the TwoFactor
///
public string TwoFactor { get; private set; }
///
/// Gets the Username
///
public string Username { get; private set; }
#endregion Properties
#region Methods
///
/// The ToCmdArgument
///
/// The
public string ToCmdArgument()
{
var twoFactor = this.TwoFactor;
if (!string.IsNullOrEmpty(twoFactor))
{
twoFactor = string.Format(Commands.TwoFactor, twoFactor);
}
return string.Format(Commands.Authentication,
this.Username,
this.Password) + twoFactor;
}
#endregion Methods
}
}