Imports System.IO Imports System.Windows.Forms 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 If drive.DriveType = IO.DriveType.Removable And drive.IsReady = True Then '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() ' Pripravi datoteke in poti za kopiranje 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 fileUvozGeoid1 = delovnaMapa + "\Virtualna Kartica\DATA\GPS\GEOID\SLO1.GEM" Dim fileIzvozGeoid1 = karticaMapa + "DATA\GPS\GEOID\SLO1.GEM" Dim fileUvozGeoid2 = delovnaMapa + "\Virtualna Kartica\DATA\GPS\GEOID\SLOG2000.GEM" Dim fileIzvozGeoid2 = karticaMapa + "DATA\GPS\GEOID\SLOG2000.GEM" Dim fileUvozGeoid3 = delovnaMapa + "\Virtualna Kartica\DATA\GPS\GEOID\SLOV2016.GEM" Dim fileIzvozGeoid3 = 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(fileUvozGeoid1) Then My.Computer.FileSystem.CopyFile(fileUvozGeoid1, fileIzvozGeoid1, True) End If If My.Computer.FileSystem.FileExists(fileUvozGeoid2) Then My.Computer.FileSystem.CopyFile(fileUvozGeoid2, fileIzvozGeoid2, True) End If If My.Computer.FileSystem.FileExists(fileUvozGeoid3) Then My.Computer.FileSystem.CopyFile(fileUvozGeoid3, fileIzvozGeoid3, 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 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 End Sub Private Sub Button_Pripravi_Click(ByVal sender As Object, e As EventArgs) Handles Button_Pripravi.Click Dim karticaMapa As String = ComboBox1.Text Dim kartica As String = ComboBox1.Text.Replace("\", "") Dim karticaTip As String = LabelTip.Text Dim karticaLabel As String = TextBoxPogonIme.Text Dim msgPriprava = MsgBox("Priprava pogona: " + kartica + " [" + karticaLabel + "]" + vbCrLf + vbCrLf + "Na kartico bodo naloženi podatki za TPS110x in GPS500." + vbCrLf + "Nadaljujem?", vbYesNo + vbExclamation, "Formatiranje kartice...") If msgPriprava = DialogResult.Yes Then ' Zaženi pripravo kartice PripravaKartice() ' Priprava končana... Dim msgPripravaOk = MsgBox("Kartica pripravljena... podatki naloženi." + vbCrLf + vbCrLf + "- CODE: Kode za TPS1100" + vbCrLf + "- CONVERT: Formati izvoza podatkov za GPS500" + vbCrLf + "- DATA/GPS/GEOID: Geoidi za GPS500" + vbCrLf + "- TPS/CONF: Nastavitve za TPS110x" + vbCrLf + vbCrLf + "Odprem mapo kartice?", vbYesNo + vbInformation, "Priprava Kartice") If msgPripravaOk = DialogResult.Yes Then Process.Start(karticaMapa) End If End If Dim allDrives() As DriveInfo = DriveInfo.GetDrives() Dim d As DriveInfo Dim totalSize Dim availSize Dim usedSize 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 End Sub 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 Dim karticaLabel As String = TextBoxPogonIme.Text Dim msgFormat = MsgBox("Formatiranje pogona: " + kartica + " [" + karticaLabel + "]" + vbCrLf + "Vsi podatki na pogonu bodo izbrisani!" + vbCrLf + "Nadaljujem?", vbYesNo + vbExclamation, "Formatiranje kartice...") If msgFormat = DialogResult.Yes Then Shell("cmd /c format " + kartica + " /fs:" + karticaTip + " /v:" + karticaLabel + " /q", AppWinStyle.NormalFocus) ProgressBar1.Value = 0 Else MsgBox("Postopek prekinjen.", vbOKOnly + vbInformation) End If End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged Dim allDrives() As DriveInfo = DriveInfo.GetDrives() Dim d As DriveInfo Dim totalSize Dim availSize Dim usedSize 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 Button_Format.Enabled = True Button_Pripravi.Enabled = True End Sub Private Sub Button_Zapri_Click(sender As Object, e As EventArgs) Handles Button_Zapri.Click Me.Close() End Sub End Class