private NewWorkspaceWindow(string ServerAndPort, string UserName, string DefaultStream, PerforceInfoRecord Info, List <PerforceClientRecord> Clients, TextWriter Log) { InitializeComponent(); this.ServerAndPort = ServerAndPort; this.UserName = UserName; this.Info = Info; this.Clients = Clients; this.Log = Log; Dictionary <string, int> RootPathToCount = new Dictionary <string, int>(StringComparer.InvariantCultureIgnoreCase); foreach (PerforceClientRecord Client in Clients) { if (Client.Host == null || String.Compare(Client.Host, Info.HostName, StringComparison.InvariantCultureIgnoreCase) == 0) { if (!String.IsNullOrEmpty(Client.Root) && Client.Root != ".") { string ParentDir; try { ParentDir = Path.GetFullPath(Path.GetDirectoryName(Client.Root)); } catch { ParentDir = null; } if (ParentDir != null) { int Count; RootPathToCount.TryGetValue(ParentDir, out Count); RootPathToCount[ParentDir] = Count + 1; } } } } int RootPathMaxCount = 0; foreach (KeyValuePair <string, int> RootPathPair in RootPathToCount) { if (RootPathPair.Value > RootPathMaxCount) { DefaultRootPath = RootPathPair.Key; RootPathMaxCount = RootPathPair.Value; } } StreamTextBox.Text = DefaultStream ?? ""; StreamTextBox.SelectionStart = StreamTextBox.Text.Length; StreamTextBox.SelectionLength = 0; StreamTextBox.Focus(); UpdateOkButton(); UpdateNameCueBanner(); UpdateRootDirCueBanner(); }
private SelectWorkspaceWindow(PerforceInfoRecord Info, List <PerforceClientRecord> Clients, string WorkspaceName) { InitializeComponent(); this.Info = Info; this.Clients = Clients; this.WorkspaceName = WorkspaceName; UpdateListView(); UpdateOkButton(); }
public bool Info(out PerforceInfoRecord Info, TextWriter Log) { List <Dictionary <string, string> > TagRecords; if (!RunCommand("info -s", out TagRecords, CommandOptions.NoClient, Log) || TagRecords.Count != 1) { Info = null; return(false); } else { Info = new PerforceInfoRecord(TagRecords[0]); return(true); } }
public bool Info(out PerforceInfoRecord Info, TextWriter Log) { List<Dictionary<string, string>> TagRecords; if(!RunCommand("info -s", out TagRecords, CommandOptions.NoClient, Log) || TagRecords.Count != 1) { Info = null; return false; } else { Info = new PerforceInfoRecord(TagRecords[0]); return true; } }