Exemplo n.º 1
0
        public DirectoryMock(DirectoryMock ParentDirectory, string Name)
        {
            this.ParentDirectory = ParentDirectory;
            this.Name = Name;

            Directories = new DirectoryMock[0];
            Files = new FileMock[0];
        }
Exemplo n.º 2
0
        public DirectoryMock AddDirectory(DirectoryMock Directory)
        {
            DirectoryMock[] ArrayCopy = new DirectoryMock[Directories.Length + 1];
            Array.Copy(Directories, ArrayCopy, Directories.Length);
            ArrayCopy[Directories.Length] = Directory;
            Directories = ArrayCopy;

            return Directory;
        }
Exemplo n.º 3
0
 public FileMock(DirectoryMock Parent, string Name, long Length, string Hash)
 {
     this.Name = Name;
     this.Directory = Parent;
     this.Length = Length;
     this.Hash = Hash;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Recursively fixes up the directory tree, giving files and sub-directories a valid DirectoryMock parent.
        /// 
        /// </summary>
        /// <param name="Directory">The directory to fix.</param>
        private void FixupDirectory(DirectoryMock Directory)
        {
            foreach (FileMock File in Directory.Files)
            {
                File.Directory = Directory;
            }

            foreach (DirectoryMock SubDir in Directory.Directories)
            {
                SubDir.ParentDirectory = Directory;
                FixupDirectory(SubDir);
            }
        }
Exemplo n.º 5
0
 public DirectoryMock()
 {
     Directories = new DirectoryMock[0];
     Files = new FileMock[0];
 }
Exemplo n.º 6
0
 public void RemoveDirectory(DirectoryMock Directory)
 {
     Directories = Directories.Except<DirectoryMock>(new DirectoryMock[] { Directory }).ToArray();
 }