public static void AddFilesOnDisk(this DistributedData distributedData, IEnumerable <string> paths)
 {
     foreach (var path in paths)
     {
         distributedData.AddFileOnDisk(path);
     }
 }
 public static void AddRawSuccDatas(this DistributedData distributedData, IEnumerable <string> rawSuccDatas)
 {
     foreach (var rawSuccData in rawSuccDatas)
     {
         distributedData.AddRawSuccData(rawSuccData);
     }
 }
 public static void AddDataSources <T>(this DistributedData distributedData, IEnumerable <T> sources) where T : ReadableDataFile
 {
     foreach (var source in sources)
     {
         distributedData.AddDataSource(source);
     }
 }
Exemple #4
0
        /// <summary>
        /// Creates a new <see cref="DistributedData"/> by searching a folder for matching SUCC files.
        /// </summary>
        /// <param name="directory">The directory to search.</param>
        /// <param name="searchPattern">The search string to match against the names of files. You do not need to add the ".succ" extension.</param>
        /// <param name="searchOption">How to search the directory."/></param>
        /// <returns></returns>
        public static DistributedData CreateBySearching(DirectoryInfo directory, string searchPattern = "*", SearchOption searchOption = SearchOption.AllDirectories)
        {
            searchPattern = Path.ChangeExtension(searchPattern, Utilities.FileExtension);

            var paths = new List <string>();

            foreach (var fileInfo in directory.EnumerateFiles(searchPattern, searchOption))
            {
                paths.Add(fileInfo.FullName);
            }

            var data = new DistributedData();

            data.AddFilesOnDisk(paths);
            return(data);
        }
 public static void AddRawSuccData(this DistributedData distributedData, string rawSuccData)
 => distributedData.AddDataSource(new MemoryReadOnlyDataFile(rawSuccData));
 public static void AddRawSuccDatas(this DistributedData distributedData, params string[] rawSuccDatas)
 => AddRawSuccDatas(distributedData, (IEnumerable <string>)rawSuccDatas);
 public static void AddFileOnDisk(this DistributedData distributedData, string path)
 => distributedData.AddDataSource(new ReadOnlyDataFile(path));
 public static void AddFilesOnDisk(this DistributedData distributedData, params string[] paths)
 => AddFilesOnDisk(distributedData, (IEnumerable <string>)paths);
 public static void AddDataSources(this DistributedData distributedData, params ReadableDataFile[] sources)
 => AddDataSources(distributedData, (IEnumerable <ReadableDataFile>)sources);