コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Workstation.cs プロジェクト: Jeff-Lewis/opentf
        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);
        }
コード例 #4
0
ファイル: Workstation.cs プロジェクト: Jeff-Lewis/opentf
        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);
        }