예제 #1
0
            public FileSystemFile CreateFile(string name, string content = null)
            {
                if (String.IsNullOrWhiteSpace(name))
                {
                    throw new ArgumentNullException(nameof(name));
                }
                if (Files.ContainsKey(name))
                {
                    throw new InvalidOperationException($"File already exists: {name}");
                }
                if (Folders.ContainsKey(name))
                {
                    throw new InvalidOperationException($"Folder already exists: {name}");
                }

                var file = new FileSystemFile(name, this);

                Files.Add(name, file);

                if (content != null)
                {
                    file.SetContent(content);
                }

                return(file);
            }