//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.SqlTools.ResourceProvider.Core.Authentication;
namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
///
/// Implementation for using VS services
/// Contains information about an Azure account display info
///
public class AzureUserAccountDisplayInfo : IAzureUserAccountDisplayInfo
{
private string userName;
private string accountDisplayName;
///
/// Creating the instance using
///
public AzureUserAccountDisplayInfo(IAzureUserAccountDisplayInfo azureUserAccountDisplayInfo)
{
CopyFrom(azureUserAccountDisplayInfo);
}
///
/// Creating empty instance
///
public AzureUserAccountDisplayInfo()
{
}
private void CopyFrom(IAzureUserAccountDisplayInfo azureUserAccountDisplayInfo)
{
this.AccountDisplayName = azureUserAccountDisplayInfo.AccountDisplayName;
this.AccountLogo = azureUserAccountDisplayInfo.AccountLogo;
this.ProviderDisplayName = azureUserAccountDisplayInfo.ProviderDisplayName;
this.ProviderLogo = azureUserAccountDisplayInfo.ProviderLogo;
this.UserName = azureUserAccountDisplayInfo.UserName;
}
///
/// Returns true if given user account equals this class
///
public bool Equals(IAzureUserAccountDisplayInfo other)
{
return other != null &&
((other.AccountDisplayName == null && AccountDisplayName == null ) || (other.AccountDisplayName != null && other.AccountDisplayName.Equals(AccountDisplayName))) &&
((other.UserName == null && UserName == null ) || (other.UserName != null && other.UserName.Equals(UserName)));
}
///
/// Account display name
///
public string AccountDisplayName
{
get
{
return accountDisplayName != null ? accountDisplayName : string.Empty;
}
set
{
accountDisplayName = value;
}
}
///
/// Account lego
///
public byte[] AccountLogo
{
get;
set;
}
///
/// Provider display name
///
public string ProviderDisplayName
{
get;
set;
}
///
/// Provider lego
///
public byte[] ProviderLogo
{
get;
set;
}
///
/// User name
///
public string UserName
{
get
{
return userName != null ? userName : string.Empty;
}
set
{
userName = value;
}
}
}
}