Files
egtbeamwall/EgtBEAMWALL.Core/Utility/MyMachine.vb
T
2025-09-22 14:28:45 +02:00

49 lines
1.7 KiB
VB.net

Imports System.IO
Imports EgtWPFLib5
Public Class MyMachine
Inherits Machine
Private m_nType As MachineType
Public ReadOnly Property nType As MachineType
Get
Return m_nType
End Get
End Property
Sub New(sDirPath As String, sIniPath As String)
MyBase.New(sDirPath, sIniPath)
' verifico esistenza cartella Beam e Wall per assegnare tipo
If Directory.Exists(sDirPath & "/Beam") AndAlso Directory.Exists(sDirPath & "/Wall") Then
m_nType = MachineType.BOTH
ElseIf Directory.Exists(sDirPath & "/Beam") Then
m_nType = MachineType.BEAM
ElseIf Directory.Exists(sDirPath & "/Wall") Then
m_nType = MachineType.WALL
Else
m_nType = MachineType.NULL
End If
End Sub
Public Shared Shadows Function MachineListInit(sMachinesRootDir As String, MachineList As IList(Of Machine)) As Boolean
' Se direttorio base macchine non definito o non esiste, ritorno
If String.IsNullOrWhiteSpace(sMachinesRootDir) OrElse
Not Directory.Exists(sMachinesRootDir) Then
MachineList = Nothing
Return False
End If
' Cerco le macchine
Dim Machines As String() = Directory.GetDirectories(sMachinesRootDir)
For i As Integer = 0 To Machines.Count - 1
Dim PathIni As String = Machines(i) & "\" & Path.GetFileName(Machines(i)) & ".ini"
Dim PathBeam As String = Machines(i) & "\" & "Beam"
Dim PathWall As String = Machines(i) & "\" & "Wall"
If File.Exists(PathIni) AndAlso (Directory.Exists(PathBeam) OrElse Directory.Exists(PathWall)) Then
MachineList.Add(New MyMachine(Machines(i), PathIni))
End If
Next
Return True
End Function
End Class