Advertisement
nandoy

fuck yea

Nov 22nd, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.         BackgroundWorker1.RunWorkerAsync()
  5.     End Sub
  6.  
  7.     Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  8.         For Each foundFile As String In My.Computer.FileSystem.GetFiles(
  9.             "..\scriptfiles",
  10.          FileIO.SearchOption.SearchTopLevelOnly, "*.ini")
  11.             Dim filename As String
  12.             filename = foundFile.Replace("..\scriptfiles\", "")
  13.             Dim filecontent As String
  14.             filecontent = My.Computer.FileSystem.ReadAllText(foundFile)
  15.             If (filecontent.Contains("Nivel=") Or filecontent.Length = 0) Then
  16.                 ListBox1.Items.Add(filename & " - REMOVIDO")
  17.                 My.Computer.FileSystem.DeleteFile(foundFile)
  18.             End If
  19.  
  20.         Next
  21.     End Sub
  22.  
  23.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  24.         Control.CheckForIllegalCrossThreadCalls = False
  25.     End Sub
  26.  
  27.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  28.         BackgroundWorker2.RunWorkerAsync()
  29.     End Sub
  30.  
  31.     Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
  32.         For Each foundFile As String In My.Computer.FileSystem.GetFiles(
  33.             "\server\scriptfiles",
  34.          FileIO.SearchOption.SearchTopLevelOnly, "*.ini")
  35.             Dim filename As String
  36.             filename = foundFile.Replace("\server\scriptfiles\", "")
  37.             Dim filecontent As String
  38.             filecontent = My.Computer.FileSystem.ReadAllText(foundFile)
  39.             If (filecontent.Contains("Nivel=")) Then
  40.                 ListBox1.Items.Add(filename & " - ADD")
  41.                 My.Computer.FileSystem.CopyFile(foundFile, "..\scriptfiles\" & filename & ".ini")
  42.             End If
  43.  
  44.         Next
  45.     End Sub
  46. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement