Public Class MyPath
    Public Function Current() As String
        Return My.Application.Info.DirectoryPath
    End Function
    Public Function Windows() As String
        Dim SYSTEMD As String = (System.Environment.GetFolderPath(Environment.SpecialFolder.System))
        Dim DI As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(SYSTEMD)
        Return DI.Parent.FullName
    End Function
    Public Function System32() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.System).ToString
    End Function
    Public Function Desktop() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    End Function
    Public Function DesktopPath() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
    End Function
    Public Function Mycomputer() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.MyComputer)
    End Function
    Public Function Mydocument() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
    End Function
    Public Function Programfiles() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
    End Function
    Public Function StartMenu() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)
    End Function
    Public Function StartUp() As String
        Return System.Environment.GetFolderPath(Environment.SpecialFolder.Startup)
    End Function

    Public Shared Function GetFileArray(ByVal p_path As String, Optional ByVal p_searchPatten As String = "*.*", Optional ByVal p_subdir As Boolean = False) As ArrayList

        Dim extensions() As String = p_searchPatten.Split(",")
        Dim FileArray As New ArrayList

        Dim Di As New System.IO.DirectoryInfo(p_path)

        For Each ext As String In extensions
            For Each Fi As System.IO.FileInfo In Di.GetFiles(ext, IIf(p_subdir = True, 1, 0))
                FileArray.Add(Fi)
            Next
            'FileArray.AddRange(Di.GetFiles(ext, IIf(p_subdir = True, 1, 0)))
        Next

        Return FileArray
    End Function

End Class