public bool Load() { JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <string, object> json; try { json = serializer.Deserialize <dynamic>(File.ReadAllText("proxy.txt")); bool ssl = false; bool.TryParse(json["ssl"].ToString(), out ssl); IsSSL = ssl; // Local server LocalHost = json["local_host"].ToString(); try { string[] localHost = LocalHost.Split(':'); LocalHostEndPoint = new IPEndPoint(Dns.GetHostEntry(localHost[0]).AddressList[0], int.Parse(localHost[1])); } catch (Exception e) { Console.WriteLine("\"local_host\" value is invalid!"); Console.WriteLine($" Exception: {e}"); } // Remote pool PoolAddress = json["pool_address"].ToString(); try { string[] remoteHost = PoolAddress.Split(':'); PoolEndPoint = new IPEndPoint(Dns.GetHostEntry(remoteHost[0]).AddressList[0], int.Parse(remoteHost[1])); } catch (Exception e) { Console.WriteLine("\"pool_address\" value is invalid!"); Console.WriteLine($" Exception: {e}"); } // Set wallet Wallet = json["wallet"].ToString().Trim(); // Worker name if (json.ContainsKey("worker") && json["worker"] != null) { Worker = json["worker"].ToString(); } else { Worker = null; } return(true); } catch { return(false); } }
public void SetPoolAddres(ref PoolAddress poolAddress) { m_address = poolAddress; }