Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     'File the Text File with the Name from the File List
  2.    txtFileName.Text = File1.FileName
  3.     'Port the Text from the Textbox to a String Variable, so we can access the File
  4.    strHeaderFile = txtFileName.Text
  5.  
  6.     'Cut the Extension into another String Variable
  7.    NAMECUT = txtFileName.Text
  8.     EXPORTNAME = Left(NAMECUT, InStrRev(txtFileName.Text, ".") - 1)
  9.    
  10.     'Generate Name for the .BIN File
  11.    strSampleFile = EXPORTNAME & ".bin"
  12.    
  13.     'Open our Previous generated "Names"
  14.    Open strHeaderFile For Binary As #1
  15.     Open strSampleFile For Binary As #2
  16.    
  17.         'Get some Variables
  18.        'We want to check here if we have valid Files
  19.        Get #1, 1, strCheck
  20.         Get #1, 9, FileLength
  21.  
  22.         'Check Header Magic "SM4L"
  23.        If strCheck = "SM4L" Then
  24.             cmdSPLIT.Enabled = True
  25.         Else
  26.             cmdSPLIT.Enabled = False
  27.             lblINFO.Caption = "Header Magic Check Failed!!!"
  28.             Close #1, #2
  29.             Exit Sub
  30.         End If
  31.        
  32.         'Check Size given in Header
  33.        If FileLength * 2048 <> FileLen(strSampleFile) Then
  34.             cmdSPLIT.Enabled = False
  35.             lblINFO.Caption = "Size Check Failed!!!"
  36.             Close #1, #2
  37.             Exit Sub
  38.         Else
  39.             cmdSPLIT.Enabled = True
  40.         End If
  41.        
  42.         'After we passed the 2 Checks we will read the Filecount
  43.        Get #1, 5, IncludedFiles
  44.         lblINFO.Caption = "Included Files: " & IncludedFiles
  45.        
  46.        
  47.         'Close Files
  48.        Close #1, #2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement