//RShare
//Copyright (C) 2010 T.Norad

//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

using System;

namespace Regensburger.RShare
{
    public sealed class SharedDirectory
    {
        private string m_DirectoryPath;

        private bool m_IsDisconnected = false;

        public string DirectoryPath
        {
            get
            {
                return m_DirectoryPath;
            }
        }

        public bool IsDisconnected
        {
            get
            {
                return m_IsDisconnected;
            }
            set
            {
                m_IsDisconnected = value;
            }
        }


        public SharedDirectory(string directoryPath)
        {
            if (directoryPath == null)
                throw new ArgumentNullException("directoryPath");

            this.m_DirectoryPath = directoryPath;
        }

        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return false;
            }

            // If parameter cannot be cast to Point return false.
            SharedDirectory p = obj as SharedDirectory;
            if ((System.Object)p == null)
            {
                return false;
            }

            // Return true if the fields match:
            return p.DirectoryPath.Equals(m_DirectoryPath);
        }

        public bool Equals(SharedDirectory p)
        {
            // If parameter is null return false:
            if ((object)p == null)
            {
                return false;
            }

            // Return true if the fields match:
            return p.DirectoryPath.Equals(m_DirectoryPath);
        }

        public override int GetHashCode()
        {
            return this.m_DirectoryPath.GetHashCode();
        }
    }
}
