Skip to content

Commit 2ddeb65

Browse files
committed
Update nuget, update to .net 8
1 parent 1b1b1c3 commit 2ddeb65

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

AutoSSH.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="SSH.NET" Version="2020.0.1" />
10-
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="5.0.0" />
9+
<PackageReference Include="SSH.NET" Version="2024.1.0" />
10+
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
1111
</ItemGroup>
1212

1313
</Project>

AutoSSHApp.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ private static List<KeyValuePair<HostEntry, List<string>>> Initialize(string com
209209
password += key.KeyChar;
210210
}
211211
}
212-
byte[] bytes = ProtectedData.Protect(Encoding.UTF8.GetBytes(userName + "|" + password), null, DataProtectionScope.CurrentUser);
212+
byte[] bytes = ProtectedData.Protect(Encoding.UTF8.GetBytes(userName + "|" + password), null,
213+
DataProtectionScope.CurrentUser);
213214
File.WriteAllBytes(loginPath, bytes);
214215
}
215216
if (!File.Exists(loginPath))
@@ -218,7 +219,8 @@ private static List<KeyValuePair<HostEntry, List<string>>> Initialize(string com
218219
}
219220
{
220221
byte[] protectedBytes = File.ReadAllBytes(loginPath);
221-
string unprotectedBytes = Encoding.UTF8.GetString(ProtectedData.Unprotect(protectedBytes, null, DataProtectionScope.CurrentUser));
222+
string unprotectedBytes = Encoding.UTF8.GetString(ProtectedData.Unprotect(protectedBytes, null,
223+
DataProtectionScope.CurrentUser));
222224
int pos = unprotectedBytes.IndexOf('|');
223225
if (pos < 0)
224226
{
@@ -323,7 +325,7 @@ private static long BackupFile(string root, string remotePath, SftpClient client
323325

324326
try
325327
{
326-
SftpFile file = client.Get(remotePath);
328+
var file = client.Get(remotePath);
327329
if (file.IsRegularFile &&
328330
(!File.Exists(fileName) || file.LastWriteTimeUtc > File.GetLastWriteTimeUtc(fileName)))
329331
{
@@ -378,7 +380,7 @@ private static long BackupFolder(HostEntry host, string root, string path, SftpC
378380
{
379381
continue;
380382
}
381-
SftpFile file;
383+
ISftpFile file;
382384
try
383385
{
384386
file = client.Get(fileOrFolder);
@@ -400,7 +402,7 @@ private static long BackupFolder(HostEntry host, string root, string path, SftpC
400402
{
401403
try
402404
{
403-
SftpFile[] files = client.ListDirectory(fileOrFolder).Where(f => f.IsRegularFile || (f.IsDirectory && !f.Name.StartsWith("."))).ToArray();
405+
var files = client.ListDirectory(fileOrFolder).Where(f => f.IsRegularFile || (f.IsDirectory && !f.Name.StartsWith("."))).ToArray();
404406
Parallel.ForEach(files.Where(f => f.IsRegularFile && (host.IgnoreRegex == null || !host.IgnoreRegex.IsMatch(f.FullName))), parallelOptions, (_file) =>
405407
{
406408
Interlocked.Add(ref size, BackupFile(root, _file.FullName, client));

Properties/PublishProfiles/FolderProfile.pubxml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
66
<PropertyGroup>
77
<Configuration>Release</Configuration>
88
<Platform>Any CPU</Platform>
9-
<PublishDir>bin\Release\net5.0\publish\</PublishDir>
9+
<PublishDir>bin\Release\net8.0\publish\</PublishDir>
1010
<PublishProtocol>FileSystem</PublishProtocol>
11-
<TargetFramework>net5.0</TargetFramework>
11+
<TargetFramework>net8.0</TargetFramework>
1212
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1313
<SelfContained>true</SelfContained>
14-
<PublishSingleFile>True</PublishSingleFile>
15-
<PublishReadyToRun>False</PublishReadyToRun>
16-
<PublishTrimmed>False</PublishTrimmed>
14+
<PublishSingleFile>true</PublishSingleFile>
15+
<PublishReadyToRun>false</PublishReadyToRun>
1716
</PropertyGroup>
1817
</Project>

0 commit comments

Comments
 (0)