1 '-----------------------------------------------------------------------
2 ' This file is part of the Microsoft .NET SDK Code Samples.
4 ' Copyright (C) Microsoft Corporation. All rights reserved.
6 'This source code is intended only as a supplement to Microsoft
7 'Development Tools and/or on-line documentation. See these other
8 'materials for detailed information regarding Microsoft code samples.
10 'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
11 'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12 'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
14 '-----------------------------------------------------------------------
17 Imports System
.Globalization
18 Imports System
.Security
.AccessControl
20 Namespace Microsoft
.Samples
.FileDemo
22 Friend Enum FileItemType
28 Friend Enum DefaultPropertiesView
34 Friend Enum FileRightShortCuts
35 Read
= FileSystemRights
.ListDirectory
Or FileSystemRights
.ReadAttributes
Or _
36 FileSystemRights
.ReadExtendedAttributes
Or FileSystemRights
.ReadPermissions
37 ReadAndExecute
= FileRightShortCuts
.Read
Or FileSystemRights
.Traverse
38 Write
= FileSystemRights
.WriteData
Or FileSystemRights
.AppendData
Or _
39 FileSystemRights
.WriteExtendedAttributes
Or _
40 FileSystemRights
.WriteAttributes
41 Modify
= FileRightShortCuts
.ReadAndExecute
Or FileRightShortCuts
.Write
Or _
42 FileSystemRights
.Delete
43 FullControl
= FileSystemRights
.FullControl
48 Public Enum DemoCategories
54 Public EnvironmentChanged
As Boolean
55 Public curDir
As String
56 Public NewName
As String
57 Public NewValue
As String
59 Public Function GetDriveType(ByVal d
As DriveInfo
, ByVal network
As Boolean) As String
61 Dim typeName
As String
63 Select Case d
.DriveType
64 Case DriveType
.Removable
69 typeName
= "Local Disk"
70 Case DriveType
.Network
72 typeName
= "Network Drive"
84 Public Function GetDriveIndex(ByVal d
As DriveInfo
) As Integer
86 Select Case d
.DriveType
87 Case DriveType
.Removable
93 Case DriveType
.Network
101 Public Function GetNameAndType(ByVal d
As DriveInfo
) As String
102 Return String.Format(CultureInfo
.CurrentCulture
, "{0} ({1})", GetDriveType(d
, False), d
.Name
.Substring(0, 2))