Invece qualche idea per il mio quesito..?Sto lavorando con rdc per gestire un db sqlite via rete locale,
Volevo chiedere, come posso inserite all'interno
Del sistema rdc, visto che e' sempre attivo in esecuzione, come se fosse un servizio, una verìfica di un file senza aggiungere un timer,
Cioe' dovrebbe verificare se esiste questo file nella cartella c:\tmp\file.zip , in tal caso poi tramite shell lo copio dove mi serve e lo cancello, e poi se qualche altra procedura ( non mia) copia nuovamente il file.zip nella cartella tmp, il " mio " rdc dovrebbe scatenare l'evento .
Qualche idea?.
P.s. per la parte amministrativa, come suggerito da @DonManfred sto utilizzando una procedura B4J Ui, che manda dei comandi al mio rdc, prendendo spunto dal grande amico e fratello @sfsameer detto Saif.
JRDC2 Interface - Remote Server Manager
Hello everyone :) *Thank you Erel for making this possible for us :) while we are working on the Skype & Twitch alternative project we had to modify the features of the JRDC2 a lot of times. and each time we did that we had to open the server, run CMD read the logs file, test the connections...www.b4x.com
Bella ideaInvece qualche idea per il mio quesito..?
Invece qualche idea per il mio quesito..?
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Dim cfw As CustomFileWatcher
End Sub
Sub AppStart (Args() As String)
cfw.Initialize("C:/syspc/dbcasse", Me, "CustomFileWatcherEvent") ' OK'
' questo mi da errore '
'' cfw.Initialize("C:/syspc/dbcasse,c:/pippo", Me, "CustomFileWatcherEvent")
StartMessageLoop
End Sub
Sub CustomFileWatcherEvent_CreationDetected(PathToWatch As String, Filename As String)
Log("New file/folder created: " & PathToWatch & "/" & Filename)
End Sub
Sub CustomFileWatcherEvent_ModificationDetected(PathToWatch As String, Filename As String)
Log("Modifica File : " & PathToWatch & "/" & Filename)
End Sub
Sub CustomFileWatcherEvent_DeletionDetected(PathToWatch As String, Filename As String)
Log("Cancellazione File : " & PathToWatch & "/" & Filename)
End Sub
#Event: CreationDetected(PathToWatch As String, Filename As String)
#Event: DeletionDetected(PathToWatch As String, Filename As String)
#Event: ModificationDetected(PathToWatch As String, Filename As String)
Sub Class_Globals
Private FWatcher As FileWatcher
Private mEventName As String
Private mCallbackModule As Object
Private mPathToWatch As String
End Sub
'Initialze the object
'Pass the path you want to watch, the module you want to be called, the event you want to be called
Public Sub Initialize(PathToWatch As Object, CallbackModule As Object, EventName As String)
mEventName = EventName
mCallbackModule = CallbackModule
mPathToWatch=PathToWatch
FWatcher.Initialize("fwEvent")
FWatcher.SetWatchList(Array As String(mPathToWatch))
FWatcher.StartWatching
End Sub
Public Sub FermaAvviaVerifica( FermaAvvia As Boolean)
If FermaAvvia=False Then FWatcher.StopWatching Else FWatcher.StartWatching
End Sub
Public Sub PathControllo(mPath As Object)
mPathToWatch=mPath
FWatcher.StopWatching
FWatcher.SetWatchList(Array As String(mPathToWatch))
FWatcher.StartWatching
End Sub
Private Sub fwEvent_CreationDetected(FileName As String)
CallSub3(mCallbackModule, mEventName & "_CreationDetected", mPathToWatch, FileName)
Log("classe Creazione file")
End Sub
Private Sub fwEvent_DeletionDetected(FileName As String)
CallSub3(mCallbackModule, mEventName & "_DeletionDetected", mPathToWatch, FileName)
Log("classe Cancella file")
End Sub
Private Sub fwEvent_ModificationDetected(FileName As String)
CallSub3(mCallbackModule, mEventName & "_ModificationDetected", mPathToWatch, FileName)
Log("classe Modifica file")
End Sub
Poi ci passi i sorgenti.grazie al suggerimento di @LucaMs sono a buon punto,
sto provando questo metodo che se passo una sola cartella per analizzare eventuali cambiamenti funziona,
se passo piu cartelle separate dall "," purtroppo mi va in errore.
come posso passare i parametri corretti a questa semplice classe...
Grazie
B4X:'Non-UI application (console / server application) #Region Project Attributes #CommandLineArgs: #MergeLibraries: True #End Region Sub Process_Globals Dim cfw As CustomFileWatcher End Sub Sub AppStart (Args() As String) cfw.Initialize("C:/syspc/dbcasse", Me, "CustomFileWatcherEvent") ' OK' ' questo mi da errore ' '' cfw.Initialize("C:/syspc/dbcasse,c:/pippo", Me, "CustomFileWatcherEvent") StartMessageLoop End Sub Sub CustomFileWatcherEvent_CreationDetected(PathToWatch As String, Filename As String) Log("New file/folder created: " & PathToWatch & "/" & Filename) End Sub Sub CustomFileWatcherEvent_ModificationDetected(PathToWatch As String, Filename As String) Log("Modifica File : " & PathToWatch & "/" & Filename) End Sub Sub CustomFileWatcherEvent_DeletionDetected(PathToWatch As String, Filename As String) Log("Cancellazione File : " & PathToWatch & "/" & Filename) End Sub
la classe:
B4X:#Event: CreationDetected(PathToWatch As String, Filename As String) #Event: DeletionDetected(PathToWatch As String, Filename As String) #Event: ModificationDetected(PathToWatch As String, Filename As String) Sub Class_Globals Private FWatcher As FileWatcher Private mEventName As String Private mCallbackModule As Object Private mPathToWatch As String End Sub 'Initialze the object 'Pass the path you want to watch, the module you want to be called, the event you want to be called Public Sub Initialize(PathToWatch As Object, CallbackModule As Object, EventName As String) mEventName = EventName mCallbackModule = CallbackModule mPathToWatch=PathToWatch FWatcher.Initialize("fwEvent") FWatcher.SetWatchList(Array As String(mPathToWatch)) FWatcher.StartWatching End Sub Public Sub FermaAvviaVerifica( FermaAvvia As Boolean) If FermaAvvia=False Then FWatcher.StopWatching Else FWatcher.StartWatching End Sub Public Sub PathControllo(mPath As Object) mPathToWatch=mPath FWatcher.StopWatching FWatcher.SetWatchList(Array As String(mPathToWatch)) FWatcher.StartWatching End Sub Private Sub fwEvent_CreationDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_CreationDetected", mPathToWatch, FileName) Log("classe Creazione file") End Sub Private Sub fwEvent_DeletionDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_DeletionDetected", mPathToWatch, FileName) Log("classe Cancella file") End Sub Private Sub fwEvent_ModificationDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_ModificationDetected", mPathToWatch, FileName) Log("classe Modifica file") End Sub
chi mi corregge questa classe...
grazie
Error: Illegal char <:> at index 18: C:/syspc/dbcasse,c:/pippo
java.nio.file.InvalidPathException: Illegal char <:> at index 18: C:/syspc/dbcasse,c:/pippo
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at butt.droid.FileWatcher$WatcherThread.run(FileWatcher.java:355)
Help. Help. Help.grazie al suggerimento di @LucaMs sono a buon punto,
sto provando questo metodo che se passo una sola cartella per analizzare eventuali cambiamenti funziona,
se passo piu cartelle separate dall "," purtroppo mi va in errore.
come posso passare i parametri corretti a questa semplice classe...
Grazie
B4X:'Non-UI application (console / server application) #Region Project Attributes #CommandLineArgs: #MergeLibraries: True #End Region Sub Process_Globals Dim cfw As CustomFileWatcher End Sub Sub AppStart (Args() As String) cfw.Initialize("C:/syspc/dbcasse", Me, "CustomFileWatcherEvent") ' OK' ' questo mi da errore ' '' cfw.Initialize("C:/syspc/dbcasse,c:/pippo", Me, "CustomFileWatcherEvent") StartMessageLoop End Sub Sub CustomFileWatcherEvent_CreationDetected(PathToWatch As String, Filename As String) Log("New file/folder created: " & PathToWatch & "/" & Filename) End Sub Sub CustomFileWatcherEvent_ModificationDetected(PathToWatch As String, Filename As String) Log("Modifica File : " & PathToWatch & "/" & Filename) End Sub Sub CustomFileWatcherEvent_DeletionDetected(PathToWatch As String, Filename As String) Log("Cancellazione File : " & PathToWatch & "/" & Filename) End Sub
la classe:
B4X:#Event: CreationDetected(PathToWatch As String, Filename As String) #Event: DeletionDetected(PathToWatch As String, Filename As String) #Event: ModificationDetected(PathToWatch As String, Filename As String) Sub Class_Globals Private FWatcher As FileWatcher Private mEventName As String Private mCallbackModule As Object Private mPathToWatch As String End Sub 'Initialze the object 'Pass the path you want to watch, the module you want to be called, the event you want to be called Public Sub Initialize(PathToWatch As Object, CallbackModule As Object, EventName As String) mEventName = EventName mCallbackModule = CallbackModule mPathToWatch=PathToWatch FWatcher.Initialize("fwEvent") FWatcher.SetWatchList(Array As String(mPathToWatch)) FWatcher.StartWatching End Sub Public Sub FermaAvviaVerifica( FermaAvvia As Boolean) If FermaAvvia=False Then FWatcher.StopWatching Else FWatcher.StartWatching End Sub Public Sub PathControllo(mPath As Object) mPathToWatch=mPath FWatcher.StopWatching FWatcher.SetWatchList(Array As String(mPathToWatch)) FWatcher.StartWatching End Sub Private Sub fwEvent_CreationDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_CreationDetected", mPathToWatch, FileName) Log("classe Creazione file") End Sub Private Sub fwEvent_DeletionDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_DeletionDetected", mPathToWatch, FileName) Log("classe Cancella file") End Sub Private Sub fwEvent_ModificationDetected(FileName As String) CallSub3(mCallbackModule, mEventName & "_ModificationDetected", mPathToWatch, FileName) Log("classe Modifica file") End Sub
chi mi corregge questa classe...
grazie
Error: Illegal char <:> at index 18: C:/syspc/dbcasse,c:/pippo
java.nio.file.InvalidPathException: Illegal char <:> at index 18: C:/syspc/dbcasse,c:/pippo
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at butt.droid.FileWatcher$WatcherThread.run(FileWatcher.java:355)
Questa libreria è particolare. Usa FileWarcher in questo modoHelp. Help. Help.
fw.Initialize("fw")
fw.SetWatchList(ListPathWatch) 'ListPathWatch As List of String
fw.StartWatching
Sub fw_CreationDetected(FileName As String)
Log("CreationDetected: " & FileName) 'Logs the creation of a new file or folder
End Sub
Sub fw_DeletionDetected(FileName As String)
Log("DeletionDetected: " & FileName) 'Logs the deletion of a file or folder
End Sub
Sub fw_ModificationDetected(FileName As String)
Log("ModificationDetected: " & FileName) 'Logs the modification of a file or folder
End Sub
Public Sub Initialize(PathToWatch As String, CallbackModule As Object, EventName As String)
mEventName = EventName
mCallbackModule = CallbackModule
mPathToWatch=PathToWatch
FWatcher.Initialize("fwEvent")
FWatcher.SetWatchList(Regex.Split(",",mPathToWatch))
FWatcher.StartWatching
End Sub
NOOOOOOOOOOOOO. Un array di stringhe. Leggili i parametriEra per provare una classe..
Quindi se passo i dati come stringa funziona?
Tra le varie prove mi sembra di averlo provato, provo dopo cena questa modifica.La Classe CustomFileWatch usa FileWatch... io ti consiglio di usare direttamente file Watch
Oppure modifica la classe CustomFileWatch cosi:
B4X:Public Sub Initialize(PathToWatch As String, CallbackModule As Object, EventName As String) mEventName = EventName mCallbackModule = CallbackModule mPathToWatch=PathToWatch FWatcher.Initialize("fwEvent") FWatcher.SetWatchList(Regex.Split(",",mPathToWatch)) FWatcher.StartWatching End Sub
questa modifica ti permetterebbe di dividere i percorsi da una virgola...
Con questa modifica puoi passare in percorsi come stringa unica divise da una virgola.La Classe CustomFileWatch usa FileWatch... io ti consiglio di usare direttamente file Watch
Oppure modifica la classe CustomFileWatch cosi:
B4X:Public Sub Initialize(PathToWatch As String, CallbackModule As Object, EventName As String) mEventName = EventName mCallbackModule = CallbackModule mPathToWatch=PathToWatch FWatcher.Initialize("fwEvent") FWatcher.SetWatchList(Regex.Split(",",mPathToWatch)) FWatcher.StartWatching End Sub
questa modifica ti permetterebbe di dividere i percorsi da una virgola...
Funziona... woww.. Grazie. Sei un grande @Star-DustLa Classe CustomFileWatch usa FileWatch... io ti consiglio di usare direttamente file Watch
Oppure modifica la classe CustomFileWatch cosi:
B4X:Public Sub Initialize(PathToWatch As String, CallbackModule As Object, EventName As String) mEventName = EventName mCallbackModule = CallbackModule mPathToWatch=PathToWatch FWatcher.Initialize("fwEvent") FWatcher.SetWatchList(Regex.Split(",",mPathToWatch)) FWatcher.StartWatching End Sub
questa modifica ti permetterebbe di dividere i percorsi da una virgola...
Per quella robetta? Se guardassi bene qualche altro suo sorgente, che diresti, che è Dio? ?Sei un grande @Star-Dust
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?