Using the following to auto create a folder structure but it's only creating the following.
It also adds my text file to the description folder.
No errors.
- ClientName
-ProjectName
--Trunk
---Description
Code: Select all
if (ServerOperations.isConnected())
{
VaultClientFolder folder = ServerOperations.ProcessCommandListFolder("$/", false);
bool hasFolder = false;
foreach(VaultClientFolder dir in folder.Folders)
{
if (dir.Name == clientName)
{
hasFolder = true;
break;
}
}
if (!hasFolder)
{
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName);
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Release");
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Trunk");
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Trunk/Description");
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Trunk/Discovery");
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Trunk/Tools");
ServerOperations.ProcessCommandCreateFolder("$/" + clientName + "/" + projectName + "/Trunk/Dependencies");
string descript = Directory.GetCurrentDirectory() + "\\Description.txt";
if (File.Exists(descript))
{
File.Delete(descript);
}
using (StreamWriter sw = File.CreateText(descript))
{
}
ServerOperations.client.AutoCommit = true;
ServerOperations.ProcessCommandAdd("$/" + clientName + "/" + projectName + "/Trunk/Description", new string[] { descript });
return true;
}
else
{
throw new ArgumentException("Project Base Folder Already Exists");
}
}
else
{
throw new ArgumentException("Could not login to Vault Server");
}