Files
Doku/Dokumentation/Classes/cFolder.vb

78 lines
2.6 KiB
VB.net

Public Class cFolder
Public Shared Function FolderMove(oldID As String, oldHost As String, newID As String, NewHost As String)
Dim PathOld As String
Dim PathNew As String
PathOld = Class1.FilePath & "\" & oldID & "\" & oldHost
PathNew = Class1.FilePath & "\" & newID & "\" & NewHost
If IO.Directory.Exists(PathNew) Then
MsgBox("Zielordner existiert bereits! Abbruch.")
Return "Fehler"
End If
If IO.Directory.Exists(Class1.FilePath & "\" & newID) Then
Else
IO.Directory.CreateDirectory(Class1.FilePath & "\" & newID)
End If
If IO.Directory.Exists(PathOld) Then
IO.Directory.Move(PathOld, PathNew)
End If
End Function
Public Shared Function explorerstarten(ip As String, Optional ByVal smb As Boolean = False, Optional ByVal username As String = "", Optional ByVal password As String = "")
Dim Path, nwstandort, netname As String
Dim host As New cHost
If smb = False Then
host.gethost(ip)
If host.Linked = True Then
host.gethost(host.LinkedWith)
End If
Class1.ip2netname(host.IPAdresse, nwstandort, netname)
Path = Class1.FilePath & "\" & nwstandort & "_" & netname & "\" & host.HOST
If IO.Directory.Exists(Path) Then
Process.Start(Path)
Else
IO.Directory.CreateDirectory(Path)
Process.Start(Path)
End If
Else
Path = "\\" & ip
If Not username = "" Then
netuse(username, password, Path)
End If
Process.Start(Path)
End If
'MsgBox(path)
End Function
Public Shared Function netuse(ByVal user As String, ByVal password As String, ByVal path As String)
Dim _netuse As New System.Diagnostics.ProcessStartInfo()
_netuse.CreateNoWindow = True
_netuse.WindowStyle = ProcessWindowStyle.Hidden
_netuse.FileName = "C:\Windows\system32\net"
_netuse.Arguments = " use " & path & " /User:" & user & " " & password
System.Diagnostics.Process.Start(_netuse)
End Function
Public Shared Function netdelete(ByVal path As String)
Dim _netuse As New System.Diagnostics.ProcessStartInfo()
_netuse.CreateNoWindow = True
_netuse.WindowStyle = ProcessWindowStyle.Hidden
_netuse.FileName = "C:\Windows\system32\net"
_netuse.Arguments = " use " & path & " /delete"
System.Diagnostics.Process.Start(_netuse)
End Function
End Class