private void HandleContextCore(HttpListenerContext context) { XmlReader reader = XmlReader.Create(context.Request.InputStream); reader.ReadToFollowing("Body", Protocol.SoapEnvelopeSchema); while (Helper.ReadToNextElement(reader)) { if (!service.Actions.ContainsKey(reader.LocalName)) { throw UpnpControlException.InvalidAction(); } ServiceAction action = service.Actions[reader.LocalName]; BriefAction(reader.ReadSubtree(), action); try { action.Execute(); } catch (UpnpControlException) { throw; } catch (ArgumentOutOfRangeException e) { throw UpnpControlException.ArgumentValueOutOfRange(e.Message); } catch (ArgumentException e) { throw UpnpControlException.ArgumentValueInvalid(e.Message); } catch (NotImplementedException e) { throw UpnpControlException.OptionalActionNotImplimented(e.Message); } catch (Exception e) { throw UpnpControlException.ActionFailed(e.Message); } DebriefAction(context, action); } }
private void PrintTypeAndChangeTo(string name, string templateStartType) { var paramz = new Dictionary <String, string>() { [ServiceAction.PARAM_NAME_SERVICE_NAME] = name, [ServiceAction.PARAM_NAME_START_MODE] = templateStartType }; var serviceAction = new ServiceAction(paramz); Log("service " + name + "; " + Enum.GetName(typeof(Action_.StatusResult), serviceAction.CheckStatus()) + " | type: " + templateStartType); Log("service " + name + "; execution result: " + serviceAction.Execute()); }