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); }
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); }