Пример #1
0
        /// <summary>
        /// Sends the specified command to MediaNMonkey and returns the associated command response.</summary>
        /// <param name="command">The command expression to send to MediaMonkey.</param>
        public async Task <EvaluateCommandResponse> SendCommandAsync(string command)
        {
            if (string.IsNullOrWhiteSpace(command))
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (mmSession is null)
            {
                throw new NullReferenceException("No active MediaMonkey session found.");
            }

            var cmd = new EvaluateCommand()
            {
                ObjectGroup           = "console",
                IncludeCommandLineAPI = true,
                ReturnByValue         = true,
                AwaitPromise          = true,
                Silent     = false,
                Expression = command
            };

            return(await mmSession.SendCommand(cmd).ConfigureAwait(false) as EvaluateCommandResponse);
        }
Пример #2
0
 /// <summary>
 /// Enables database tracking, database events will now be delivered to the client.
 /// </summary>
 public async Task <EnableCommandResponse> Enable(EnableCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <EnableCommand, EnableCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
Пример #3
0
 /// <summary>
 /// Enables console to refer to the node with given id via $x (see Command Line API for more details
 /// $x functions).
 /// </summary>
 public async Task <AddInspectedHeapObjectCommandResponse> AddInspectedHeapObject(AddInspectedHeapObjectCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <AddInspectedHeapObjectCommand, AddInspectedHeapObjectCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
Пример #4
0
 /// <summary>
 /// Deprecated, please use addScriptToEvaluateOnNewDocument instead.
 /// </summary>
 public async Task <AddScriptToEvaluateOnLoadCommandResponse> AddScriptToEvaluateOnLoad(AddScriptToEvaluateOnLoadCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <AddScriptToEvaluateOnLoadCommand, AddScriptToEvaluateOnLoadCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 public async Task <GetDOMCountersCommandResponse> GetDOMCounters(GetDOMCountersCommand command = null, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <GetDOMCountersCommand, GetDOMCountersCommandResponse>(command ?? new GetDOMCountersCommand(), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
Пример #6
0
 /// <summary>
 /// Returns array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
 /// </summary>
 public async Task <GetFramesWithManifestsCommandResponse> GetFramesWithManifests(GetFramesWithManifestsCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <GetFramesWithManifestsCommand, GetFramesWithManifestsCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
 /// <summary>
 /// Overrides the Device Orientation.
 /// </summary>
 public async Task <SetDeviceOrientationOverrideCommandResponse> SetDeviceOrientationOverride(SetDeviceOrientationOverrideCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <SetDeviceOrientationOverrideCommand, SetDeviceOrientationOverrideCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
 /// <summary>
 /// Tells whether clearing browser cache is supported.
 /// </summary>
 public async Task <CanClearBrowserCacheCommandResponse> CanClearBrowserCache(CanClearBrowserCacheCommand command = null, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <CanClearBrowserCacheCommand, CanClearBrowserCacheCommandResponse>(command ?? new CanClearBrowserCacheCommand(), cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }
Пример #9
0
 /// <summary>
 /// Collects class names for the node with given id and all of it's child nodes.
 /// </summary>
 public async Task <CollectClassNamesFromSubtreeCommandResponse> CollectClassNamesFromSubtree(CollectClassNamesFromSubtreeCommand command, CancellationToken cancellationToken = default(CancellationToken), int?millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
 {
     return(await m_session.SendCommand <CollectClassNamesFromSubtreeCommand, CollectClassNamesFromSubtreeCommandResponse>(command, cancellationToken, millisecondsTimeout, throwExceptionIfResponseNotReceived));
 }