Пример #1
0
        /// <summary>
        ///		Load folder configuration from config file
        /// </summary>
        /// <param name="filePath">
        ///		Configuration file full path
        /// </param>
        /// <returns>
        ///		null if file does not exist
        /// </returns>
        public static RepoFolderXmlConfig Load(string filePath, IFileProvider fileProvider)
        {
            RepoFolderXmlConfig retval;

            if (fileProvider.Exists(filePath))
            {
                XmlSerializer serialiser = new XmlSerializer(typeof(RepoFolderXmlConfig));
                using (FileStream stream = fileProvider.Open(filePath, FileMode.Open, FileAccess.Read))
                {
                    retval = (RepoFolderXmlConfig)serialiser.Deserialize(stream);
                }
            }
            else
            {
                // empty config
                retval = new RepoFolderXmlConfig();
            }
            return(retval);
        }
Пример #2
0
        /// <summary>
        ///		Load properties from disk.
        /// </summary>
        public void Load()
        {
            RepositoryFolder.CheckNotDetached(_folder);

            _folderConfig = RepoFolderXmlConfig.Load(this.ConfigFilePath, this.FileProvider);
        }