Index: Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Laser Gravering.vbproj =================================================================== diff -u -r1933 -r1934 --- Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Laser Gravering.vbproj (.../Laser Gravering.vbproj) (revision 1933) +++ Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Laser Gravering.vbproj (.../Laser Gravering.vbproj) (revision 1934) @@ -27,8 +27,8 @@ false false true - 2 - 1.7.0.%2a + 1 + 1.8.0.%2a false true true Index: Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsTextMapper.vb =================================================================== diff -u -r1922 -r1934 --- Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsTextMapper.vb (.../ConfigsTextMapper.vb) (revision 1922) +++ Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsTextMapper.vb (.../ConfigsTextMapper.vb) (revision 1934) @@ -1,22 +1,17 @@ 'Robin De Bock Created:27/07/2018 Changed:02/08/2018 Imports System.IO -public interface IConfigsTextMapper - Function GetAllValues() As List(Of String) - Sub ConfigsOpslaan(configs As IConfigsClass) -end interface +Public Interface IConfigsTextMapper + Function GetAllValues(path As String) As List(Of String) + Sub ConfigsOpslaan(path As String, configs As IConfigsClass) +End Interface -class ConfigsTextMapper +Class ConfigsTextMapper Implements IConfigsTextMapper Const Filename As String = "Configs.txt" 'TODO vervangen door parameter in functie - Private Shared Function GetPathConfigs() As String - Return My.Settings.PadNaarSettingsBestand - End Function - - Public Function GetAllValues() As List(Of String) Implements IConfigsTextMapper.GetAllValues + Public Function GetAllValues(path As String) As List(Of String) Implements IConfigsTextMapper.GetAllValues Try - Dim path As String = GetPathConfigs() If System.IO.File.Exists(path) Then 'Bestaat bestand? Dim fileReader As String = My.Computer.FileSystem.ReadAllText(path) fileReader = fileReader.Trim @@ -25,21 +20,20 @@ Return lijnen.Where(Function(lijn) Not (lijn = String.Empty Or lijn.StartsWith("%"))).ToList() Else 'Bestand bestaat niet - Throw New Exception($"{Filename} bestaat niet.") + Throw New Exception($"'{path}'{vbNewLine} bestaat niet.") End If Catch ex As ReadOnlyException - Throw New Exception($"{Filename} bestand is readonly") + Throw New Exception($"'{path}'{vbNewLine}bestand is readonly") Catch ex As PathTooLongException - Throw New Exception($"{Filename} pad is te lang") + Throw New Exception($"'{path}'{vbNewLine}pad is te lang") Catch ex As IOException - Throw New Exception($"{Filename} is niet bereikbaar") + Throw New Exception($"'{path}'{vbNewLine}is niet bereikbaar") Catch ex As Exception - Throw New Exception($"{Filename} bestand kon niet worden gelezen {vbNewLine}{ex.Message}") + Throw New Exception($"'{path}'{vbNewLine}bestand kon niet worden gelezen {vbNewLine}{ex.Message}") End Try End Function - Public Sub ConfigsOpslaan(configs As IConfigsClass) Implements IConfigsTextMapper.ConfigsOpslaan - Dim path As String = GetPathConfigs() + Public Sub ConfigsOpslaan(path As String, configs As IConfigsClass) Implements IConfigsTextMapper.ConfigsOpslaan Dim file As System.IO.StreamWriter System.IO.File.WriteAllText(path, "") 'Leegmaken file = My.Computer.FileSystem.OpenTextFileWriter(path, True) @@ -62,4 +56,4 @@ file.Close() End Sub -End class +End Class Index: Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsClass.vb =================================================================== diff -u -r1922 -r1934 --- Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsClass.vb (.../ConfigsClass.vb) (revision 1922) +++ Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Configs/ConfigsClass.vb (.../ConfigsClass.vb) (revision 1934) @@ -25,8 +25,8 @@ Public Sub InitInstellingen(padNaarHoofdconfigBestand As String) Implements IConfigsClass.InitInstellingen 'Geen init nodig als deze al is geweest - If _configLookup.Count > 0 then return - + If _configLookup.Count > 0 Then Return + 'Controle of hoofdconfig bestand wel bestaat If String.IsNullOrEmpty(padNaarHoofdconfigBestand) OrElse Not File.Exists(padNaarHoofdconfigBestand) Then Throw New MissingBaseConfigFileException() @@ -47,7 +47,7 @@ Private Sub LaadConfigs() 'Hash vullen met configs - For Each lijn In _configsTextMapper.GetAllValues() + For Each lijn In _configsTextMapper.GetAllValues(My.Settings.PadNaarSettingsBestand) Dim result = Regex.Match(lijn, "^(\w+) (.+)$", RegexOptions.IgnoreCase) 'Controle op aantal groups If result.Groups.Count <> 3 Then Throw New Exception($"Ongeldige config: '{lijn}'") @@ -67,7 +67,7 @@ End Sub Public Sub OpslaanConfigs() Implements IConfigsClass.OpslaanConfigs - _configsTextMapper.ConfigsOpslaan(Me) + _configsTextMapper.ConfigsOpslaan(My.Settings.PadNaarSettingsBestand, Me) End Sub ''' Index: Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Formulieren/FormHoofdscherm.Designer.vb =================================================================== diff -u -r1930 -r1934 --- Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Formulieren/FormHoofdscherm.Designer.vb (.../FormHoofdscherm.Designer.vb) (revision 1930) +++ Laser Gravering/nieuw/Laser Gravering_nieuw/Laser Gravering/Formulieren/FormHoofdscherm.Designer.vb (.../FormHoofdscherm.Designer.vb) (revision 1934) @@ -69,9 +69,9 @@ Me.FlowLayoutPanelSchermen.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) - Me.FlowLayoutPanelSchermen.Location = New System.Drawing.Point(0, 75) + Me.FlowLayoutPanelSchermen.Location = New System.Drawing.Point(12, 75) Me.FlowLayoutPanelSchermen.Name = "FlowLayoutPanelSchermen" - Me.FlowLayoutPanelSchermen.Size = New System.Drawing.Size(1684, 786) + Me.FlowLayoutPanelSchermen.Size = New System.Drawing.Size(1660, 775) Me.FlowLayoutPanelSchermen.TabIndex = 72 ' 'FileSystemWatcher1 @@ -82,9 +82,10 @@ 'CheckBoxVisualiseer ' Me.CheckBoxVisualiseer.AutoSize = true - Me.CheckBoxVisualiseer.Location = New System.Drawing.Point(0, 52) + Me.CheckBoxVisualiseer.Font = New System.Drawing.Font("Microsoft Sans Serif", 11!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.CheckBoxVisualiseer.Location = New System.Drawing.Point(12, 52) Me.CheckBoxVisualiseer.Name = "CheckBoxVisualiseer" - Me.CheckBoxVisualiseer.Size = New System.Drawing.Size(76, 17) + Me.CheckBoxVisualiseer.Size = New System.Drawing.Size(109, 22) Me.CheckBoxVisualiseer.TabIndex = 73 Me.CheckBoxVisualiseer.Text = "Visualiseer" Me.CheckBoxVisualiseer.UseVisualStyleBackColor = true