Skip to content

Commit

Permalink
reformat and add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskueffel committed Aug 29, 2023
1 parent 23d7eb6 commit 71447e4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions SyncProviders/SmbLibProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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('/', '\\');
}
}

Expand All @@ -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)))
Expand Down Expand Up @@ -96,8 +96,8 @@ public override void SyncSourceToDest()






public void ConnectToShare(string server, string shareName, string domain, string user, string password)
{
Expand All @@ -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<string> shares = client.ListShares(out status);
//client.Logoff();
}
else
{
logger.LogError("ConnectToShare is status {A}", status);
}
//client.Disconnect();
}
fileStore = client.TreeConnect(shareName, out status);
Expand Down Expand Up @@ -249,7 +254,7 @@ bool FileExists(string filepathFromShare, out long size)
}
size = 0;
return false;

}


Expand Down

0 comments on commit 71447e4

Please sign in to comment.