/// <summary>
        /// Initializes a new instance of the <see cref="XmlSettingsManager"/> class. 
        /// </summary>
        /// <param name="solutionFilePath">Path to the VS solution file (.sln).</param>
        public XmlSettingsManager(string solutionFilePath)
        {
            if (string.IsNullOrEmpty(solutionFilePath))
                throw new ArgumentException("solutionFilePath is null or empty!");

            if (!File.Exists(solutionFilePath))
                throw new ArgumentException("The provided solution file does not exist: " + solutionFilePath);

            _solutionFilePath = solutionFilePath;
            _solutionLoadInfo = ReadSettings() ?? CreateDefaultSolutionSettings();
        }
示例#2
0
            public static void Serialize(SolutionLoadInfo solutionLoadInfo, string filePath)
            {
                if (solutionLoadInfo == null)
                {
                    throw new ArgumentNullException(nameof(solutionLoadInfo));
                }

                var serializer = new XmlSerializer(typeof(SolutionLoadInfo));

                using (var fileStream = File.Create(filePath))
                    serializer.Serialize(fileStream, solutionLoadInfo);
            }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlSettingsManager"/> class.
        /// </summary>
        /// <param name="solutionFilePath">Path to the VS solution file (.sln).</param>
        public XmlSettingsManager(string solutionFilePath)
        {
            if (string.IsNullOrEmpty(solutionFilePath))
            {
                throw new ArgumentException("solutionFilePath is null or empty!");
            }

            if (!File.Exists(solutionFilePath))
            {
                throw new ArgumentException("The provided solution file does not exist: " + solutionFilePath);
            }

            _solutionFilePath = solutionFilePath;
            _solutionLoadInfo = ReadSettings() ?? CreateDefaultSolutionSettings();
        }
            public static void Serialize(SolutionLoadInfo solutionLoadInfo, string filePath)
            {
                if (solutionLoadInfo == null)
                    throw new ArgumentNullException(nameof(solutionLoadInfo));

                var serializer = new XmlSerializer(typeof(SolutionLoadInfo));
                using (var fileStream = File.Create(filePath))
                    serializer.Serialize(fileStream, solutionLoadInfo);
            }