Smb linux fixes

This commit is contained in:
2022-01-08 11:48:55 +01:00
parent 8cb0675254
commit c2e64226a0
2 changed files with 11 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
using System.Net;
using FileTime.Core.Interactions; using FileTime.Core.Interactions;
using FileTime.Core.Models; using FileTime.Core.Models;
using FileTime.Core.Providers; using FileTime.Core.Providers;
@@ -87,7 +88,7 @@ namespace FileTime.Providers.Smb
{ {
ISMBClient client = GetSmbClient(); ISMBClient client = GetSmbClient();
List<string> shares = new List<string>(); //client.ListShares(out var status); List<string> shares = client.ListShares(out var status);
_shares = shares.ConvertAll(s => new SmbShare(s, Provider, this, GetSmbClient)).AsReadOnly(); _shares = shares.ConvertAll(s => new SmbShare(s, Provider, this, GetSmbClient)).AsReadOnly();
Refreshed?.Invoke(this, EventArgs.Empty); Refreshed?.Invoke(this, EventArgs.Empty);
@@ -97,8 +98,13 @@ namespace FileTime.Providers.Smb
{ {
if (_client == null) if (_client == null)
{ {
var couldParse = IPAddress.TryParse(Name[2..], out var ipAddress);
_client = new SMB2Client(); _client = new SMB2Client();
if (_client.Connect(Name[2..], SMBTransportType.DirectTCPTransport)) var connected = couldParse
? _client.Connect(ipAddress, SMBTransportType.DirectTCPTransport)
: _client.Connect(Name[2..], SMBTransportType.DirectTCPTransport);
if (connected)
{ {
if (_username == null && _password == null) if (_username == null && _password == null)
{ {

View File

@@ -159,6 +159,9 @@ namespace FileTime.Providers.Smb
} }
} }
containers = containers.OrderBy(c => c.Name).ToList();
elements = elements.OrderBy(e => e.Name).ToList();
return (containers, elements); return (containers, elements);
} }
} }