根据修改次数获取内容文件
本文关键字:文件 获取 修改 | 更新日期: 2023-09-27 18:04:21
我必须在所有内容更改后寻求文件之间的差异,因此我如何才能读取和获取内容,而它们具有相同的路径和目录我必须使用它来实现一个实用程序,从代码
生成统计信息 IList<FileSpec> filesToFind = new List<FileSpec>();
filesToFind.Add( new FileSpec(FileSpec.DepotSpec(dpath).DepotPath, Revision.None));
string[] files = new string[1];
files[0] = dpath;
P4Command command = new P4Command(ps, "where", true, files);
Options opts = new Options();
string v1="", v2="", v3="";
P4CommandResult results = command.Run(opts);
TaggedObjectList list = (results.TaggedOutput);
foreach (TaggedObject obj in list)
{
Console.Out.WriteLine("v1=" + v1 + "hhhhhhhhh1");
int i = 0; string v="";
foreach (String s in obj.Keys)
{
String value = "n/a";
obj.TryGetValue(s, out value);
if (obj.Keys.ElementAt(i).Equals("depotFile"))
v1 = value;
if (obj.Keys.ElementAt(i).Equals("clientFile"))
v2 = value;
if (obj.Keys.ElementAt(i).Equals("path"))
v3 = value;
Console.Out.WriteLine(s + " = " + value);
i++;
}
String path = v3;
if (path==null)
{
Console.WriteLine("Can't' find file, {0}", path);
}
else
{
string extension = Path.GetExtension(path);
if (extension!=null && !("".Equals(extension)))
{
Console.WriteLine("Processing solution file, {0}", path);
FileInfo fi = new FileInfo(path);
using (StreamReader sr = new StreamReader(path, true))
{
Encoding encode = sr.CurrentEncoding;
string line = null;
while ((line = sr.ReadLine()) != null)
{
while (((line = sr.ReadLine()) != null) && (line.Contains("EndGlobalSection") == false))
{
Console.WriteLine(line);
}
}
}
}
}
}
那么文件之间的区别是什么呢例如当一个文件被修改了六次
可以使用p4注释
GetFileAnnotationsCmdOptions gfacmo = new GetFileAnnotationsCmdOptions(GetFileAnnotationsCmdFlags.AllResults, k);