daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Declare Unicode Function StrCmpLogicalW Lib "shlwapi.dll" (ByVal s1 As String, ByVal s2 As String) As Int32
  2. Private Function CompareFiles(x As String, y As String) As Integer
  3.     Return StrCmpLogicalW(x, y)
  4. End Function
  5. For Each driver As DriveInfo In DriveInfo.GetDrives()
  6.         If driver.IsReady And driver.DriveType = DriveType.Removable Then
  7.  
  8.             Dim ext = {"*.zip"}
  9.  
  10.             Dim rootFiles() As String = ext.SelectMany(Function(f) Directory.GetFiles(driver.RootDirectory.ToString, f, SearchOption.TopDirectoryOnly)).OrderBy(Function(f) f).ToArray()
  11.             Array.Sort(rootFiles, New Comparison(Of String)(AddressOf CompareFiles))
  12.             'Next line gets System Volume Information
  13.             Dim otherFiles = ext.SelectMany(Function(f) Directory.GetFiles(driver.RootDirectory.ToString, f, SearchOption.AllDirectories)).OrderBy(Function(f) f).ToArray()
  14.             Array.Sort(otherFiles, New Comparison(Of String)(AddressOf CompareFiles))
  15.             ComBoxUsb.Items.Clear()
  16.  
  17.             For Each model In rootFiles.Union(otherFiles)
  18.                 ComBoxUsb.Items.Add(model)
  19.             Next
  20.         End If
  21.     Next
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top