public void Run()
        {
            _logger("Input your value:");

            string inputValue;

            _getInput.Invoke(out inputValue);

            _logger($"Here is your text = {inputValue}");
        }
Exemple #2
0
        public int GetRandomPage(string TagsQuery)
        {
            if (PageParser == null)
            {
                return(-1);
            }

            int Page = 0;

            PageParser?.Invoke(TagsQuery, out Page);

            return(Global.Random.Next(0, Page));
        }
Exemple #3
0
        /// <summary>
        /// Sets a callback delegate for requesting the private data.
        /// </summary>
        /// <privilege>
        /// http://tizen.org/privilege/recorder
        /// </privilege>
        /// <feature>
        /// http://tizen.org/feature/speech.recognition
        /// http://tizen.org/feature/microphone
        /// </feature>
        /// <param name="callback">callback function
        /// Called when Stt engine provides the engine service user with the private data.
        /// This callback function is called when the engine service user gets the private data from Stt engine.
        /// Out Parameters:
        /// a = Key -- The key field of private data
        /// b = data -- The data field of private data
        /// Following Error Codes can be returned
        /// 1. None
        /// 2. InvalidParameter
        /// 3. OperationFailed
        /// </param>
        /// <exception cref="ArgumentException">Thrown in case of Invalid Parameter</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case of Permission denied</exception>
        /// <exception cref="NotSupportedException">Thrown in case of Not supported</exception>
        /// <exception cref="InvalidOperationException">thrown in case of Operation failure</exception>
        /// <precondition>
        /// Main function should be invoked before this function is called.
        /// </precondition>
        /// <since_tizen> 4 </since_tizen>
        public void SetPrivateDataRequestedDelegate(OutAction <string> callback)
        {
            if (null == callback)
            {
                Log.Error(LogTag, "callback is null");
                throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter);
            }

            _privateDataRequestedCallback = callback;
            _privateDataRequestedCb       = (string key, out string data) =>
            {
                return(_privateDataRequestedCallback.Invoke(key, out data));
            };
            Error error = STTESetPrivateDataRequestedCb(_privateDataRequestedCb);

            if (error != Error.None)
            {
                Log.Error(LogTag, "SetPrivateDataRequestedDelegate Failed with error " + error);
                throw ExceptionFactory.CreateException((ErrorCode)error);
            }
        }
Exemple #4
0
 private void InstanceTestOutIntStringObjectArray(out int a, out string b, out object[] c, OutAction callback)
 {
     callback.Invoke(out a, out b, out c);
 }
Exemple #5
0
        public virtual async Task <List <string> > GetImagesAsync(string TagsQuery, int Count = 1, bool RandomPage = true)
        {
            HttpClient Client = new HttpClient();

            int Page = 0;

            if (RandomPage)
            {
                Page = GetRandomPage(TagsQuery);
            }

            List <string> Images  = new List <string>();
            bool          Success = false;
            int           count   = 0;

            while (true)
            {
                count++;
                string Endpoint = this.Endpoint + Query + "&tags=" + TagsQuery;
                if (Page != -1 && PageQuery != null)
                {
                    Endpoint += "&" + PageQuery + "=" + Page;
                }

                try
                {
                    HttpResponseMessage Response = await Client.GetAsync(Endpoint);

                    if (Response.IsSuccessStatusCode)
                    {
                        string Content = await Response.Content.ReadAsStringAsync();

                        Response.Dispose();

                        if (Content == "Too deep! Pull it back some. Holy f**k.")
                        {
                            Page /= 2;

                            continue;
                        }
                        if (Content.ToLower().Contains("response success=\"false\""))
                        {
                            break;
                        }

                        Regex rx = new Regex("\\\"" + UrlPrefix + "\\\":\"(.*?)\"");

                        MatchCollection Matches = rx.Matches(Content);

                        foreach (Match Match in Matches)
                        {
                            Images.Add(Match.Groups[1].Value);
                        }

                        Success = true;
                        break;
                    }
                }
                catch (InvalidOperationException ex)
                {
                    Logger.Log(LogType.Error, ConsoleColor.Red, "ImageFetcher", ex.ToString());
                    break;
                }
                if (count > 3)
                {
                    break;
                }
            }

            if (Parse != null && !Success)
            {
                if (Page != -1 && PageQuery != null)
                {
                    TagsQuery += "&" + PageQuery + "=" + Page * 42;
                }
                Parse.Invoke(TagsQuery, Count, out Images);
            }

            return(Images);
        }
 private void InstanceTestOutIntStringObjectArray(out int a, out string b, out object[] c, OutAction callback)
 {
     callback.Invoke(out a, out b, out c);
 }