TPS1100-Convert/DialogPripravaKartice.vb

147 lines
5.8 KiB
VB.net
Raw Normal View History

2024-07-19 23:44:24 +02:00
Imports System.IO
Imports System.Windows.Forms
2024-07-17 22:30:32 +02:00
Public Class DialogPripravaKartice
Private Sub DialogPripravaKartice_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each drive In IO.DriveInfo.GetDrives
'get all removable and fixed drives
2024-07-19 23:44:24 +02:00
If drive.DriveType = IO.DriveType.Removable And drive.IsReady = True Then
2024-07-17 22:30:32 +02:00
'add all found drives into the combobox
ComboBox1.Items.Add(drive)
End If
Next
End Sub
' Funkcija za pripravo PC-kartice/delovne mape
Private Sub PripravaKartice()
2024-07-19 23:44:24 +02:00
' Pripravi datoteke in poti za kopiranje
2024-07-17 22:30:32 +02:00
Dim delovnaMapa = My.Application.Info.DirectoryPath.ToString
Dim karticaMapa = ComboBox1.Text
Dim fileUvozCode = delovnaMapa + "\Virtualna Kartica\CODE\TPS1100.crf"
Dim fileIzvozCode = karticaMapa + "CODE\TPS1100.crf"
Dim fileUvozGeoid = delovnaMapa + "\Virtualna Kartica\DATA\GPS\GEOID\SLOV2016.GEM"
Dim fileIzvozGeoid = karticaMapa + "DATA\GPS\GEOID\SLOV2016.GEM"
Dim fileUvozTps = delovnaMapa + "\Virtualna Kartica\TPS\CONF\1102_BB.PAR"
Dim fileIzvozTps = karticaMapa + "TPS\CONF\1102_BB.PAR"
Dim fileUvozGpsGsi = delovnaMapa + "\Virtualna Kartica\CONVERT\GPS-GSI.FRT"
Dim fileIzvozGpsGsi = karticaMapa + "CONVERT\GPS-GSI.FRT"
Dim fileUvozGpsKoo = delovnaMapa + "\Virtualna Kartica\CONVERT\GPS-KOO.FRT"
Dim fileIzvozGpsKoo = karticaMapa + "CONVERT\GPS-KOO.FRT"
Dim fileUvozGpsPor = delovnaMapa + "\Virtualna Kartica\CONVERT\POROCILO.FRT"
Dim fileIzvozGpsPor = karticaMapa + "CONVERT\POROCILO.FRT"
' Kopiraj datoteke na kartico
If My.Computer.FileSystem.FileExists(fileUvozCode) Then
My.Computer.FileSystem.CopyFile(fileUvozCode, fileIzvozCode, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGeoid) Then
My.Computer.FileSystem.CopyFile(fileUvozGeoid, fileIzvozGeoid, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozTps) Then
My.Computer.FileSystem.CopyFile(fileUvozTps, fileIzvozTps, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsGsi) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsGsi, fileIzvozGpsGsi, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsKoo) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsKoo, fileIzvozGpsKoo, True)
End If
If My.Computer.FileSystem.FileExists(fileUvozGpsPor) Then
My.Computer.FileSystem.CopyFile(fileUvozGpsPor, fileIzvozGpsPor, True)
End If
2024-07-19 23:44:24 +02:00
If My.Computer.FileSystem.DirectoryExists(karticaMapa + "GSI") = False Then
My.Computer.FileSystem.CreateDirectory(karticaMapa + "GSI")
End If
If My.Computer.FileSystem.DirectoryExists(karticaMapa + "LOG") = False Then
My.Computer.FileSystem.CreateDirectory(karticaMapa + "LOG")
End If
Process.Start(karticaMapa)
End Sub
2024-07-22 21:54:37 +02:00
Private Sub Button_Pripravi_Click(ByVal sender As Object, e As EventArgs) Handles Button_Pripravi.Click
2024-07-19 23:44:24 +02:00
PripravaKartice()
2024-07-22 21:54:37 +02:00
MsgBox("Kartica pripravljena...
2024-07-17 22:30:32 +02:00
Naloženo:
- knjižnica z kodami TPS1100
- Nastavitve za instrument TPS110x
- Formati za izvoz podatkov na GPS500
2024-07-22 21:54:37 +02:00
- Geoid SLOV2016.GEM za uporabo na GPS500", vbOKOnly, "Priprava Kartice")
2024-07-17 22:30:32 +02:00
2024-07-22 21:54:37 +02:00
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
Dim totalSize
Dim availSize
Dim usedSize
2024-07-17 22:30:32 +02:00
2024-07-22 21:54:37 +02:00
For Each d In allDrives
If d.Name = ComboBox1.Text Then
totalSize = Format(d.TotalSize / 1000 / 1000, "0")
availSize = Format(d.AvailableFreeSpace / 1000 / 1000, "0")
usedSize = totalSize - availSize
LabelSize.Text = totalSize.ToString + "/" + availSize.ToString + " MB"
TextBoxPogonIme.Text = d.VolumeLabel.ToString
LabelTip.Text = d.DriveFormat.ToString
ProgressBar1.Maximum = totalSize
ProgressBar1.Value = usedSize
End If
Next
2024-07-17 22:30:32 +02:00
End Sub
2024-07-19 23:44:24 +02:00
Private Sub Button_Format_Click(sender As Object, e As EventArgs) Handles Button_Format.Click
Dim kartica As String = ComboBox1.Text.Replace("\", "")
Dim karticaTip As String = LabelTip.Text
2024-07-22 21:54:37 +02:00
Dim kartivaLabel As String = TextBoxPogonIme.Text
Dim msgFormat = MsgBox("Formatiran bo pogona [" + kartica + "]. Nadaljujem?", vbOKCancel, "Formatiranje kartice...")
2024-07-19 23:44:24 +02:00
If msgFormat = DialogResult.OK Then
2024-07-22 21:54:37 +02:00
Shell("cmd /c format " + kartica + " /fs:" + karticaTip + " /v:" + kartivaLabel + " /q", AppWinStyle.NormalFocus)
ProgressBar1.Value = 0
2024-07-19 23:44:24 +02:00
Else
MsgBox("Postopek prekinjen.", vbOKOnly)
End If
2024-07-17 22:30:32 +02:00
End Sub
2024-07-19 23:44:24 +02:00
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
2024-07-22 21:54:37 +02:00
Dim totalSize
Dim availSize
Dim usedSize
2024-07-17 22:30:32 +02:00
2024-07-19 23:44:24 +02:00
For Each d In allDrives
If d.Name = ComboBox1.Text Then
2024-07-22 21:54:37 +02:00
totalSize = Format(d.TotalSize / 1000 / 1000, "0")
availSize = Format(d.AvailableFreeSpace / 1000 / 1000, "0")
usedSize = totalSize - availSize
LabelSize.Text = totalSize.ToString + "/" + availSize.ToString + " MB"
TextBoxPogonIme.Text = d.VolumeLabel.ToString
2024-07-19 23:44:24 +02:00
LabelTip.Text = d.DriveFormat.ToString
2024-07-22 21:54:37 +02:00
ProgressBar1.Maximum = totalSize
ProgressBar1.Value = usedSize
2024-07-19 23:44:24 +02:00
End If
Next
2024-07-17 22:30:32 +02:00
2024-07-19 23:44:24 +02:00
Button_Format.Enabled = True
Button_Pripravi.Enabled = True
End Sub
2024-07-22 21:54:37 +02:00
Private Sub Button_Zapri_Click(sender As Object, e As EventArgs) Handles Button_Zapri.Click
Me.Close()
End Sub
2024-07-17 22:30:32 +02:00
End Class