|
|
|
@ -362,6 +362,15 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
return FindFile(fileName) != null; |
|
|
|
return FindFile(fileName) != null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, FileProjectItem> findFileCache; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal protected void ClearFindFileCache() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
lock (SyncRoot) { |
|
|
|
|
|
|
|
findFileCache = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Returns the project item for a specific file; or null if the file is not found in the project.
|
|
|
|
/// Returns the project item for a specific file; or null if the file is not found in the project.
|
|
|
|
/// This member is thread-safe.
|
|
|
|
/// This member is thread-safe.
|
|
|
|
@ -370,12 +379,21 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
public FileProjectItem FindFile(string fileName) |
|
|
|
public FileProjectItem FindFile(string fileName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
lock (SyncRoot) { |
|
|
|
lock (SyncRoot) { |
|
|
|
return Linq.Find(Linq.OfType<FileProjectItem>(this.Items), |
|
|
|
if (findFileCache == null) { |
|
|
|
delegate(FileProjectItem item) { |
|
|
|
findFileCache = new Dictionary<string, FileProjectItem>(StringComparer.InvariantCultureIgnoreCase); |
|
|
|
return FileUtility.IsEqualFileName(item.FileName, fileName); |
|
|
|
foreach (ProjectItem item in this.Items) { |
|
|
|
}); |
|
|
|
FileProjectItem fileItem = item as FileProjectItem; |
|
|
|
// return this.Items.OfType<FileProjectItem>().Find(
|
|
|
|
if (fileItem != null) { |
|
|
|
// item => FileUtility.IsEqualFileName(item.FileName, outputFileName));
|
|
|
|
findFileCache[item.FileName] = fileItem; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
fileName = Path.GetFullPath(fileName); |
|
|
|
|
|
|
|
} catch {} |
|
|
|
|
|
|
|
FileProjectItem outputItem; |
|
|
|
|
|
|
|
findFileCache.TryGetValue(fileName, out outputItem); |
|
|
|
|
|
|
|
return outputItem; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|