Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- BackgroundWorker1.RunWorkerAsync()
- End Sub
- Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
- For Each foundFile As String In My.Computer.FileSystem.GetFiles(
- "..\scriptfiles",
- FileIO.SearchOption.SearchTopLevelOnly, "*.ini")
- Dim filename As String
- filename = foundFile.Replace("..\scriptfiles\", "")
- Dim filecontent As String
- filecontent = My.Computer.FileSystem.ReadAllText(foundFile)
- If (filecontent.Contains("Nivel=") Or filecontent.Length = 0) Then
- ListBox1.Items.Add(filename & " - REMOVIDO")
- My.Computer.FileSystem.DeleteFile(foundFile)
- End If
- Next
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Control.CheckForIllegalCrossThreadCalls = False
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- BackgroundWorker2.RunWorkerAsync()
- End Sub
- Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
- For Each foundFile As String In My.Computer.FileSystem.GetFiles(
- "\server\scriptfiles",
- FileIO.SearchOption.SearchTopLevelOnly, "*.ini")
- Dim filename As String
- filename = foundFile.Replace("\server\scriptfiles\", "")
- Dim filecontent As String
- filecontent = My.Computer.FileSystem.ReadAllText(foundFile)
- If (filecontent.Contains("Nivel=")) Then
- ListBox1.Items.Add(filename & " - ADD")
- My.Computer.FileSystem.CopyFile(foundFile, "..\scriptfiles\" & filename & ".ini")
- End If
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement