Ejemplo n.º 1
0
        private IRepositoryFile GetContainedRepositoryFile(IRepositoryFileName fileName)
        {
            IRepositoryFile retval = null;

            if (null != fileName)
            {
                retval = new RepositoryFile(containingFolder: this, fileName: fileName);
            }
            return(retval);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Get next data file in the same repo folder.
        /// </summary>
        /// <param name="backwards">
        ///		The direction in which to look for data file relative to this file: to the past or to the future
        /// </param>
        /// <returns>
        ///		Next data file or <see langword="null"/> if none exists.
        /// </returns>
        public IRepositoryFile GetNext(bool backwards)
        {
            IRepositoryFile retval = null;

            IRepositoryFileName fileInSameFolder = ContainingFolder.GetNextDataFile(this.Name, backwards);

            if (null != fileInSameFolder)
            {
                retval = new RepositoryFile(containingFolder: ContainingFolder, fileName: fileInSameFolder);
            }
            else
            {
                // scanning sibling leaf folders until first data file is found
                for (
                    IDataFolder nextFolder = ContainingFolder.GetNextSiblingInTree(backwards);
                    nextFolder != null && retval == null;
                    nextFolder = nextFolder.GetNextSiblingInTree(backwards))
                {
                    retval = nextFolder.FindFirstDataFile(backwards);
                }
            }

            return(retval);
        }