Beispiel #1
0
        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));
        }
Beispiel #2
0
 public Present Evaluate(Present[] paramList)
 {
     if (paramList[0] is PresentFailureCode)
     {
         return(new PresentFailureCode((PresentFailureCode)paramList[0], "ApplyVerbPresent"));
     }
     if (!(paramList[0] is VerbPresent))
     {
         return(PresentFailureCode.FailedCast(paramList[0], "ApplyVerbPresent"));
     }
     Present[] array = new Present[paramList.Length - 1];
     Array.Copy(paramList, 1, array, 0, paramList.Length - 1);
     return(((VerbPresent)paramList[0]).Evaluate(array));
 }
Beispiel #3
0
        public Present Evaluate(Present[] paramList)
        {
            if (!(paramList[0] is IntParameter))
            {
                return(PresentFailureCode.FailedCast(paramList[0], "FoxitOpenDocument.Evaluate"));
            }

            switch (((IntParameter)paramList[0]).value)
            {
            case 0:
            {
                D.Assert(paramList.Length == 5);
                MapRectangleParameter mapRectangleParameter = (MapRectangleParameter)paramList[1];
                SizeParameter         sizeParameter         = (SizeParameter)paramList[2];
                BoolParameter         boolParameter         = (BoolParameter)paramList[3];
                BoolParameter         boolParameter2        = (BoolParameter)paramList[4];
                return(Render(mapRectangleParameter.value,
                              sizeParameter.value,
                              boolParameter.value,
                              boolParameter2.value));
            }

            case 1:
                D.Assert(paramList.Length == 1);
                return(FetchBounds());

            case 2:
                D.Assert(paramList.Length == 2);
                return(new IntParameter(5));

            case 3:
                D.Assert(paramList.Length == 1);
                if (BuildConfig.theConfig.suppressFoxitMessages)
                {
                    return(new StringParameter(null));
                }

                return(new StringParameter("MapCruncher PDF rendering powered by Foxit Software Company"));

            default:
                return(new PresentFailureCode("Invalid AccessVerb"));
            }
        }
Beispiel #4
0
        public Present Evaluate(Present[] paramList)
        {
            if (!(paramList[0] is IntParameter))
            {
                return(PresentFailureCode.FailedCast(paramList[0], "FoxitOpenDocument.Evaluate"));
            }

            switch (((IntParameter)paramList[0]).value)
            {
            case 0:
            {
                D.Assert(paramList.Length == 5);
                MapRectangleParameter mapRectangleParameter = (MapRectangleParameter)paramList[1];
                SizeParameter         sizeParameter         = (SizeParameter)paramList[2];
                BoolParameter         boolParameter         = (BoolParameter)paramList[3];
                BoolParameter         boolParameter2        = (BoolParameter)paramList[4];
                return(Render(mapRectangleParameter.value,
                              sizeParameter.value,
                              boolParameter.value,
                              boolParameter2.value));
            }

            case 1:
                D.Assert(paramList.Length == 1);
                return(FetchBounds());

            case 2:
            {
                D.Assert(paramList.Length == 2);
                SizeParameter sizeParameter2 = (SizeParameter)paramList[1];
                return(ImageDetail(sizeParameter2.value));
            }

            case 3:
                D.Assert(paramList.Length == 1);
                return(new StringParameter(null));

            default:
                return(new PresentFailureCode("Invalid AccessVerb"));
            }
        }