Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public async Task <bool> Connect(CancellationToken token)
        {
            try
            {
                TimeoutCounter = TimeOut;
                Socket         = SocketCreate(Url);
                while (SocketState(Socket) == 0)
                {
                    await Task.Yield();

                    TimeoutCounter -= Time.unscaledDeltaTime;
                    if (TimeoutCounter < 0.0f)
                    {
                        ErrorCallbackProvider.ReportError("Connection timeout!");
                        return(false);
                    }
                }
            }
            catch (TimeoutException)
            {
                ErrorCallbackProvider.ReportError("Connection timeout!");
                return(false);
            }

            if (SocketState(Socket) != 1)
            {
                ErrorCallbackProvider.ReportError("Cannot connect to destination host: " + Url);
                return(false);
            }

            ErrorCallbackProvider.ReportInfo("Connection established");
            return(true);
        }
Example #2
0
        /// <summary>
        ///   Returns the translated text for the Selected language.
        /// </summary>
        public static string GetTranslation(string entry, string languageCode = null)
        {
            if (languageCode == null)
            {
                languageCode =
                    languageDictionary == null ?
                    throw new System.ArgumentException("No standard language selected") :
                          languageDictionary.lang;
            }
            else if (languageDictionary == null)
            {
                if (fullLockit.languages.ContainsKey(languageCode))
                {
                    languageDictionary = fullLockit.languages[languageCode];
                }
            }

            if (languageDictionary == null)
            {
                ErrorCallbackProvider.ReportError(string.Format("Language of code {0}: not existent in dictionary ", languageCode));
                return(entry);
            }

            if (!languageDictionary.EntriesDictionary.ContainsKey(entry))
            {
                return(entry);
            }
            return(languageDictionary.EntriesDictionary[entry]);
        }
Example #3
0
        /// <summary>
        /// Creates BCComm object.
        /// </summary>
        /// <param name="client">JsonRpc client implementation</param>
        /// <param name="gameCenterContract">game center contract address</param>
        public BCComm(Nethereum.JsonRpc.Client.IClient client, string gameCenterContract)
        {
            web = new Web3(client);

            if (gameCenterContract == null)
            {
                ErrorCallbackProvider.ReportError("Game center contract cannot be null!");
            }

            gameCenter = (GameCenterContract)GetContract(typeof(GameCenterContract), gameCenterContract);
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 /// <param name="inner"></param>
 public HoardException(string message, Exception inner)
     : base(message, inner)
 {
     ErrorCallbackProvider.ReportError(message);
 }