Advertisement
dassoubarna

Main Form

Apr 3rd, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.27 KB | None | 0 0
  1. Imports Ionic.Zip
  2. Public Class Main
  3.     Dim appPath As String = Application.StartupPath()
  4.     Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.         'SplashScreen.BarLong(100)
  6.         'Dim i As Integer = 0
  7.         'While i <= 100
  8.         'SplashScreen.ShowBar(i)
  9.         'i += 1
  10.         'Threading.Thread.Sleep(100)
  11.         'End While
  12.  
  13.         My.Computer.FileSystem.CopyFile(appPath & "\data\data.jwsdb", appPath & "\data\data.zip")
  14.         Dim ZipToUnpack As String = appPath & "\data\data.zip"
  15.         Dim UnpackDirectory As String = appPath & "\data\tmp\"
  16.         Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
  17.             Dim es As ZipEntry
  18.             For Each es In zip1
  19.                 es.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
  20.             Next
  21.         End Using
  22.         System.IO.File.Delete(appPath & "\data\data.zip")
  23.         IO.File.SetAttributes(appPath & "\data\tmp", IO.FileAttributes.Hidden)
  24.         ThumbnailGenerate1.Directorypath = appPath & "\data\tmp\"
  25.     End Sub
  26.  
  27.     Private Sub Export_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Export.Click
  28.         SaveFileDialog1.Filter = "JWS Files (*.jws*)|*.jws"
  29.         If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK _
  30.         Then
  31.             Using writer = New IO.StreamWriter(SaveFileDialog1.FileName)
  32.                 For Each cb As CheckBox In ThumbnailGenerate1.Controls.OfType(Of CheckBox)()
  33.                     If cb.Checked Then
  34.                         writer.WriteLine(cb.Text)
  35.                     End If
  36.                 Next
  37.             End Using
  38.         End If
  39.     End Sub
  40.     Private Sub ThumbnailGenerate1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThumbnailGenerate1.Load
  41.  
  42.     End Sub
  43.  
  44.     Private Sub Main_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  45.         ThumbnailGenerate1.Dispose()
  46.         System.IO.Directory.Delete(appPath & "\data\tmp", True)
  47.         Application.Exit()
  48.     End Sub
  49.  
  50.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  51.         ThumbnailGenerate1.Dispose()
  52.     End Sub
  53. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement