mardi 19 août 2014

copy xml file from depot/main/manifest from perforce using c#


Vote count:

0




i want to download or copy xml file from perforce manifest folder and want to store on my local machine.By using following code i am able to find all the xml files but after that i don't know how to copy that file means i don't know how to get data from xml file and store that into my folder location



public void main()

{

string uri = "hyswp4p1:1666";

string user = "";

string password = "";

string ServerSpec = String.Format("{0}....xml", @"//depot/main/manifest/");

Server server = new Server(new ServerAddress(uri));
Repository rep = new Repository(server);
Connection con = rep.Connection;

con.UserName = user;
con.Client = new Client();
Options options = new Options();
options["Password"] = password;

rep.Connection.Client = new Client();
// connect to the server
rep.Connection.Connect(options);
rep.Connection.Login(password, options);
con.Connect(null);

IList<Perforce.P4.File> target = Perforce.P4.Repository.GetFiles(opts1, fs);

List<FileSpec> filesToFind = new List<FileSpec>();
FileSpec fileToFind = new FileSpec(new DepotPath(ServerSpec), null, null, VersionSpec.Head);
filesToFind.Add(fileToFind);
IList<FileSpec> filesFound = rep.GetDepotFiles(filesToFind, null).ToList();
var Allfiles = (from f in filesFound
select new
{
depotPath = f.DepotPath.Path,
version = ((Revision)f.Version).Rev,
fileSpec = f
}).Distinct().ToList();
int count=0;

foreach (var file in Allfiles)
{
if (count == 10)
break;
string fileExtension = Path.GetExtension(file.depotPath);

//In Allfiles i am able to read files but after that i don't know how to get // //the content of of that file
}
}
please help me on this thanks


asked 1 min ago







copy xml file from depot/main/manifest from perforce using c#

Aucun commentaire:

Enregistrer un commentaire