//****************************************************************************************************** // ExportDestination.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 02/13/2008 - J. Ritchie Carroll // Initial version of source generated. // 09/19/2008 - J. Ritchie Carroll // Converted to C#. // 10/23/2008 - Pinal C. Patel // Edited code comments. // 09/14/2009 - Stephen C. Wills // Added new header and license agreement. // 09/22/2011 - J. Ritchie Carroll // Added Mono implementation exception regions. // 12/14/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System.ComponentModel; using System.Drawing.Design; using System.IO; using System.Windows.Forms.Design; namespace GSF.IO { /// /// Represents a destination location when exporting data using . /// /// public class ExportDestination { #region [ Members ] // Fields private string m_destinationFile; private bool m_connectToShare; private string m_domain; private string m_userName; private string m_password; #endregion #region [ Constructors ] /// /// Constructs a new . /// public ExportDestination() { } /// /// Constructs a new given the specified parameters. /// /// Path and file name of export destination. /// Determines whether or not to attempt network connection to share specified in . /// Domain used to authenticate network connection if is true. /// User name used to authenticate network connection if is true. /// Password used to authenticate network connection if is true. public ExportDestination(string destinationFile, bool connectToShare, string domain = "", string userName = "", string password = "") { m_destinationFile = destinationFile; m_connectToShare = connectToShare; m_domain = domain; m_userName = userName; m_password = password; } #endregion #region [ Properties ] /// /// Path and file name of export destination. /// [Editor(typeof(FileNameEditor), typeof(UITypeEditor))] public string DestinationFile { get { return m_destinationFile; } set { m_destinationFile = value; } } /// /// Determines whether or not to attempt network connection to share specified in . /// /// /// This option is ignored under Mono deployments. /// public bool ConnectToShare { get { return m_connectToShare; } set { m_connectToShare = value; } } /// /// Domain used to authenticate network connection if is true. /// /// /// This option is ignored under Mono deployments. /// public string Domain { get { return m_domain; } set { m_domain = value; } } /// /// User name used to authenticate network connection if is true. /// /// /// This option is ignored under Mono deployments. /// public string UserName { get { return m_userName; } set { m_userName = value; } } /// /// Password used to authenticate network connection if is true. /// /// /// This option is ignored under Mono deployments. /// public string Password { get { return m_password; } set { m_password = value; } } /// /// Path root of (e.g., E:\ or \\server\share). /// [Browsable(false)] public string Share { get { return Path.GetPathRoot(m_destinationFile); } } /// /// Path and filename of without drive or server share prefix. /// [Browsable(false)] public string FileName { get { return m_destinationFile.Substring(Share.Length); } } #endregion #region [ Methods ] /// /// Returns a that represents the current . /// /// A that represents the current . public override string ToString() { return m_destinationFile; } #endregion } }