Option Explicit On
Option Strict On
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Globalization
Imports System.Management
Namespace Edanmo.IO
Public NotInheritable Class NetShare
Implements IDisposable
Private _share As ManagementObject
Private Sub New(ByVal share As ManagementObject)
_share = share
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets the share access rights for the current user or group.
''' </summary>
''' <history>
''' [Eduardo Morcillo] 11/08/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property AccessMask() As AccessMasks
Get
Return CType(Convert.ToInt32(_share.InvokeMethod("GetAccessMask", Nothing), CultureInfo.InvariantCulture), AccessMasks)
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets or sets the maximum number of user connections.
''' </summary>
''' <history>
''' [Eduardo Morcillo] 11/08/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property AllowMaximum() As Integer
Get
Return Convert.ToInt32(_share.GetPropertyValue("AllowMaximum"), CultureInfo.InvariantCulture)
End Get
Set(ByVal value As Integer)
Me.SetShareInfo(value, Me.Description, Nothing)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets the share description.
''' </summary>
''' <history>
''' [Eduardo Morcillo] 11/08/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property Description() As String
Get
Return _share.GetPropertyValue("Description").ToString
End Get
Set(ByVal value As String)
Me.SetShareInfo(Me.MaximumAllowed, value, Nothing)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets
''' </summary>
''' <history>
''' [Eduardo Morcillo] 11/08/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property MaximumAllowed() As Integer
Get
Return Convert.ToInt32(_share.GetPropertyValue("MaximumAllowed"), CultureInfo.InvariantCulture)
End Get
Set(ByVal value As Integer)
Me.SetShareInfo(value, Me.Description, Nothing)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets the share name.
''' </summary>
''' <history>
''' [Eduardo Morcillo] 11/08/2004 Created
''' </history>
''' --------------------------------------------------------