Esempio n. 1
0
        /// <summary>
        /// Opens an existing solution file and parses out the sub projects.
        /// </summary>
        /// <param name = "solutionFile">The file path to the solution file.</param>
        public static Solution OpenSolution(string solutionFile)
        {
            using (var reader = new StreamReader(solutionFile))
            {
                using (var solutionReader = new SolutionReader(reader))
                {
                    var solution = new Solution();
                    solution.FilePath = new FilePath(solutionFile);
                    solution.Name     = solution.FilePath.FileName;
                    solutionReader.InitializeSolution(solution);
                    solution.InitializeEventHandlers();

                    var settingsPath = solution.FilePath.ChangeExtension(".litesettings").FullPath;
                    if (File.Exists(settingsPath))
                    {
                        try
                        {
                            var settings = SolutionSettings.ReadSettings(settingsPath);
                            solution.Settings = settings;
                        }
                        catch
                        {
                            // TODO: notify user
                        }
                    }

                    return(solution);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Opens an existing solution file and parses out the sub projects.
        /// </summary>
        /// <param name = "solutionFile">The file path to the solution file.</param>
        public static Solution OpenSolution(string solutionFile)
        {
            using (var reader = new StreamReader(solutionFile))
            {
                using (var solutionReader = new SolutionReader(reader))
                {
                    var solution = new Solution();
                    solution.FilePath = new FilePath(solutionFile);
                    solution.Name = solution.FilePath.FileName;
                    solutionReader.InitializeSolution(solution);
                    solution.InitializeEventHandlers();

                    var settingsPath = solution.FilePath.ChangeExtension(".litesettings").FullPath;
                    if (File.Exists(settingsPath))
                    {
                        try
                        {
                            var settings = SolutionSettings.ReadSettings(settingsPath);
                            solution.Settings = settings;
                        }
                        catch
                        {
                            // TODO: notify user
                        }
                    }

                    return solution;
                }
            }
        }