Advertisement
qiangqiang101

cabinet

Nov 2nd, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. Private Sub Cabinet(DLL As String, Offset As Long, Value As Byte())
  2. Try
  3. Dim fs As New FileStream(DLL, FileMode.Open)
  4. Dim reader As New BinaryReader(fs)
  5. fs.Position = Offset
  6. For Each num As Byte In Value
  7. If num.ToString() = String.Empty Then
  8. Exit For
  9. End If
  10. reader.BaseStream.WriteByte(num)
  11. Next
  12. reader.Close()
  13. Catch exception1 As Exception
  14. ProjectData.SetProjectError(exception1)
  15. ProjectData.ClearProjectError()
  16. End Try
  17. End Sub
  18.  
  19.  
  20.  
  21. If (Me.CabinetSel.SelectedIndex = 0) Then
  22. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H0"))), New Byte() { 130, &H79, &H59, 9 })
  23. Dim buffer1 As Byte() = New Byte() { 1 }
  24. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H2B"))), buffer1)
  25. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H74"))), New Byte() { 130, &H79, &H59, 9 })
  26. Dim buffer2 As Byte() = New Byte() { 1 }
  27. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H9F"))), buffer2)
  28. Else
  29. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H0"))), New Byte() { &HD1, &H9B, &H7C, &HCA })
  30. Dim buffer3 As Byte() = New Byte() { 2 }
  31. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H2B"))), buffer3)
  32. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H74"))), New Byte() { &HD1, &H9B, &H7C, &HCA })
  33. Dim buffer4 As Byte() = New Byte() { 2 }
  34. Me.Cabinet((Environment.GetFolderPath(SpecialFolder.ApplicationData) & "\TeknoParrot\SBUU_e2prom.bin"), CLng(Math.Round(Conversion.Val("&H9F"))), buffer4)
  35. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement