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 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 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 Private Sub Button_Pripravi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Pripravi.Click PripravaKartice() MessageBox.Show("Kartica pripravljena... Naloženo: - knjižnica z kodami TPS1100 - Nastavitve za instrument TPS110x - Formati za izvoz podatkov na GPS500 - Geoid SLOV2016.GEM za uporabo na GPS500") End Sub Private Sub Button_Zapri_Click(sender As Object, e As EventArgs) Handles Button_Zapri.Click Me.Close() 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 msgFormat = MsgBox("Formatiranje pogona [" + kartica + "]. Nadaljujem?", vbOKCancel, "Formatiranje kartice...") If msgFormat = DialogResult.OK Then Shell("cmd /c format " + kartica + " /FS:" + karticaTip + " /V:PCCARD /Q", AppWinStyle.NormalFocus) Else MsgBox("Postopek prekinjen.", vbOKOnly) 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 For Each d In allDrives If d.Name = ComboBox1.Text Then LabelSize.Text = Format(d.TotalSize / 1000 / 1000, "0").ToString + " MB" LabelPogonIme.Text = d.VolumeLabel.ToString LabelTip.Text = d.DriveFormat.ToString End If Next Button_Format.Enabled = True Button_Pripravi.Enabled = True End Sub End Class