From 5774f40b650a376e9b622dba9df6c43589b0d398 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 9 Apr 2020 00:29:06 +0300 Subject: Logs, Comments & General organization on FSE/PPC. Several improvements. --- .../PPC/Tango.PPC.Common/IPPCService.cs | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCService.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCService.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCService.cs new file mode 100644 index 000000000..5dfe5335c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCService.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Common +{ + /// + /// Represents a PPC remoting service. + /// + public interface IPPCService + { + /// + /// Gets or sets a value indicating whether this is enabled. + /// + bool Enabled { get; set; } + } +} + +public static class ExtensionMethods +{ + /// + /// Throws an exception is the service is disabled. + /// + /// The service. + /// + public static void ThrowIfDisabled(this IPPCService service) + { + if (!service.Enabled) + { + throw new NotSupportedException($"The {service.GetType().Name} is currently disabled. Could not perform the requested action."); + } + } +} -- cgit v1.3.1