private static void MakeRecentlyUsed(ProjectInfo project, string fileName) { UsedFile[] usedFiles = ProjectsHistory; bool found = false; foreach (UsedFile usedFile in usedFiles) { if (usedFile.FileName == fileName) { usedFile.LastUsed = DateTime.Now; usedFile.ProjectName = project.Name; found = true; break; } } if (!found) { UsedFile[] temp = usedFiles; usedFiles = new UsedFile[usedFiles.Length + 1]; Array.Copy(temp, usedFiles, temp.Length); UsedFile uf = new UsedFile(fileName, project.Name, DateTime.Now); usedFiles[temp.Length] = uf; } InternalProjectsHistory = usedFiles; }
public int CompareTo(object obj) { UsedFile left = this; UsedFile right = (UsedFile)obj; if (left == null || right == null || left.Equals(right)) { return(0); } return(left.LastUsed.CompareTo(right.LastUsed)); }
private static void MakeRecentlyUsed( ProjectInfo project, string fileName ) { UsedFile[] usedFiles = ProjectsHistory; bool found = false; foreach( UsedFile usedFile in usedFiles ) { if( usedFile.FileName == fileName ) { usedFile.LastUsed = DateTime.Now; usedFile.ProjectName = project.Name; found = true; break; } } if( !found ) { UsedFile[] temp = usedFiles; usedFiles = new UsedFile[ usedFiles.Length + 1]; Array.Copy( temp, usedFiles, temp.Length ); UsedFile uf = new UsedFile( fileName, project.Name, DateTime.Now ); usedFiles[ temp.Length ] = uf; } InternalProjectsHistory = usedFiles; }