BitMaker.Miner.Pool.GetWorkRpc C# (CSharp) Method

GetWorkRpc() public method

Invokes the 'getwork' JSON method and parses the result into a new T:Work instance.
public GetWorkRpc ( IMiner miner, string comment ) : BitMaker.Miner.Work
miner IMiner
comment string
return BitMaker.Miner.Work
        public Work GetWorkRpc(IMiner miner, string comment)
        {
            var req = OpenRpc(miner, comment);
            if (req == null)
                return null;

            // submit method invocation
            using (var txt = new StreamWriter(req.GetRequestStream()))
            using (var wrt = new JsonTextWriter(txt))
            {
                wrt.WriteStartObject();
                wrt.WriteMember("id");
                wrt.WriteString("json");
                wrt.WriteMember("method");
                wrt.WriteString("getwork");
                wrt.WriteMember("params");
                wrt.WriteStartArray();
                wrt.WriteEndArray();
                wrt.WriteEndObject();
                wrt.Flush();
            }

            return ParseGetWork(req.GetResponse());
        }