dassoubarna

Main

Mar 7th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.97 KB | None | 0 0
  1. Imports Ionic.Zip
  2. Public Class Main
  3.     Dim PhotoshopApp As Photoshop.Application
  4.     Dim photoshopDoc As Photoshop.Document
  5.     Dim curLayer As Photoshop.ArtLayer
  6.     Dim psstring As String
  7.     Dim appPath As String = Application.StartupPath()
  8.  
  9.     Private Sub Browse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Browse.Click
  10.         Dim dlg As New FolderBrowserDialog
  11.         If dlg.ShowDialog = DialogResult.OK Then
  12.             ThumbnailGenerate1.Directorypath = dlg.SelectedPath
  13.             TextBox1.Text = dlg.SelectedPath
  14.         End If
  15.     End Sub
  16.     Private Sub Lock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lock.Click
  17.         If TextBox1.Text <> "" Then
  18.             If ThumbnailGenerate1.Controls.OfType(Of CheckBox)().Any(Function(cb) cb.Checked) Then
  19.  
  20.                 For Each cb1 As CheckBox In ThumbnailGenerate1.Controls.OfType(Of CheckBox)()
  21.                     If cb1.Checked Then
  22.                         My.Computer.FileSystem.CopyFile(TextBox1.Text & "\" & cb1.Text, appPath & "\tmp\" & cb1.Text, True)
  23.                     End If
  24.                 Next
  25.                 IO.File.SetAttributes(appPath & "\tmp", IO.FileAttributes.Hidden)
  26.                 LockFrm.ShowDialog()
  27.             Else
  28.                 MsgBox("No files selected!")
  29.             End If
  30.         Else
  31.             MsgBox("Please Select a folder first!")
  32.         End If
  33.  
  34.     End Sub
  35.  
  36.     Private Sub ThumbnailGenerate1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
  37.  
  38.     End Sub
  39.     Private Sub ThumbnailGenerate2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
  40.  
  41.     End Sub
  42.     Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  43.         If IO.Directory.Exists(appPath & "\tmp\") Then
  44.             System.IO.Directory.Delete(appPath & "\tmp\", True)
  45.         End If
  46.         SplashScreen.BarLong(100)
  47.         Dim i As Integer = 0
  48.         While i <= 100
  49.             SplashScreen.ShowBar(i)
  50.             i += 1
  51.             Threading.Thread.Sleep(100)
  52.         End While
  53.  
  54.     End Sub
  55.  
  56.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  57.         If TextBox1.Text <> "" Then
  58.             PhotoshopApp = New Photoshop.ApplicationClass
  59.             PhotoshopApp.DisplayDialogs = Photoshop.PsDialogModes.psDisplayNoDialogs
  60.             PhotoshopApp.PlaybackDisplayDialogs = Photoshop.PsDialogModes.psDisplayNoDialogs
  61.             If TabControl1.SelectedTab Is Raw Then
  62.  
  63.                 For Each cb1 As CheckBox In ThumbnailGenerate1.Controls.OfType(Of CheckBox)()
  64.                     If cb1.Checked Then
  65.                         psstring = TextBox1.Text & "\" & cb1.Text
  66.                         photoshopDoc = PhotoshopApp.Open(psstring)
  67.                     End If
  68.                 Next
  69.            
  70.             ElseIf TabControl1.SelectedTab Is Selection Then
  71.  
  72.                 For Each cb2 As CheckBox In ThumbnailGenerate2.Controls.OfType(Of CheckBox)()
  73.                     If cb2.Checked Then
  74.                         psstring = TextBox1.Text & "\" & cb2.Text
  75.                         photoshopDoc = PhotoshopApp.Open(psstring)
  76.                     End If
  77.                 Next
  78.            
  79.             End If
  80.             Else
  81.                 MsgBox("Please Select a folder first!")
  82.             End If
  83.     End Sub
  84.     Public Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  85.         If TextBox1.Text <> "" Then
  86.             OpenFileDialog1.Filter = "JWS Files (*.jws*)|*.jws"
  87.             If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK _
  88.             Then
  89.                 Dim lines() As String = IO.File.ReadAllLines(OpenFileDialog1.FileName)
  90.                 For Each line As String In lines
  91.                     My.Computer.FileSystem.CopyFile("" & TextBox1.Text & "\" & line, "" & TextBox1.Text & "\selection\" & line, True)
  92.                 Next
  93.                 MsgBox("All File Successfully Copied to selection folder inside your image directory!")
  94.                 ThumbnailGenerate2.Directorypath = TextBox1.Text & "\selection\"
  95.                 TabControl1.SelectTab(Selection)
  96.             End If
  97.         Else
  98.             MsgBox("Please Select a folder first!")
  99.         End If
  100.     End Sub
  101.     Public Delegate Sub SetProgressBarDelegate(ByVal max As Integer)
  102.     Public Delegate Sub UpdateProgressBarDelegate(ByVal value As Integer)
  103.  
  104.     Public Sub BarLong(ByVal MemCount As Integer)
  105.         If Me.InvokeRequired Then
  106.             Me.Invoke(New SetProgressBarDelegate(AddressOf BarLong), MemCount)
  107.         Else
  108.             Me.ProgressBar1.Maximum = MemCount
  109.         End If
  110.     End Sub
  111.  
  112.     Public Sub ShowBar(ByVal SoFar As Integer)
  113.         If Me.InvokeRequired Then
  114.             Me.Invoke(New UpdateProgressBarDelegate(AddressOf ShowBar), SoFar)
  115.         Else
  116.             Me.ProgressBar1.Value = SoFar
  117.         End If
  118.     End Sub
  119. End Class
Add Comment
Please, Sign In to add comment