void PollForUpdates() { string StreamName; if (!Perforce.GetActiveStream(out StreamName, LogWriter)) { StreamName = null; } // Try to update the zipped binaries list before anything else, because it causes a state change in the UI UpdateZippedBinaries(); while (!bDisposing) { Stopwatch Timer = Stopwatch.StartNew(); // Check we haven't switched streams string NewStreamName; if (Perforce.GetActiveStream(out NewStreamName, LogWriter) && NewStreamName != StreamName) { OnStreamChange(); } // Update the stream list if (StreamName != null) { List <string> NewOtherStreamNames; if (!Perforce.FindStreams(PerforceUtils.GetClientOrDepotDirectoryName(StreamName) + "/*", out NewOtherStreamNames, LogWriter)) { NewOtherStreamNames = new List <string>(); } OtherStreamNames = NewOtherStreamNames; } // Check for any p4 changes if (!UpdateChanges()) { LastStatusMessage = "Failed to update changes"; } else if (!UpdateChangeTypes()) { LastStatusMessage = "Failed to update change types"; } else if (!UpdateZippedBinaries()) { LastStatusMessage = "Failed to update zipped binaries list"; } else { LastStatusMessage = String.Format("Last update took {0}ms", Timer.ElapsedMilliseconds); } // Wait for another request, or scan for new builds after a timeout RefreshEvent.WaitOne(60 * 1000); } }
public bool Run(PerforceConnection Perforce, TextWriter Log, out string ErrorMessage) { if (!Perforce.FindStreams(out Streams, Log)) { ErrorMessage = "Unable to enumerate streams."; return(false); } ErrorMessage = null; return(true); }