namespace Kuineator.Tools
{
    class ProjectManager
    {
        public System.Collections.Generic.List<Project> recentprojects;
        private Project nowproject;

        public ProjectManager()
        {
            recentprojects = new System.Collections.Generic.List<Project>();
        }

        public Project Init(string nowpath, System.Collections.Generic.List<string> paths)
        {
            foreach (string path in paths)
            {
                recentprojects.Add(new Project(path));
            }
            nowproject = new Project(nowpath);
            return nowproject;
        }

        public Project Open(string path)
        {
            foreach (Project pro in recentprojects)
            {
                if (pro.getFilePath() == path)
                {
                    recentprojects.Remove(pro);
                    recentprojects.Add(new Project(nowproject.getFilePath()));
                    nowproject = pro;
                    return pro;
                }
            }
            return null;
        }
        public Project NewOpen(string path)
        {
            recentprojects.Add(new Project(nowproject.getFilePath()));
            nowproject = new Project(path);
            return nowproject;
        }

        public void Exit(System.IO.StreamWriter writer)
        {
            
        }
    }
}
