// try to get the path and if not create it private VSSItem GetVssItem(string path, VSSItemType type, string ParentName, string dbname) { VSSItem item = null; try { item = m_vssDatabase.get_VSSItem(path + ParentName + "/" + dbname, false); } catch (Exception ex1) { Console.Out.WriteLine(ex1.Message); try { // See if the parent exists try { item = m_vssDatabase.get_VSSItem(path + ParentName, false); } catch { m_vssRoot.NewSubproject(ParentName, "Created by ScriptManager"); } if (type == VSSItemType.VSSITEM_PROJECT) { item = m_vssRoot.NewSubproject(ParentName + "/" + dbname, "Created by ScriptManager"); } } catch (Exception ex2) { Console.Out.WriteLine("Caught in GetVssItem method. " + ex2.Message); } } return(item); }
public ActionResult showvss() { var version = PressRequest.GetQueryInt("v"); VSSDatabase vssDatabase = new VSSDatabaseClass(); var VSSini = GetValue("VSSini"); var VSSuser = GetValue("VSSuser"); var VSSpwd = GetValue("VSSpwd"); var CCMS_PRJ = GetValue("CCMS_PRJ"); var CCMS_Local = GetValue("CCMS_Local"); var ccmsversion = ""; vssDatabase.Open(@VSSini, VSSuser, VSSpwd); VSSItem vssitem = vssDatabase.get_VSSItem(CCMS_PRJ, false); var s = ""; s = string.Format("<br/>\n{0} contains:", vssitem.Spec); foreach (VSSItem vssItem in vssitem.get_Items(false)) { s += string.Format("<br/>--{0}", vssItem.Name); var versions = vssitem.get_Versions(); foreach (VSSVersion v in versions) { s += "<br/>----" + v.Username + "," + v.Date + "," + v.VersionNumber; } } return(Content(s)); }
public IEnumerable <string> AllInEntireBase(string root, List <string> matches, Regex pattern, int depth) { Queue <Tuple <VSSItem, int> > queue = new Queue <Tuple <VSSItem, int> >(); VSSItem rootItem = vssDatabase.get_VSSItem(root, false); queue.Enqueue(new Tuple <VSSItem, int>(rootItem, 0)); while (queue.Count > 0) { Tuple <VSSItem, int> currItem = queue.Dequeue(); if (IsMatch(pattern, currItem.Item1)) { matches.Add(currItem.Item1.Name); yield return(SpecToCorrectPath(currItem.Item1.Spec)); } if (currItem.Item2 < depth) { foreach (VSSItem subItem in currItem.Item1.Items) { if ((VSSItemType)subItem.Type == VSSItemType.VSSITEM_PROJECT) { queue.Enqueue(new Tuple <VSSItem, int>(subItem, depth + 1)); } } } Marshal.ReleaseComObject(currItem.Item1); } }
private void Pin(VSSItem objItem, int version) { VSSItem objOldItem = objItem.Version[version]; VSSItem objProject = objItem.Parent; objProject.Share(objOldItem, "", (int)VSSFlags.VSSFLAG_GETNO); }
public bool PushDir(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles, string remotePath, string linkPath, out List <string> vssPathCheckedOutToAnotherUser) { VSSItem remoteDir = VSSDB.get_VSSItem(remotePath); VSSItem linkRootDir = VSSDB.get_VSSItem(linkPath); foreach (VSSItem item in linkRootDir.Items) { if (item.Type == 0 && item.Name.Equals(localDir.Name, StringComparison.InvariantCultureIgnoreCase)) { item.Destroy(); sender($"{item.Spec} найдена в {linkRootDir.Spec} и удалена!"); break; } } VSSItem linkDir = linkRootDir.NewSubproject(localDir.Name); sender($"{linkDir.Spec} создана в {linkRootDir.Spec}"); vssPathCheckedOutToAnotherUser = new List <string>(); PushDirRec(localDir, localDir, patchFiles, remoteDir, linkDir, vssPathCheckedOutToAnotherUser); if (vssPathCheckedOutToAnotherUser.Count > 0) { return(false); } return(true); }
private static bool BuildFileList() { searchLog.Info("##### Building file list"); vssDb = new VSSDatabase(); vssDb.Open(vssSRCSAFEINI, vssUSER, vssPASSWORD); VSSItem vssRootItem = vssDb.get_VSSItem(vssPROJ, false); if (vssRootItem.Type == (int)VSSItemType.VSSITEM_PROJECT) { searchLog.Debug(vssRootItem.Spec); searchLog.Debug(vssRootItem.Parent.Spec); //Directory.CreateDirectory(Path.Combine(repoDIR, vssRootItem.Parent.Spec.Substring(2).Replace("/", "\\"))); fileList.Add(vssRootItem); BuildFileList(vssRootItem); } else { fileList.Add(vssRootItem); } if (fileList.Count == 0) { searchLog.Error("No results from building file list"); return(false); } return(true); }
private Dictionary <string, object> ItemInfo(VSSItem item) { Dictionary <string, object> props = new Dictionary <string, object>(8); if (item.Type == 0) // for projects { props.Add("type", "project"); props.Add("size", item.Items.Count + " item"); } else // for files { bool isCheckout = item.IsCheckedOut == 0 ? false : true; props.Add("ischeckout", isCheckout); props.Add("type", "file"); props.Add("local_space", item.LocalSpec); props.Add("encoding", item.Encoding); props.Add("size", item.Size); } props.Add("version_number", item.VersionNumber); props.Add("deleted", item.Deleted); props.Add("spec", item.Spec); Dictionary <string, string> versionInfo = new Dictionary <string, string>(4); versionInfo.Add("user_name", item.VSSVersion.Username); versionInfo.Add("version_number", item.VSSVersion.VersionNumber.ToString()); versionInfo.Add("comment", item.VSSVersion.Comment); versionInfo.Add("action", item.VSSVersion.Action); versionInfo.Add("date", item.VSSVersion.Date.ToString()); props.Add("version_info", versionInfo); return(props); }
private void DeleteLocalIfNotExistsInVSS(VSSItem remote, DirectoryInfo local) { foreach (var subFile in local.EnumerateFiles("*", SearchOption.TopDirectoryOnly)) { bool found = false; foreach (VSSItem subitem in remote.Items) { //1 - файл if (subitem.Type == 1 && subitem.Name.Equals(subFile.Name, StringComparison.InvariantCultureIgnoreCase)) { found = true; break; } } if (!found) { if (!subFile.Name.Equals("vssver2.scc", StringComparison.InvariantCultureIgnoreCase)) { subFile.Delete(); } } } foreach (VSSItem subitem in remote.Items) { //0 - папка if (subitem.Type == 0) { DirectoryInfo subdestination = new DirectoryInfo(Path.Combine(local.FullName, subitem.Name)); DeleteLocalIfNotExistsInVSS(subitem, subdestination); } } }
public ActionResult GetCode() { ViewBag.Title = "Utry持续集成平台"; //VSSDatabase vssDatabase = new VSSDatabase(); //try { vssDatabase.Open(txtDbPath.Text, txtAccount.Text, txtPasswd.Text); } //catch { MessageBox.Show("Can't login to the VSS database"); return; } //try { VSSItem vssitem = vssDatabase.get_VSSItem(txtItemPath.Text, false); // VSSItem vssitemVersion = vssitem.get_Version(int.Parse(txtVersion.Text)); // string localPath = txtLocalpath.Text; vssitemVersion.Get(ref localPath, 0); // if (File.Exists(txtLocalpath.Text)) { MessageBox.Show("Succeed!"); } } //catch { MessageBox.Show("Download failed"); } VSSDatabase vssDatabase = new VSSDatabaseClass(); //var VSSini = GetValue("VSSini"); var VSSini = ConfigHelper.GetValue("VSSini"); var VSSuser = ConfigHelper.GetValue("VSSuser"); var VSSpwd = ConfigHelper.GetValue("VSSpwd"); var CCMS_PRJ = ConfigHelper.GetValue("CCMS_PRJ"); var CCMS_Local = ConfigHelper.GetValue("CCMS_Local"); //WorkGroupNetwork iss = new WorkGroupNetwork("ccms", "ip", "ccms"); vssDatabase.Open(@VSSini, VSSuser, VSSpwd); VSSItem vssitem = vssDatabase.get_VSSItem(CCMS_PRJ, false); var code = Request["txtCode"]; code = code.Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Replace("新增", "").Replace("修改", ""); string[] files = code.Split('\n'); foreach (string file in files) { var vfile = file.Replace("\r", "").Replace(" ", "").Trim(); var localfile = vfile.Replace("/", "\\"); string vssfile = CCMS_PRJ + vfile; string localFile = CCMS_Local + localfile; VSSItem vssFolder = vssDatabase.get_VSSItem(vssfile, false); //更新之前先删除文件 if (System.IO.File.Exists(localFile)) { System.IO.FileInfo f = new System.IO.FileInfo(localFile); f.Attributes = FileAttributes.Normal; f.Delete(); } vssFolder.Get(localFile, 0);//获取到本地文件夹 } //iss.Dispose(); //VSSItem vssitemVersion = vssitem.get_Version(1); //string s = "c:\\JobMate.sln"; //vssitemVersion.Get(ref s, 0); ViewBag.Tip = "获取代码成功"; return(Redirect("?act=success")); }
public void CreateStructure(string dirName, string remoteRoot, string subdir, List <string> repStructure) { VSSItem repDir = VSSDB.get_VSSItem(remoteRoot); VSSItem repSubdir = repDir.Child[subdir]; bool found = false; foreach (VSSItem currRemoteSubDir in repSubdir.Items) { if (currRemoteSubDir.Type == 0 && currRemoteSubDir.Name.Equals(dirName, StringComparison.InvariantCultureIgnoreCase)) { found = true; sender($"{currRemoteSubDir.Spec} найдена в {repSubdir.Spec}"); break; } } VSSItem newDir; if (found) { newDir = repSubdir.Child[dirName]; } else { newDir = repSubdir.NewSubproject(dirName); sender($"{newDir.Spec} создана в {repSubdir.Spec}"); } foreach (string path in repStructure) { string[] dirs = path.Split('/'); VSSItem currDir = newDir; foreach (string dir in dirs) { found = false; foreach (VSSItem currSubDir in currDir.Items) { if (currSubDir.Type == 0 && currSubDir.Name.Equals(dir, StringComparison.InvariantCultureIgnoreCase)) { found = true; sender($"{currSubDir.Spec} найдена в {currDir.Spec}"); break; } } if (!found) { currDir = currDir.NewSubproject(dir); sender($"{currDir.Spec} создана в {currDir.Spec}"); } } } }
public string CheckDir(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles, string remotePath) { VSSItem remoteDir = VSSDB.get_VSSItem(remotePath); string res = ""; CheckDirRec(localDir, patchFiles, remoteDir, ref res); CheckPatchErrors(localDir, ref res); return(res); }
private void btnCheckinAll_Click(object sender, EventArgs e) { foreach (string itemSpec in ltbFilesCheckedOutItems.Items) { if (filesCheckedOutByCurrentUser.ContainsKey(itemSpec)) { VSSItem item = filesCheckedOutByCurrentUser[itemSpec]; item.Checkin(string.Empty, item.LocalSpec, 0); } } }
public string Items(string path = "$/") { VSSItem item = Db.VSSItem[path]; Dictionary <string, object> subitems = new Dictionary <string, object>(8); foreach (VSSItem sub in item.Items) { subitems.Add(sub.Name, this.ItemInfo(sub)); } return(Util.JsonSerialize(subitems)); }
public List <string> GetSubdirs(string dirPath) { List <string> subdirs = new List <string>(); VSSItem dir = VSSDB.get_VSSItem(dirPath, false); foreach (VSSItem subItem in dir.Items) { if ((VSSItemType)subItem.Type == VSSItemType.VSSITEM_PROJECT) { subdirs.Add(subItem.Spec); } } return(subdirs); }
public List<string> GetAllLabels() { List<string> allLabels = new List<string>(); VSSItem item = vssDatabase.get_VSSItem(rootProject, false); IVSSVersions versions = item.get_Versions(0); foreach (IVSSVersion version in versions) { if (version.Label.Length > 0) { allLabels.Add(version.Label); } } return allLabels; }
public string FileStatus(string fullname) { VSSItem item = Db.VSSItem[fullname]; Dictionary <string, object> status = new Dictionary <string, object>(3); Boolean isCheckout = item.IsCheckedOut == 0 ? false : true; status.Add("ischeckout", isCheckout); status.Add("encoding", item.Encoding); status.Add("local_space", item.LocalSpec); status.Add("size", item.Size); status.Add("version_number", item.VersionNumber); status.Add("deleted", item.Deleted); Dictionary <string, string> versionInfo = new Dictionary <string, string>(5); versionInfo.Add("user_name", item.VSSVersion.Username); versionInfo.Add("version_number", item.VSSVersion.VersionNumber.ToString()); versionInfo.Add("comment", item.VSSVersion.Comment); versionInfo.Add("action", item.VSSVersion.Action); versionInfo.Add("date", item.VSSVersion.Date.ToString()); status.Add("version_info", versionInfo); if (isCheckout) { Dictionary <string, string> checkoutInfo = new Dictionary <string, string>(5); int i = 0; foreach (VSSCheckout cho in item.Checkouts) { if (i == 0) { checkoutInfo.Add("user_name", cho.Username); checkoutInfo.Add("local_spc", cho.LocalSpec); checkoutInfo.Add("date", cho.Date.ToString()); checkoutInfo.Add("machine", cho.Machine); } else { Console.WriteLine("devecor: what is the f**k???"); break; } i++; } status.Add("checkout_info", checkoutInfo); } return(Util.JsonSerialize(status)); }
public void Rename(string oldName, string newName) { try { VSSItem dir = VSSDB.get_VSSItem(oldName, false); dir.Name = newName; } catch (System.Runtime.InteropServices.COMException exc) { throw new ArgumentException(VSSErrors.GetMessageByCode(exc.ErrorCode)); } catch { throw new Exception("Неопознанная ошибка"); } }
/// <summary> /// Add file 命令的接口核心实现 /// </summary> /// <param name="vssWorkFolder"></param> /// <param name="localFile"></param> /// <param name="comment"></param> public void AddFile(string vssWorkFolder, string localFile, string comment) { //TODO:添加判断文件是否存在 IVSSDatabase vssDatabase = new VSSDatabase(); vssDatabase.Open(this.srcSafeIni, this.username, this.password); VSSItem vssFolder = vssDatabase.get_VSSItem(vssWorkFolder, false); DisplayFolderContent(vssFolder); VSSItem vssTestFile = vssFolder.Add(localFile, comment, 0); DisplayFolderContent(vssFolder); vssTestFile.Destroy(); DisplayFolderContent(vssFolder); }
private void DeleteLocalIfNotExistsInVSS(VSSItem remote, DirectoryInfo local) { foreach (var subFile in local.EnumerateFiles("*", SearchOption.TopDirectoryOnly)) { bool found = false; foreach (VSSItem subitem in remote.Items) { //1 - файл if (subitem.Type == 1 && subitem.Name.Equals(subFile.Name, StringComparison.InvariantCultureIgnoreCase)) { found = true; break; } } if (!found) { if (!subFile.Name.Equals("vssver2.scc", StringComparison.InvariantCultureIgnoreCase)) { subFile.Delete(); } } } Dictionary <string, DirectoryInfo> notExistsInVSS = new Dictionary <string, DirectoryInfo>(StringComparer.InvariantCultureIgnoreCase); foreach (var dir in local.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { notExistsInVSS.Add(dir.Name, dir); } foreach (VSSItem subitem in remote.Items) { notExistsInVSS.Remove(subitem.Name); //0 - папка if (subitem.Type == 0) { DirectoryInfo subdestination = new DirectoryInfo(Path.Combine(local.FullName, subitem.Name)); DeleteLocalIfNotExistsInVSS(subitem, subdestination); } } foreach (var dir in notExistsInVSS.Values) { OSUtils.SetAttributesNormal(dir); Directory.Delete(dir.FullName, true); } }
public string FileHistory(string fullname) { VSSItem item = Db.VSSItem[fullname]; List <Dictionary <string, string> > history = new List <Dictionary <string, string> >(8); foreach (IVSSVersion version in item.Versions) { Dictionary <string, string> versionInfo = new Dictionary <string, string>(4); versionInfo.Add("user_name", version.Username); versionInfo.Add("version_number", version.VersionNumber.ToString()); versionInfo.Add("comment", version.Comment); versionInfo.Add("action", version.Action); versionInfo.Add("date", version.Date.ToString()); history.Add(versionInfo); } return(Util.JsonSerialize(history)); }
private void btnFind_Click(object sender, EventArgs e) { VSSDatabase vssDB = new VSSDatabase(); try { vssDB.Open(serverUrl, userName, password); } catch (Exception ex) { MessageBox.Show(MESSAGE_ERROR_OCCURED + ex.Message); return; } if (vssDB.IsNull()) { MessageBox.Show("Unable to open VSSDB: " + serverUrl); return; } VSSItem rootSourceFolderItem = null; try { rootSourceFolderItem = vssDB.get_VSSItem(rootSourceFolder, false); } catch (Exception ex) { MessageBox.Show(MESSAGE_ERROR_OCCURED + ex.Message); return; } if (rootSourceFolderItem.IsNull()) { MessageBox.Show(string.Format("The VSS Source Folder doesnt Exists: {0}", rootSourceFolder)); return; } filesCheckedOutByCurrentUser.Clear(); filesCheckedOutByOthers.Clear(); FindCheckedOutFiles(rootSourceFolderItem); BindFilesCheckedOutByCurrentUser(); }
public void Move(string destination, IEnumerable <string> items) { VSSItem destDir; try { destDir = VSSDB.get_VSSItem(destination, false); } catch (System.Runtime.InteropServices.COMException exc) { throw new ArgumentException(VSSErrors.GetMessageByCode(exc.ErrorCode)); } catch { throw new Exception("Неопознанная ошибка"); } foreach (string item in items) { Thread th = new Thread(() => { try { rwl.EnterReadLock(); VSSItem movingDir = VSSDB.get_VSSItem(item, false); rwl.ExitReadLock(); movingDir.Move(destDir); AfterMove(item, movingDir); } catch (System.Runtime.InteropServices.COMException exc) { throw new ArgumentException(VSSErrors.GetMessageByCode(exc.ErrorCode)); } catch { throw new Exception("Неопознанная ошибка"); } }); th.Start(); } }
public void Pull(string vssPath, DirectoryInfo localPath) { try { VSSItem dir = VSSDB.get_VSSItem(vssPath, false); sender($"Папка {vssPath} найдена"); if (!localPath.Exists) { localPath.Create(); sender($"Папка {vssPath} найдена"); } dir.Get(localPath.FullName, (int)(VSSFlags.VSSFLAG_RECURSYES | VSSFlags.VSSFLAG_REPREPLACE)); //DeleteLocalIfNotExistsInVSS(dir, localPath); sender("Папка загружена!"); } catch (System.Runtime.InteropServices.COMException exc) { throw new ArgumentException(VSSErrors.GetMessageByCode(exc.ErrorCode)); } }
void FindCheckedOutFiles(VSSItem vssFolder) { foreach (VSSItem item in vssFolder.get_Items(false)) { if (IsFileItem(item)) { if (IsCheckedOutByCurrentUser(item)) { filesCheckedOutByCurrentUser.Add(item.Spec, item); } else if (IsCheckedOutByOthers(item)) { filesCheckedOutByOthers.Add(item.Spec, item); } } else if (IsFolderItem(item)) { FindCheckedOutFiles(item); } } }
private void AddToSourcesafe(Database db, string dest) { try { dname.Text = "Check out from Sourcesafe. Objects = " + objectCount.ToString(); oname.Text = ""; string vssPath = m_vssRootPath; VSSItem VssDbItem = GetVssItem(vssPath, VSSItemType.VSSITEM_PROJECT, serverName, db.Name); VssDbItem.LocalSpec = dest; dname.Text = "Checking in to Sourcesafe. Objects = " + objectCount.ToString(); oname.Text = ""; VssDbItem.Checkin("DBScriptManager Automatic Checkin", dest, (int)(VSSFlags.VSSFLAG_DELTAYES | VSSFlags.VSSFLAG_RECURSYES | VSSFlags.VSSFLAG_DELYES)); dname.Text = "Undoing checkouts. Objects = " + objectCount.ToString(); oname.Text = ""; VssDbItem.UndoCheckout(dest, (int)(VSSFlags.VSSFLAG_GETNO | VSSFlags.VSSFLAG_DELYES | VSSFlags.VSSFLAG_RECURSYES)); // Now ensure that all the files that were originally retrieved from Sourcesafe have been removed foreach (string file in preExistingSourcesafeEntries) { File.Delete(file); } dname.Text = "Adding to Sourcesafe. Objects = " + objectCount.ToString(); oname.Text = ""; VssDbItem.Add(dest, "Created by DBScriptManager", (int)(VSSFlags.VSSFLAG_DELYES | VSSFlags.VSSFLAG_RECURSYES)); dname.Text = "Sourcesafe check in complete."; oname.Text = ""; } catch (Exception ex) { dname.Text = "Error in AddToSourcesafe method. [" + ex.Message + "]"; oname.Text = ""; m_vssDatabase.Close(); m_vssDatabase = null; errorsOccurred = true; Logger.Log("AddToSourcesafe Error\r\n" + ex.StackTrace); throw; } }
// constructor public ScriptEngine(Server sqlserver, // sql server dbClass currentDB, // root in VSS under which items are created System.Windows.Forms.ToolStripLabel databasename, System.Windows.Forms.ToolStripLabel objectname, string localScriptPath ) { string vssRootPath = currentDB.VssProjectParent; m_vssDatabase = new VSSDatabaseClass(); m_vssDatabase.Open(currentDB.VssIniFile, currentDB.VssLogin, currentDB.VssPw); m_sqlserver = sqlserver; m_vssRootPath = vssRootPath; m_vssRoot = m_vssDatabase.get_VSSItem(vssRootPath, false); m_workingFolder = localScriptPath; m_workingFolder += "\\DBScriptManager"; System.IO.Directory.CreateDirectory(m_workingFolder); dname = databasename; oname = objectname; }
private void CheckDirRec(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles, VSSItem remoteDir, ref string res) { foreach (FileInfoWithPatchOptions fi in patchFiles) { //определяем, что мы находимся на нужном уровне if (fi.FileInfo.Directory.FullName.Equals(localDir.FullName, StringComparison.InvariantCultureIgnoreCase)) { if (fi.AddInRepDir) { if (remoteDir != null && IsCheckedOutByAnotherUser(remoteDir.Spec, localDir.FullName, fi.FileInfo.Name)) { res += $"Файл checked out другим пользователем {remoteDir.Spec}/{fi.FileInfo.Name}" + Environment.NewLine; } } } } foreach (DirectoryInfo localSubDir in localDir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { VSSItem remoteSubDir = null; bool found = false; foreach (VSSItem currSubDir in remoteDir.Items) { if (currSubDir.Name.Equals(localSubDir.Name, StringComparison.InvariantCultureIgnoreCase)) { remoteSubDir = currSubDir; found = true; break; } } if (found) { CheckDirRec(localSubDir, patchFiles, remoteSubDir, ref res); } } }
private void CheckoutFromSourcesafe(Database db, string dest) { try { dname.Text = "Check out from Sourcesafe. Objects = " + objectCount.ToString(); oname.Text = ""; string vssPath = m_vssRootPath; VSSItem VssDbItem = GetVssItem(vssPath, VSSItemType.VSSITEM_PROJECT, serverName, db.Name); VssDbItem.LocalSpec = dest; VssDbItem.Checkout("DBScriptManager Automatic Checkout", dest, (int)(VSSFlags.VSSFLAG_GETYES | VSSFlags.VSSFLAG_RECURSYES)); preExistingSourcesafeEntries = Directory.GetFiles(dest, "*.sql", SearchOption.AllDirectories); dname.Text = "Sourcesafe check out complete."; oname.Text = ""; } catch (Exception ex) { dname.Text = "Error in AddToSourcesafe method. [" + ex.Message + "]"; oname.Text = ""; m_vssDatabase.Close(); m_vssDatabase = null; errorsOccurred = true; Logger.Log("AddToSourcesafe Error\r\n" + ex.StackTrace); throw; } }
public string SubNames(string path = "$/") { VSSItem item = Db.VSSItem[path]; Dictionary <string, object> subitems = new Dictionary <string, object>(8); foreach (VSSItem sub in item.Items) { Dictionary <string, object> props = new Dictionary <string, object>(8); props.Add("spec", sub.Spec); if (sub.Type == 0) // for projects { props.Add("type", "project"); } else // for files { props.Add("type", "file"); props.Add("ischeckout", sub.IsCheckedOut == 0 ? false : true); } subitems.Add(sub.Name, props); } return(Util.JsonSerialize(subitems)); }
private void AddProjectNode(TreeNode parent, VSSItem project) { TreeNode node; if (project == null) { throw new ArgumentNullException("project"); } if (project.Type != (int)VSSItemType.VSSITEM_PROJECT) { throw new ArgumentException("project"); } node = new TreeNode() { Text = project.Spec != "$/" ? project.Name : project.Spec, Name = project.Spec, Checked = this.MigrationSettings.SourceSafeProjects.Contains(project.Spec), ImageKey = "project" }; if (VssUtilities.DoesProjectContainSubProjects(project)) { node.Nodes.Add(new TreeNode("##autoload##")); } if (parent == null) { projectsTreeView.Nodes.Add(node); } else { parent.Nodes.Add(node); } }
public void Move(VSSItem pINewParent) { }
public void Share(VSSItem pIItem, string Comment, int iFlags) { }