Beispiel #1
0
        private SourceDirectory(string path, SourceDirectory parent)
            : base(path)
        {
            if (!Directory.Exists(Path))
            {
                // The path is not a valid directory
                throw new ArgumentException(
                          $"The parameter {nameof(path)} must be a valid directory",
                          nameof(path));
            }

            Parent = parent;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SourceFile"/> class.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="directory"></param>
        public SourceFile(string path, SourceDirectory directory)
            : base(path)
        {
            if (!File.Exists(path) || !IsSupported(path))
            {
                // The path is not a valid file
                throw new ArgumentException(
                          $"The parameter {nameof(path)} must be a valid file.",
                          nameof(path));
            }
            if (directory == null)
            {
                throw new ArgumentNullException(nameof(directory));
            }

            Directory = directory;
        }