コード例 #1
0
        /// <summary>
        /// Loads the content of a folder in the file directory to a VDKeyedCollection
        /// </summary>
        /// <param name="dirPath">The absolute path to the version directory in which all files are contained</param>
        /// <param name="filePath">The relative path to a file or directory from dirpath</param>
        /// <param name="loadData">Whether or not to read the files</param>
        /// <param name="directory">The content directory from which to read</param>
        /// <param name="changelog">An optional Changelog parameter to fill in hashes</param>
        private static VDKeyedCollection GetVersionDatas(string dirPath, string filePath, bool loadData,
                                                         DirectoryStructure directory, Changelog changelog)
        {
            string            path  = Path.Combine(dirPath, filePath);
            VDKeyedCollection datas = new VDKeyedCollection();
            //Add all the directories
            IEnumerable <string> directoryNames = System.IO.Directory.EnumerateDirectories(path).Select(Path.GetFileName);

            foreach (string dir in directoryNames)
            {
                string dp = Path.Combine(filePath, dir);
                datas.Add(LoadVersionData(dirPath, dp, loadData, directory, changelog));
            }
            //Add all the files
            IEnumerable <string> fileNames = System.IO.Directory.EnumerateFiles(path).Select(Path.GetFileName);

            foreach (string file in fileNames)
            {
                string fp = Path.Combine(filePath, file);
                datas.Add(LoadVersionData(dirPath, fp, loadData, directory, changelog));
            }
            return(datas);
        }