예제 #1
0
        private static AbsoluteFfolder GetAbsolute(RelativeFfolder relativeFfolder)
        {
            var             relative = relativeFfolder;
            AbsoluteFfolder absolute = null;

            while (relative != null)
            {
                absolute = relative.Absolute;
                relative = relative.Parent;
            }
            return(absolute);
        }
예제 #2
0
        public RelativeFfolder(RelativeFfolder baseFolder, string name)
        {
            Parent = baseFolder;
            RelativeFfolder parent = Parent;

            while (parent != null)
            {
                if (parent.Absolute != null)
                {
                    Absolute = parent.Absolute;
                    break;
                }
                parent = parent.Parent;
            }
            Name = name;
        }
예제 #3
0
 private IEnumerable <Ffile> GetFiles(IEnumerable <string> fullFilePaths)
 {
     foreach (var fullFilePath in fullFilePaths)
     {
         string filename   = Path.GetFileName(fullFilePath);
         string folderPath = Path.GetDirectoryName(fullFilePath);
         if (folderPath.Length == FullPath.Length)                 // we're in the root
         {
             yield return(new Ffile(this, filename));
         }
         else
         {
             string relativeFolderPath = folderPath.Substring(FullPath.Length + 1);
             var    relativeFolder     = new RelativeFfolder(this, relativeFolderPath);
             yield return(new Ffile(relativeFolder, filename));
         }
     }
 }