Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

File System Watcher - All Drives

😅 Title

[Image: 2740a36aeddd78704f6bae1d3d0ecc70.png]

😉
(Mar 15, 2015 04:08 PM)SIM-1984933 Wrote:  im talking about the way he did it :~

u should read the title and the code again 😊
(Mar 15, 2015 03:24 PM)SIM-1984933 Wrote:  FileWatchDog Project Source https://hackforums.net/showthread.php?tid=4732349
(Mar 15, 2015 05:56 PM)SIM-1984933 Wrote:  well ill just leave this here https://hackforums.net/showthread.php?tid=4732349

🤣 again wow did u decide to speard it all over the net section
(Mar 15, 2015 06:41 PM)sweetysuckscock Wrote:  Lol you never even renamed the variables i used.....

https://hackforums.net/showthread.php?ti...id45221164

...

why i should i post the right way of doing it 😊 what u want credit for the vars name 🤦‍♂
(Mar 15, 2015 06:55 PM)sweetysuckscock Wrote:  dude you took the code improved it a little and gave no credits you sir are a skid...

w/e just letting everyone else know what your like is all, least i never HAD to copy a? :D ...

let me help u 🤣 ur code is buggy and will not work did u even test it 😏

Code
Imports System.IO

Public Class Form1

    Dim Watchers() As FileSystemWatcher

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      GetDrives()
    End Sub

    Private Sub GetDrives()
      Dim Count As Integer = 0
      Dim drives() As String = Environment.GetLogicalDrives
      ReDim Watchers(drives.Length)
      For i = 0 To drives.Length - 1
      Dim watcher As New FileSystemWatcher(drives(i))
      With watcher
      .Path = drives(i)
      AddHandler .Changed, AddressOf FileSysWatcher_Changed
      AddHandler .Created, AddressOf FileSysWatcher_Created
      AddHandler .Deleted, AddressOf FileSysWatcher_Deleted
      AddHandler .Disposed, AddressOf FileSysWatcher_Disposed
      AddHandler .Error, AddressOf FileSysWatcher_Error
      AddHandler .Renamed, AddressOf FileSysWatcher_Renamed
      End With
      Watchers(i) = watcher
      watcher.IncludeSubdirectories = True
      watcher.EnableRaisingEvents = True
      Next
      TextBox1.AppendText("added all locical drives")
    End Sub

    Private Sub FileSysWatcher_Changed(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
      Debug.Print("Name: {0}, Path: {1}", e.Name, e.FullPath)
      TextBox1.Invoke(New MethodInvoker(Sub() TextBox1.AppendText(vbNewLine & String.Format("Name: {0}, Path: {1}", e.Name, e.FullPath))))
    End Sub

    Private Sub FileSysWatcher_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
      Debug.Print("Name: {0}, Path: {1}", e.Name, e.FullPath)
      TextBox1.Invoke(New MethodInvoker(Sub() TextBox1.AppendText(vbNewLine & String.Format("Name: {0}, Path: {1}", e.Name, e.FullPath))))
    End Sub

    Private Sub FileSysWatcher_Deleted(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
      Debug.Print("Name: {0}, Path: {1}", e.Name, e.FullPath)
      TextBox1.Invoke(New MethodInvoker(Sub() TextBox1.AppendText(vbNewLine & String.Format("Name: {0}, Path: {1}", e.Name, e.FullPath))))
    End Sub

    Private Sub FileSysWatcher_Disposed(ByVal sender As Object, ByVal e As System.EventArgs)
      Debug.Print(e.ToString)
    End Sub

    Private Sub FileSysWatcher_Error(ByVal sender As Object, ByVal e As System.IO.ErrorEventArgs)
      Debug.Print(e.GetException.Message)
    End Sub

    Private Sub FileSysWatcher_Renamed(ByVal sender As Object, ByVal e As System.IO.RenamedEventArgs)
      Debug.Print("Name: {0}, Path: {1}", e.Name, e.FullPath)
      TextBox1.Invoke(New MethodInvoker(Sub() TextBox1.AppendText(vbNewLine & String.Format("Name: {0}, Path: {1}", e.Name, e.FullPath))))
    End Sub

End Class
really then u blind again ur code not even work 🤦‍♂
i didnt hide anything and with the other threads about it anyone can see that i just post how to do it
anyway i can add credit for the vars if this ur problem 😏
i saw the thread about it (few days ago) and saw ur reply with the others replys
the guy made another thread then i decide to write the way i think is the best of doing it
when i post it as reply not many will see it thats why i make thread


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by WeedIsInTheAirSep 23, 2022 03:42 PM 0 173 Sep 23, 2022 03:42 PM
Last Post: WeedIsInTheAir
[Shell] by Emre_Oct 1, 2020 07:14 PM 0 129 Oct 1, 2020 07:14 PM
Last Post: Emre_
[Shell] by Emre_Aug 31, 2019 05:10 AM 0 100 Aug 31, 2019 05:10 AM
Last Post: Emre_