//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.SqlTools.EditorServices.Session
{
///
/// Contains details about the current host application (most
/// likely the editor which is using the host process).
///
public class HostDetails
{
#region Constants
///
/// The default host name for SqlTools Editor Services. Used
/// if no host name is specified by the host application.
///
public const string DefaultHostName = "SqlTools Editor Services Host";
///
/// The default host ID for SqlTools Editor Services. Used
/// for the host-specific profile path if no host ID is specified.
///
public const string DefaultHostProfileId = "Microsoft.SqlToolsEditorServices";
///
/// The default host version for SqlTools Editor Services. If
/// no version is specified by the host application, we use 0.0.0
/// to indicate a lack of version.
///
public static readonly Version DefaultHostVersion = new Version("0.0.0");
///
/// The default host details in a HostDetails object.
///
public static readonly HostDetails Default = new HostDetails(null, null, null);
#endregion
#region Properties
///
/// Gets the name of the host.
///
public string Name { get; private set; }
///
/// Gets the profile ID of the host, used to determine the
/// host-specific profile path.
///
public string ProfileId { get; private set; }
///
/// Gets the version of the host.
///
public Version Version { get; private set; }
#endregion
#region Constructors
///
/// Creates an instance of the HostDetails class.
///
///
/// The display name for the host, typically in the form of
/// "[Application Name] Host".
///
///
/// The identifier of the SqlTools host to use for its profile path.
/// loaded. Used to resolve a profile path of the form 'X_profile.ps1'
/// where 'X' represents the value of hostProfileId. If null, a default
/// will be used.
///
/// The host application's version.
public HostDetails(
string name,
string profileId,
Version version)
{
this.Name = name ?? DefaultHostName;
this.ProfileId = profileId ?? DefaultHostProfileId;
this.Version = version ?? DefaultHostVersion;
}
#endregion
}
}