/// <summary> /// checks a url for all EXEs with version numbers. /// Finds highest version number and alerts if local version number is different /// </summary> /// <param name="Program"></param> /// <param name="ProgramUrl"></param> /// <param name="path"></param> /// <param name="checktradelink"></param> /// <param name="checkbrokerserver"></param> public static void UpgradeAlert(string Program, string ProgramUrl, bool checktradelink, bool checkbrokerserver, TLClient_WM tl) { if (Program != null) { WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); int current = Util.BuildFromRegistry(Program); if (current == 0) { string path = Util.ProgramPath(Program); current = Util.BuildFromFile(path + "\\VERSION.txt"); } if (current != 0) wc.DownloadStringAsync(new Uri(ProgramUrl), new verstate(Program, ProgramUrl, current)); } if (checktradelink) { WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); int current = Util.BuildFromRegistry(Util.PROGRAM); if (current!=0) wc.DownloadStringAsync(new Uri(TLSITEURL), new verstate(Util.PROGRAM,TLSITEURL, current)); } if (checkbrokerserver) { WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); int current = ((tl == null) || (tl.ProvidersAvailable.Length==0)) ? 0 : tl.ServerVersion; if (current!=0) wc.DownloadStringAsync(new Uri(TLSITEURL), new verstate(BROKERSERVER, TLSITEURL, current)); } }
public void ProvidersUpdate() { TLClient_WM tl = new TLClient_WM(false); _pavail = tl.ProvidersAvailable; tl.Disconnect(); }
TLClient getsearchclient() { if (!IPUtil.hasValidAddress(_servers)) { TLClient tmp = new TLClient_WM(false); tmp.VerboseDebugging = VerboseDebugging; tmp.SendDebugEvent += new DebugDelegate(debug); return(tmp); } else { TLClient_IP tmp = new TLClient_IP(_servers, _port); tmp.VerboseDebugging = VerboseDebugging; tmp.SendDebugEvent += new DebugDelegate(debug); return(tmp); } }
/// <summary> /// reconnect/refresh now /// </summary> public void Reconnect() { TLClient_WM tl = (TLClient_WM)_tl; bool success = _tl.Mode(provindex(), false); // change in connect status (eg fail->success) if (success) { if (GotDebug != null) { GotDebug("Broker " + _tl.ProvidersAvailable[_tl.ProviderSelected].ToString() + " connection refresh at " + _lastalert); } if (GotConnect != null) { GotConnect(); } } _connected = success; }
public TestTradeLink_WM() { s = new TLServer_WM(); c = new TLClient_WM("testtradelink",false); // create a second client to verify order and fill copying work c2 = new TLClient_WM("client2", false); // register server events (so server can process orders) s.newSendOrderRequest += new OrderDelegate(tl_gotSrvFillRequest); // setup client events c.gotFill += new FillDelegate(tlclient_gotFill); c.gotOrder += new OrderDelegate(tlclient_gotOrder); c.gotTick += new TickDelegate(tlclient_gotTick); c.gotImbalance += new ImbalanceDelegate(c_gotImbalance); // setup second client events to check copying c2.gotFill += new FillDelegate(c2_gotFill); c2.gotOrder += new OrderDelegate(c2_gotOrder); c2.gotTick += new TickDelegate(c2_gotTick); }
public static bool ExistsNewVersions(TLClient_WM tl, bool displayalert) { bool t = ExistsNewTLS(); bool b = ExistsNewBS(tl); List <string> p = new List <string>(); if (t) { p.Add(Util.TRADELINKSUITE); } if (b) { p.Add(Util.BROKERSERVER); } if ((t || b) && displayalert) { string ps = string.Join(",", p.ToArray()); NewVersion nv = new NewVersion(ps, "http://tradelink.googlecode.com", "Grab new versions of: " + ps + Environment.NewLine + "Or run TradeLink Update."); nv.Show(); } return(t || b); }
public TestTradeLink_WM() { s = new TLServer_WM(); s.newProviderName = Providers.TradeLink; s.newUnknownRequest += new UnknownMessageDelegate(s_newUnknownRequest); // make sure we select our own loopback, if other servers are running c = new TLClient_WM(false); int pi = -1; for (int i = 0; i < c.ProvidersAvailable.Length; i++) { long v = c.TLSend(MessageTypes.LOOPBACKSERVER, string.Empty, i); if (v==SPECIAL) pi = i; } if (pi == -1) throw new Exception("unable to find test server"); c.Mode(pi, false); // create a second client to verify order and fill copying work c2 = new TLClient_WM(false); c2.Mode(pi, false); // register server events (so server can process orders) s.newSendOrderRequest += new OrderDelegateStatus(tl_gotSrvFillRequest); // setup client events c.gotFill += new FillDelegate(tlclient_gotFill); c.gotOrder += new OrderDelegate(tlclient_gotOrder); c.gotTick += new TickDelegate(tlclient_gotTick); c.gotImbalance += new ImbalanceDelegate(c_gotImbalance); c.gotUnknownMessage+=new MessageDelegate(c_gotUnknownMessage); // setup second client events to check copying c2.gotFill += new FillDelegate(c2_gotFill); c2.gotOrder += new OrderDelegate(c2_gotOrder); c2.gotTick += new TickDelegate(c2_gotTick); }
/// <summary> /// Returns true if a newer version of brokerserver exists. /// </summary> /// <param name="tl"></param> /// <returns></returns> public static bool ExistsNewBS(TLClient_WM tl) { if (tl == null) { return(false); } if (tl.LinkType == TLTypes.NONE) { return(false); } int latest = 0; if (tl.LinkType == TLTypes.HISTORICALBROKER) { latest = LatestVersion(Util.TRADELINKSUITE); } else { latest = LatestVersion(Util.BROKERSERVER); } int thisver = tl.ServerVersion; return(latest > thisver); }
/// <summary> /// Returns true if a newer version of brokerserver exists. /// </summary> /// <param name="tl"></param> /// <returns></returns> public static bool ExistsNewBS(TLClient_WM tl) { if (tl == null) return false; if (tl.LinkType == TLTypes.NONE) return false; int latest = 0; if (tl.LinkType== TLTypes.HISTORICALBROKER) latest = LatestVersion(Util.TRADELINKSUITE); else latest = LatestVersion(Util.BROKERSERVER); int thisver = tl.ServerVersion; return latest > thisver; }
public void setup() { //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); if (!isserverconok) { server = new TradeLink.Common.TLServer_WM(); con = new IQFeedHelper(server); con.VerboseDebugging = verbosesetting; con.SendDebug += new DebugDelegate(g.d); // get login information var data = Util.getfile(loginfile, g.d); Assert.IsFalse(string.IsNullOrWhiteSpace(data), "no login info"); var li = data.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Assert.AreEqual(3, li.Length, "missing login info"); // attempt to startup connection con.Start(li[userr], li[pwr], li[prodr], Util.TLBuild()); // wait a moment Util.sleep(4000); Assert.IsTrue(isserverconok, "server connection failed"); } if (isserverconok && !isclientconok) { var c = new TLClient_WM("tempiqclient", false); c.VerboseDebugging = verbosesetting; c.SendDebugEvent += new DebugDelegate(g.d); if (c.ProvidersAvailable[0]!= Providers.IQFeed) throw new Exception("unable to find test server"); c.Mode(0, false); client = c; client.gotUnknownMessage += new MessageDelegate(client_gotUnknownMessage); // verify Assert.IsTrue(isclientconok, "client connection failed"); } // reset everything mt = new MessageTracker(); mt.VerboseDebugging = verbosesetting; blt = new BarListTracker(); mt.BLT = blt; mt.SendDebug += new DebugDelegate(g.d); mt.GotNewBar += new SymBarIntervalDelegate(mt_GotNewBar); recvbarcount = 0; msgok = true; g.d("iqfeed started."); // wait a moment Util.sleep(1000); }
void bw_DoWork(object sender, DoWorkEventArgs e) { TLClient tl = new TLClient_WM(false); // check for new versions Versions.UpgradeAlert(tl,true); tl.Disconnect(); }
public static void UpgradeAlert(TLClient_WM tl) { UpgradeAlert(null, null, true, true, tl); }
/// <summary> /// Check for new versions of suite and brokerserver, option to display a dialog box to user if there are /// </summary> /// <param name="tl"></param> /// <returns></returns> public static bool ExistsNewVersions(TLClient_WM tl) { return(ExistsNewVersions(tl, true)); }
public static bool ExistsNewVersions(TLClient_WM tl, bool displayalert) { bool t = ExistsNewTLS(); bool b = ExistsNewBS(tl); List<string> p = new List<string>(); if (t) p.Add(Util.TRADELINKSUITE); if (b) p.Add(Util.BROKERSERVER); if ((t || b) && displayalert) { string ps = string.Join(",",p.ToArray()); NewVersion nv = new NewVersion(ps, "http://tradelink.googlecode.com", "Grab new versions of: " + ps+Environment.NewLine+"Or run TradeLink Update."); nv.Show(); } return t || b; }
public static void UpgradeAlert(string Program, string ProgramUrl, TLClient_WM tl) { UpgradeAlert(Program, ProgramUrl, true, true, tl); }
public void ProvidersUpdate() { TLClient_WM tl = new TLClient_WM(false); _pavail = tl.ProvidersAvailable; tl.Disconnect(); }
public static bool ExistsNewBS(TLClient_WM tl) { if (tl == null) return false; if (tl.ProvidersAvailable.Length==0) return false; int latest = LatestVersion(Util.PROGRAM); int thisver = tl.ServerVersion; return latest > thisver; }
TLClient getsearchclient() { if (!IPUtil.hasValidAddress(_servers)) { TLClient tmp = new TLClient_WM(false); tmp.VerboseDebugging = VerboseDebugging; tmp.SendDebugEvent+=new DebugDelegate(debug); return tmp; } else { TLClient_IP tmp = new TLClient_IP(_servers, _port); tmp.VerboseDebugging = VerboseDebugging; tmp.SendDebugEvent+=new DebugDelegate(debug); return tmp; } }
/// <summary> /// Check for new versions of suite and brokerserver, option to display a dialog box to user if there are /// </summary> /// <param name="tl"></param> /// <returns></returns> public static bool ExistsNewVersions(TLClient_WM tl) { return ExistsNewVersions(tl, true); }
public Form1() { InitializeComponent(); tc = new TLClient_WM(); tc.gotTick += gotTick; }