From d601ae74def72dbef7baa73c8c45390b186f61c8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 13 Oct 2022 10:46:00 -0500 Subject: add HostType --- src/slskd/Shares/Types/Host.cs | 9 ++++++++- src/slskd/Shares/Types/HostType.cs | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/slskd/Shares/Types/HostType.cs (limited to 'src') diff --git a/src/slskd/Shares/Types/Host.cs b/src/slskd/Shares/Types/Host.cs index 45706b23..db68c48e 100644 --- a/src/slskd/Shares/Types/Host.cs +++ b/src/slskd/Shares/Types/Host.cs @@ -29,11 +29,13 @@ namespace slskd.Shares /// Initializes a new instance of the class. /// /// The name of the host. + /// The type of the host. /// The collection of hosted shares. /// The initial state of the host. - public Host(string name, IEnumerable shares = null, HostState state = HostState.Offline) + public Host(string name, HostType type, IEnumerable shares = null, HostState state = HostState.Offline) { Name = name; + Type = type; Shares = shares ?? Enumerable.Empty(); State = state; } @@ -54,6 +56,11 @@ namespace slskd.Shares /// public HostState State { get; private set; } + /// + /// Gets the host type. + /// + public HostType Type { get; } + /// /// Sets the hosted shares for the host. /// diff --git a/src/slskd/Shares/Types/HostType.cs b/src/slskd/Shares/Types/HostType.cs new file mode 100644 index 00000000..6a892dff --- /dev/null +++ b/src/slskd/Shares/Types/HostType.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +namespace slskd.Shares +{ + /// + /// The type of host. + /// + public enum HostType + { + /// + /// Local. + /// + Local = 0, + + /// + /// Remote; shares are hosted by an Agent. + /// + Remote = 1, + } +} -- cgit v1.2.3