Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
klasor.SelectedPath = My.Computer.FileSystem.CurrentDirectory
ListView1.GridLines = True
ListView1.FullRowSelect = True
ListView1.LabelEdit = True
ListView1.AllowColumnReorder = True
ListView1.BackgroundImageTiled = True
ListView1.MultiSelect = False
End Sub
Private Sub btKlasor_Click(sender As Object, e As EventArgs) Handles btKlasor.Click
klasor.Description = "Lütfen Bir Klasör Seçiniz."
If klasor.ShowDialog = DialogResult.OK Then
seciliklasor = klasor.SelectedPath
'Kısa yol eklentisi yaparken, aynı yolun tekrar eklenmemesi için kontrol yapılıyor
For x = 0 To ComboBox1.Items.Count - 1
If ComboBox1.Items(x) = seciliklasor Then
ComboBox1.SelectedIndex = ComboBox1.FindString(seciliklasor)
GoTo git
End If
Next
ComboBox1.Items.Add(klasor.SelectedPath)
git:
ComboBox1.Text = ""
ComboBox1.Text = klasor.SelectedPath
listele()
End If
End Sub
Private Sub listele()
Dim dirInfo As DirectoryInfo
ListView1.Items.Clear()
ListView2.Items.Clear()
klasor.SelectedPath = ComboBox1.Text & "\"
dirInfo = New DirectoryInfo(klasor.SelectedPath)
Arama_Bar(dirInfo)
Label4.Text = "Dosya Sayısı :" & ListView1.Items.Count
Label3.Text = "Bulunan :0"
End Sub
Public Function GetMediaDuration(ByVal MediaFile As String)
Try
Dim w As New WMPLib.WindowsMediaPlayer
Dim m As WMPLib.IWMPMedia = w.newMedia(MediaFile)
w.close()
Return m.duration
Catch ex As Exception
Return 0
End Try
End Function
Private Sub Arama_Bar(dirInfo As DirectoryInfo)
Dim uzantiList As New List(Of String)
uzantiList.Add("*.mp4")
uzantiList.Add("*.mkv")
uzantiList.Add("*.ts")
uzantiList.Add("*.mp3")
uzantiList.Add("*.avi")
uzantiList.Add("*.wmv")
uzantiList.Add("*.3gp")
uzantiList.Add("*.wav")
uzantiList.Add("*.mpa")
uzantiList.Add("*.mpg")
uzantiList.Add("*.mov")
uzantiList.Add("*.m4a")
uzantiList.Add("*.asf")
uzantiList.Add("*.vob")
Dim fileInfo As FileInfo
Dim exePath As String
Dim exeIcon As Icon
Dim ListViewItem As ListViewItem
For Each uzanti In uzantiList
For Each fileInfo In dirInfo.GetFiles(uzanti)
If fileInfo.Extension = String.Empty Then
Else
exePath = fileInfo.FullName
exeIcon = Drawing.Icon.ExtractAssociatedIcon(exePath)
If ımageList1.Images.ContainsKey(exePath) Then
Else
ımageList1.Images.Add(exePath, exeIcon)
End If
Dim olsTarihi As DateTime = fileInfo.CreationTime 'dirInfo.CreationT
Dim byteBoyut As Long = fileInfo.Length
Dim uzantiler As String = fileInfo.Extension
'Dim sure As New MediaInfoNET.MediaInfo_Stream_Video
''-----------------------------'Medya süre(duration) bilgisini alır
On Error Resume Next
Dim videoDuration As String = TimeSpan.FromSeconds(Math.Round(GetMediaDuration _
(ComboBox1.Text & "\" & fileInfo.Name))).ToString ' Format hh:mm:ss
''----------------------------------
byteBoyut = (byteBoyut / 1024) / 1000
ListView1.LargeImageList = ımageList1
ListViewItem = ListView1.Items.Add(fileInfo.Name)
ListViewItem.SubItems.Add(byteBoyut.ToString() & " MB ")
ListViewItem.SubItems.Add(olsTarihi.ToString("dd.MM.yyyy"))
ListViewItem.SubItems.Add(uzantiler.ToString)
ListViewItem.SubItems.Add(videoDuration) 'Medya süre(duration) bilgisini alır(hh:mm:ss)
'ListViewItem.SubItems.Add(sure.DurationString)
ListViewItem.ImageKey = exePath
End If
Next
Next
End Sub