// ReSharper disable once UnusedMember.Global
        public static ResponseInfo Handle(ResolvedHttpListenerRequest request)
        {
            ResponseInfo result      = new ResponseInfo(HttpStatusCode.NotFound, Steward.StandardErrorResponseContent);
            string       pathElement = string.Empty;

            for (int i = 0; i < request.Request.Url.Segments.Length; i++)
            {
                string thisSegment = request.Request.Url.Segments[i].Replace("/", string.Empty);
                if (thisSegment == "VolumeController")
                {
                    if (i + 1 < request.Request.Url.Segments.Length)
                    {
                        pathElement = request.Request.Url.Segments[i + 1].Replace("/", string.Empty);
                    }
                    break;
                }
            }

            if (pathElement == string.Empty)
            {
                return(new ResponseInfo(HttpStatusCode.OK, lib.Utils.PageBuilder.MethodListInApi(typeof(VolumeController))));
            }

            string nameSpaceName = $"{typeof(VolumeController).Namespace}.{pathElement}";

            Type nameSpace = (from type in Assembly.GetExecutingAssembly().GetTypes()
                              where type.Namespace == nameSpaceName
                              select type).FirstOrDefault();

            if (nameSpace != null)
            {
                MethodInfo subElementHandler = nameSpace.GetMethod(Steward.HANDLERNAME);
                if (subElementHandler != null)
                {
                    result = (ResponseInfo)subElementHandler.Invoke(typeof(VolumeController), new object[] { request });
                }
            }
            else
            {
                // See if we have a method to call
                MethodInfo method = typeof(VolumeController).GetMethod(pathElement);
                if (method != null)
                {
                    result = (ResponseInfo)method.Invoke(typeof(VolumeController), new object[] { request });
                }
            }

            return(result);
        }
        private static ResponseInfo Volume_Post(ResolvedHttpListenerRequest request)
        {
            VolumeSettings newSettings;

            switch (request.ContentType)
            {
            case "application/json":
                newSettings = JsonConvert.DeserializeObject <VolumeSettings>(request.Content);
                break;

            default:
                return(new ResponseInfo(HttpStatusCode.InternalServerError,
                                        "Unable to parse request body; expecting json object."));
            }

            VolMgr.SetVolume(newSettings);

            return(new ResponseInfo(HttpStatusCode.OK, JsonConvert.SerializeObject(VolMgr.GetVolumeSettings())));
        }
        // ReSharper disable once UnusedMember.Global
        public static ResponseInfo Volume(ResolvedHttpListenerRequest request)
        {
            ResponseInfo result;
            HttpMethod   method = new HttpMethod(request.Request.HttpMethod);

            if (method == HttpMethod.Get)
            {
                result = Volume_Get();
            }
            else if (method == HttpMethod.Post)
            {
                result = Volume_Post(request);
            }
            else
            {
                result = new ResponseInfo(HttpStatusCode.MethodNotAllowed, "Invalid Method");
            }

            return(result);
        }
 // ReSharper disable once InconsistentNaming
 // ReSharper disable once UnusedMember.Global
 public static ResponseInfo UI(ResolvedHttpListenerRequest request)
 {
     return(new ResponseInfo(HttpStatusCode.OK, Properties.Resources.VolumeControllerHTML));
 }