public ClassInformationEventArgs(string fileName, ClassUpdateInformation classInformation, Project project) { this.project = project; this.fileName = fileName; this.classInformation = classInformation; }
public ClassUpdateInformation UpdateClassInformation(ClassCollection newClasses, string fileName) { lock (rwlock) { ClassUpdateInformation res = new ClassUpdateInformation (); FileEntry fe = files [fileName] as FileEntry; if (fe == null) return null; bool[] added = new bool [newClasses.Count]; NamespaceEntry[] newNss = new NamespaceEntry [newClasses.Count]; for (int n=0; n<newClasses.Count; n++) { string[] path = newClasses[n].Namespace.Split ('.'); newNss[n] = GetNamespaceEntry (path, path.Length, true, true); } ArrayList newFileClasses = new ArrayList (); if (fe != null) { ClassEntry ce = fe.FirstClass; while (ce != null) { IClass newClass = null; for (int n=0; n<newClasses.Count && newClass == null; n++) { IClass uc = newClasses [n]; if (uc.Name == ce.Name && newNss[n] == ce.NamespaceRef) { newClass = uc; added[n] = true; } } if (newClass != null) { // Class found, replace it ce.Class = CopyClass (newClass); ce.LastGetTime = currentGetTime++; newFileClasses.Add (ce); res.Modified.Add (ce.Class); } else { // Class not found, it has to be deleted, unless it has // been added in another file if (ce.FileEntry == fe) { IClass c = ce.Class; if (c == null) c = ReadClass (ce); res.Removed.Add (c); ce.NamespaceRef.Remove (ce.Name); } } ce = ce.NextInFile; } } if (fe == null) { fe = new FileEntry (fileName); files [fileName] = fe; } for (int n=0; n<newClasses.Count; n++) { if (!added[n]) { IClass c = CopyClass (newClasses[n]); ClassEntry ce = new ClassEntry (c, fe, newNss[n]); ce.LastGetTime = currentGetTime++; newNss[n].Add (c.Name, ce); newFileClasses.Add (ce); res.Added.Add (c); } } fe.SetClasses (newFileClasses); rootNamespace.Clean (); fe.LastParseTime = DateTime.Now; modified = true; Flush (); return res; } }
public void NotifyParseInfoChange(string file, ClassUpdateInformation res, Project project) { ClassInformationEventArgs args = new ClassInformationEventArgs (file, res, project); OnClassInformationChanged (args); }