From 71447e44a8413f7d634a3b5af8c9ea7249cb7e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=BCffel?= Date: Tue, 29 Aug 2023 12:15:32 +0200 Subject: [PATCH] reformat and add logging --- SyncProviders/SmbLibProvider.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SyncProviders/SmbLibProvider.cs b/SyncProviders/SmbLibProvider.cs index be37e51..b65ce0f 100644 --- a/SyncProviders/SmbLibProvider.cs +++ b/SyncProviders/SmbLibProvider.cs @@ -42,7 +42,7 @@ string DestinationPath { get { - return JobOptions.DestinationPath.Substring(JobOptions.DestinationPath.IndexOf(Share) + Share.Length).Replace('/','\\'); + return JobOptions.DestinationPath.Substring(JobOptions.DestinationPath.IndexOf(Share) + Share.Length).Replace('/', '\\'); } } @@ -67,7 +67,7 @@ public override void SyncSourceToDest() if (JobOptions.SyncDeleted) { var remoteFiles = ListFiles(DestinationPath, true); - foreach(var file in remoteFiles) + foreach (var file in remoteFiles) { var realFilePath = file.Substring(file.IndexOf(DestinationPath) + DestinationPath.Length).Trim('\\').Replace('/', '\\'); if (!_fi.Any(x => x.FullName.Replace('/', '\\').EndsWith(realFilePath))) @@ -96,8 +96,8 @@ public override void SyncSourceToDest() - - + + public void ConnectToShare(string server, string shareName, string domain, string user, string password) { @@ -106,12 +106,17 @@ public void ConnectToShare(string server, string shareName, string domain, strin bool isConnected = client.Connect(server, SMBTransportType.DirectTCPTransport); if (isConnected) { + logger.LogDebug("ConnectToShare with domain {A} and user {B} with {C} pass", domain, user, password.Select(x=>'*')); status = client.Login(domain, user, password); if (status == NTStatus.STATUS_SUCCESS) { //List shares = client.ListShares(out status); //client.Logoff(); } + else + { + logger.LogError("ConnectToShare is status {A}", status); + } //client.Disconnect(); } fileStore = client.TreeConnect(shareName, out status); @@ -249,7 +254,7 @@ bool FileExists(string filepathFromShare, out long size) } size = 0; return false; - + }