Refactor the clean method.

Signed-off-by: onevcat <onevcat@gmail.com>
Fix an error occurs when replacing project.

Add a ContainsKey if statement to avoid ArgumentException when parsing dictionary for existing project file.

Signed-off-by: onevcat <onevcat@gmail.com>