public override Present Realize(string refCredit) { Present present = documentFuture.Realize(refCredit); if (!(present is SourceDocument)) { return(PresentFailureCode.FailedCast(present, "FetchDocumentFuture")); } SourceDocument sourceDocument = (SourceDocument)present; string filesystemAbsolutePath = sourceDocument.localDocument.GetFilesystemAbsolutePath(); Present[] paramList = new Present[] { new StringParameter(filesystemAbsolutePath), new IntParameter(sourceDocument.localDocument.GetPageNumber()) }; string text = Path.GetExtension(filesystemAbsolutePath).ToLower(); if (text[0] == '.') { text = text.Substring(1); } Verb verb = null; string a = null; if (knownExtensions.ContainsKey(text)) { a = knownExtensions[text]; } if (a == "FoxIt") { verb = new FoxitOpenVerb(); } else { if (a == "WPF") { verb = new WPFOpenVerb(); } else { if (a == "GDI") { verb = new GDIOpenVerb(); } } } if (verb == null) { return(new PresentFailureCode(new UnknownImageTypeException("Unknown file type " + text))); } return(verb.Evaluate(paramList)); }
public SourceDocument RealizeSynchronously(CachePackage cachePackage) { Present present = this.GetSynchronousFuture(cachePackage).Realize("SourceDocument.RealizeSynchronously"); if (present is SourceDocument) { SourceDocument sourceDocument = (SourceDocument)present; D.Assert(sourceDocument.localDocument != null, "We waited for document to arrive synchronously."); return(sourceDocument); } throw ((PresentFailureCode)present).exception; }