コード例 #1
0
ファイル: UniHive.cs プロジェクト: afrokick/unihive
        /// <summary>
        /// Stop the miner
        /// </summary>
        public static void Stop()
        {
            if (!Initialized)
            {
                PrintError("You should call UniHive.Initialize(...) first");
                return;
            }

            if (!IsRunning)
            {
                return;
            }

            UniHiveNative.Stop();

            IsRunning = false;
        }
コード例 #2
0
ファイル: UniHive.cs プロジェクト: afrokick/unihive
        /// <summary>
        /// Initialize the specified userName, siteKey, throttle and threads.
        /// </summary>
        /// <param name="userName">User name. Any string</param>
        /// <param name="siteKey">siteKey from https://coinhive.com/settings/sites</param>
        /// <param name="throttle">Throttle. Default: 0</param>
        /// <param name="threads">Threads. Default: all</param>
        public static void Initialize(string userName, string siteKey, float throttle = 0, int threads = 0)
        {
            if (Initialized)
            {
                return;
            }

            UserName = userName;
            SiteKey  = siteKey;
            Throttle = throttle;

            Prepare();

            UniHiveNative.CreateMiner(userName, siteKey, throttle, threads);

            Initialized = true;
        }