예제 #1
0
        public static ReadOnlyFile OpenExisting(string filePath)
        {
            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                throw new ArgumentException("File was not found");
            }
            var document = new ReadOnlyFile(filePath, System.IO.Path.GetFileName(filePath));

            return(document);
        }
예제 #2
0
        public IFile OpenExistingFile(OpenFileArguments arguments)
        {
            if (!File.Exists(arguments.Path))
            {
                throw new FileNotFoundException();
            }
            IFile file;

            if (!arguments.FileDefinition.SupportedFileOperation.HasFlag(SupportedFileOperation.Create))
            {
                file = ReadOnlyFile.OpenExisting(arguments.Path);
            }
            else
            {
                file = StorableFile.OpenExisting(arguments.Path);
            }
            return(file);
        }