コード例 #1
0
        internal static CpArgument CreateArgument(CpAction parentAction, CpService parentService, XPathNavigator argumentNav,
                                                  IXmlNamespaceResolver nsmgr)
        {
            string          name = ParserHelper.SelectText(argumentNav, "s:name/text()", nsmgr);
            string          relatedStateVariableName = ParserHelper.SelectText(argumentNav, "s:relatedStateVariable/text()", nsmgr);
            CpStateVariable relatedStateVariable;

            if (!parentService.StateVariables.TryGetValue(relatedStateVariableName, out relatedStateVariable))
            {
                throw new ArgumentException("Related state variable '{0}' is not present in service", relatedStateVariableName);
            }
            string            direction = ParserHelper.SelectText(argumentNav, "s:direction/text()", nsmgr);
            XPathNodeIterator retValIt  = argumentNav.Select("s:retval", nsmgr);
            CpArgument        result    = new CpArgument(parentAction, name, relatedStateVariable, ParseArgumentDirection(direction), retValIt.MoveNext());

            return(result);
        }
コード例 #2
0
ファイル: CpAction.cs プロジェクト: zeroxist/MediaPortal-2
 internal static CpAction ConnectAction(DeviceConnection connection, CpService parentService, XPathNavigator actionNav, IXmlNamespaceResolver nsmgr)
 {
     using (connection.CPData.Lock.EnterWrite())
     {
         string            name       = ParserHelper.SelectText(actionNav, "s:name/text()", nsmgr);
         CpAction          result     = new CpAction(connection, parentService, name);
         XPathNodeIterator argumentIt = actionNav.Select("s:argumentList/s:argument", nsmgr);
         while (argumentIt.MoveNext())
         {
             CpArgument argument = CpArgument.CreateArgument(result, parentService, argumentIt.Current, nsmgr);
             if (argument.Direction == ArgumentDirection.In)
             {
                 result.AddInAgrument(argument);
             }
             else
             {
                 result.AddOutAgrument(argument);
             }
         }
         return(result);
     }
 }
コード例 #3
0
ファイル: CpAction.cs プロジェクト: toyotallday/MediaPortal-2
 /// <summary>
 /// Adds a new formal output argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddOutAgrument(CpArgument argument)
 {
     _outArguments.Add(argument);
 }
コード例 #4
0
ファイル: CpAction.cs プロジェクト: toyotallday/MediaPortal-2
 /// <summary>
 /// Adds a new formal input argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddInAgrument(CpArgument argument)
 {
     _inArguments.Add(argument);
 }
コード例 #5
0
ファイル: CpArgument.cs プロジェクト: chekiI/MediaPortal-2
 internal static CpArgument CreateArgument(CpAction parentAction, CpService parentService, XPathNavigator argumentNav,
     IXmlNamespaceResolver nsmgr)
 {
   string name = ParserHelper.SelectText(argumentNav, "s:name/text()", nsmgr);
   string relatedStateVariableName = ParserHelper.SelectText(argumentNav, "s:relatedStateVariable/text()", nsmgr);
   CpStateVariable relatedStateVariable;
   if (!parentService.StateVariables.TryGetValue(relatedStateVariableName, out relatedStateVariable))
     throw new ArgumentException("Related state variable '{0}' is not present in service", relatedStateVariableName);
   string direction = ParserHelper.SelectText(argumentNav, "s:direction/text()", nsmgr);
   XPathNodeIterator retValIt = argumentNav.Select("s:retval", nsmgr);
   CpArgument result = new CpArgument(parentAction, name, relatedStateVariable, ParseArgumentDirection(direction), retValIt.MoveNext());
   return result;
 }
コード例 #6
0
ファイル: CpAction.cs プロジェクト: joconno4/MediaPortal-2
 /// <summary>
 /// Adds a new formal output argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddOutAgrument(CpArgument argument)
 {
   _outArguments.Add(argument);
 }
コード例 #7
0
ファイル: CpAction.cs プロジェクト: joconno4/MediaPortal-2
 /// <summary>
 /// Adds a new formal input argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddInAgrument(CpArgument argument)
 {
   _inArguments.Add(argument);
 }