2012-06-11 3 views
3

나는 PERFORCE 디포의 선택된 디렉토리에 들어있는 파일의 세부 사항으로 콤보 박스를 채우는 프로그램을 가지고있다.필터 P4 .Net 파일 목록

코드의 관련 부분은 이것이다 :

PerforcePath dir = _ctlProductSelect.SelectedItem as PerforcePath; 

_ctlServicePackSelect.Items.Clear(); 

if (dir != null) 
{ 
    foreach (P4.File file in _perforce.GetFiles(null, P4.FileSpec.DepotSpec(dir.Path + "/*.sp"))) 
    { 
     _ctlServicePackSelect.Items.Add(new PerforcePath(file.DepotPath.Path)); 
    } 
} 

문제는이 또한 삭제 된 것으로 표시된 파일이 포함되어 있다는 것입니다. GetFiles 메서드에서 반환 한 목록에서 삭제 된 파일을 필터링 할 수있는 방법이 있습니까? P4_dotNet API 문서에서 의심되는 용의자를 찾을 수 없습니다. P4API.NET를 사용

+0

'File' 개체의'LocalPath' 또는'ClientPath' 속성을 검사하여 파일이 삭제되었는지 확인하려고 했습니까? –

답변

1

, 당신은 추가 할 수 있습니다 -e 옵션 GetFiles에 :


IList filesToFind = new List(); 
FileSpec fileToFind = new FileSpec(new DepotPath("//depot/..."), null, null, VersionSpec.Head); 
filesToFind.Add(fileToFind); 
Options o = new Options(); 
o.Add("-e", ""); 
IList filesFound = pRep.GetFiles(filesToFind, o);
0

나는 결국 foreach 루프 inisde이 작업을 수행하는 것이 었습니다 워킹있어 무엇 :

foreach (P4.File file in _perforce.GetFiles(null, P4.FileSpec.DepotSpec(dir.Path + "/*.sp"))) 
{ 
    if (_perforce.GetFileMetaData(null, file)[0].HeadAction.ToString() != "MoveDelete") 
    _ctlServicePackSelect.Items.Add(new PerforcePath(file.DepotPath.Path)); 
} 

은 기본적으로 메타 데이터를 확인 콤보 상자에 추가하기 전에 각 파일에 대해

0
IList<FileSpec> filesToFind = new List<FileSpec>(); 
FileSpec fileToFind = new FileSpec(FileSpec.DepotSpec("//depot/...").DepotPath, Revision.Head); 
filesToFind.Add(fileToFind); 
Options o = new Options(); 

o.Add("-m", "changelistid"); 
IList<File> FilesFound = rep.GetFiles(filesToFind, o) 
+0

** 작품 ** – gasroot