diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-29 08:27:30 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-06-29 08:27:30 -0500 |
| commit | ac6f113e36476fe25016a5ae073bc18be91301fd (patch) | |
| tree | 37841f20cb1159553e5948cf23ecf341df7981cf /src | |
| parent | 0d145a7255676f7a81d344dcaaf81e0e12df3b32 (diff) | |
| download | slskd-ac6f113e36476fe25016a5ae073bc18be91301fd.tar.gz | |
rename extensions, add a mapper for stats
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/Extensions.cs (renamed from src/slskd/Core/CoreExtensions.cs) | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/slskd/Core/CoreExtensions.cs b/src/slskd/Core/Extensions.cs index aef187b8..d818d387 100644 --- a/src/slskd/Core/CoreExtensions.cs +++ b/src/slskd/Core/Extensions.cs @@ -1,4 +1,4 @@ -// <copyright file="CoreExtensions.cs" company="slskd Team"> +// <copyright file="Extensions.cs" company="slskd Team"> // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify @@ -24,7 +24,7 @@ namespace slskd /// <summary> /// Core extensions; extensions for types specific to Soulseek or slskd. /// </summary> - public static class CoreExtensions + public static class Extensions { /// <summary> /// Redacts this instance of Options, replacing properties marked with <see cref="SecretAttribute"/> with '*****'. @@ -71,5 +71,18 @@ namespace slskd inactivityTimeout: inactivityTimeout ?? o.InactivityTimeout, proxyOptions: proxyOptions ?? o.ProxyOptions, configureSocket: configureSocketAction ?? o.ConfigureSocket); + + /// <summary> + /// Creates a new instance of <see cref="UserStatisticsState"/> from this instance of <see cref="UserStatistics"/>. + /// </summary> + /// <param name="stats">The UserStatistics instance from which to copy data</param> + /// <returns>The new instance.</returns> + public static UserStatisticsState ToUserStatisticsState(this UserStatistics stats) => new() + { + AverageSpeed = stats.AverageSpeed, + DirectoryCount = stats.DirectoryCount, + FileCount = stats.FileCount, + UploadCount = stats.UploadCount, + }; } } |
