@@ -39,7 +39,6 @@ public virtual SynchronizationState SyncState
3939 /// <summary>
4040 /// Gets or sets a value that indicates whether to send an authenticate header with the websocket.
4141 /// </summary>
42- public NetworkCredential WebSocketCredentials { get ; set ; }
4342
4443 /// <summary>
4544 /// WebSocket client.
@@ -112,7 +111,7 @@ await Task.Factory.StartNew(
112111 try
113112 {
114113 repeat = false ;
115- await StartMonitoringAsync ( WebSocketCredentials ) ;
114+ await StartMonitoringAsync ( engine . Credentials ) ;
116115 }
117116 catch ( Exception e ) when ( e is WebSocketException || e is AggregateException )
118117 {
@@ -157,30 +156,34 @@ internal async Task StopAsync()
157156 internal async Task ProcessAsync ( string jsonString )
158157 {
159158 WebSocketMessage jsonMessage = JsonSerializer . Deserialize < WebSocketMessage > ( jsonString ) ;
160- LogMessage ( $ "EventType: { jsonMessage . EventType } ", jsonMessage . ItemPath , jsonMessage . TargetPath ) ;
161-
162159 string remoteStoragePath = Mapping . GetAbsoluteUri ( jsonMessage . ItemPath ) ;
163- switch ( jsonMessage . EventType )
160+
161+ // check if remote url starts with WebDAVServerUrl
162+ if ( remoteStoragePath . StartsWith ( Program . Settings . WebDAVServerUrl ) )
164163 {
165- case "created" :
166- await CreatedAsync ( remoteStoragePath ) ;
167- break ;
168- case "updated" :
169- await ChangedAsync ( remoteStoragePath ) ;
170- break ;
171- case "moved" :
172- string remoteStorageNewPath = Mapping . GetAbsoluteUri ( jsonMessage . TargetPath ) ;
173- await MovedAsync ( remoteStoragePath , remoteStorageNewPath ) ;
174- break ;
175- case "deleted" :
176- await DeletedAsync ( remoteStoragePath ) ;
177- break ;
178- case "locked" :
179- await LockedAsync ( remoteStoragePath ) ;
180- break ;
181- case "unlocked" :
182- await UnlockedAsync ( remoteStoragePath ) ;
183- break ;
164+ LogMessage ( $ "EventType: { jsonMessage . EventType } ", jsonMessage . ItemPath , jsonMessage . TargetPath ) ;
165+ switch ( jsonMessage . EventType )
166+ {
167+ case "created" :
168+ await CreatedAsync ( remoteStoragePath ) ;
169+ break ;
170+ case "updated" :
171+ await ChangedAsync ( remoteStoragePath ) ;
172+ break ;
173+ case "moved" :
174+ string remoteStorageNewPath = Mapping . GetAbsoluteUri ( jsonMessage . TargetPath ) ;
175+ await MovedAsync ( remoteStoragePath , remoteStorageNewPath ) ;
176+ break ;
177+ case "deleted" :
178+ await DeletedAsync ( remoteStoragePath ) ;
179+ break ;
180+ case "locked" :
181+ await LockedAsync ( remoteStoragePath ) ;
182+ break ;
183+ case "unlocked" :
184+ await UnlockedAsync ( remoteStoragePath ) ;
185+ break ;
186+ }
184187 }
185188 }
186189
0 commit comments