public void UpdateWorkspaceInfoCache(VersionControlServer versionControl, string ownerName) { InternalServerInfo[] serverInfos = ReadCachedWorkspaceInfo(); XmlElement servers = InitWorkspaceInfoCache(); Workspace[] workspaces = versionControl.QueryWorkspaces(null, ownerName, Name); InternalServerInfo newServerInfo = new InternalServerInfo(versionControl.Uri.ToString(), versionControl.ServerGuid, workspaces); bool found = false; foreach (InternalServerInfo sInfo in serverInfos) { InternalServerInfo finalInfo = sInfo; if (sInfo.Uri == versionControl.Uri) { finalInfo = newServerInfo; found = true; } XmlElement serverInfoElement = finalInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } if (!found) { XmlElement serverInfoElement = newServerInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } SaveWorkspaceInfoCache(servers.OwnerDocument); }
internal void AddCachedWorkspaceInfo(Guid serverGuid, Uri serverUri, Workspace workspace) { InternalServerInfo[] serverInfos = ReadCachedWorkspaceInfo(); XmlElement servers = InitWorkspaceInfoCache(); bool added = false; foreach (InternalServerInfo sInfo in serverInfos) { if (sInfo.Uri == serverUri) { List <WorkspaceInfo> workspaces = new List <WorkspaceInfo>(); foreach (WorkspaceInfo info in sInfo.Workspaces) { workspaces.Add(info); } added = true; workspaces.Add(new WorkspaceInfo(sInfo, workspace)); sInfo.Workspaces = workspaces.ToArray(); } if (sInfo.Workspaces.Length == 0) { continue; } XmlElement serverInfoElement = sInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } if (!added) { InternalServerInfo sInfo = new InternalServerInfo(serverUri.ToString(), serverGuid, workspace); XmlElement serverInfoElement = sInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } SaveWorkspaceInfoCache(servers.OwnerDocument); }
internal void AddCachedWorkspaceInfo(Guid serverGuid, Uri serverUri, Workspace workspace) { InternalServerInfo[] serverInfos = ReadCachedWorkspaceInfo(); XmlElement servers = InitWorkspaceInfoCache(); bool added = false; foreach (InternalServerInfo sInfo in serverInfos) { if (sInfo.Uri == serverUri) { List<WorkspaceInfo> workspaces = new List<WorkspaceInfo>(); foreach (WorkspaceInfo info in sInfo.Workspaces) { workspaces.Add(info); } added = true; workspaces.Add(new WorkspaceInfo(sInfo, workspace)); sInfo.Workspaces = workspaces.ToArray(); } if (sInfo.Workspaces.Length == 0) continue; XmlElement serverInfoElement = sInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } if (!added) { InternalServerInfo sInfo = new InternalServerInfo(serverUri.ToString(), serverGuid, workspace); XmlElement serverInfoElement = sInfo.ToXml(servers.OwnerDocument); servers.AppendChild(serverInfoElement); } SaveWorkspaceInfoCache(servers.OwnerDocument); }