public ProjectItem this[string key] { get { return(IncludedFiles.FirstOrDefault(x => x.RelativePath == key)); } }
public void RenameFile(string filepath, string oldname, string newname) { var entry = IncludedFiles.FirstOrDefault(x => x.RealPath == filepath || x.RelativePath == filepath); entry.RelativePath = entry.RelativePath.Replace(oldname, newname); entry.RealPath = entry.RealPath.Replace(oldname, newname); if (entry.RealPath.EndsWith(".fitproj")) { File.Move(entry.RealPath, entry.RealPath.Remove(Runtime.CanonicalizePath(entry.RealPath).LastIndexOf(Path.DirectorySeparatorChar)) + newname + ".fitproj"); } else { File.Move(filepath, entry.RealPath); } SaveProject(); }