Esempio n. 1
0
        public static PDFDirect CreateDirect(PDFObjectType type)
        {
            PDFObjectType type1 = type;

            switch (type1)
            {
            case PDFObjectType.tPDFNull:
            {
                goto Label_0060;
            }

            case PDFObjectType.tPDFInteger:
            {
                goto Label_004D;
            }

            case PDFObjectType.tPDFFixed:
            {
                goto Label_003E;
            }

            case PDFObjectType.tPDFBoolean:
            {
                goto Label_0031;
            }

            case PDFObjectType.tPDFName:
            {
                goto Label_0055;
            }

            case PDFObjectType.tPDFString:
            {
                goto Label_0066;
            }

            case PDFObjectType.tPDFDict:
            {
                goto Label_0038;
            }

            case PDFObjectType.tPDFArray:
            {
                goto Label_002A;
            }
            }
            goto Label_0071;
Label_002A:
            return(Library.CreateArray(0));

Label_0031:
            return(Library.CreateBoolean(false));

Label_0038:
            return(Library.CreateDict());

Label_003E:
            return(Library.CreateFixed(0f));

Label_004D:
            return(Library.CreateInteger(((long)0)));

Label_0055:
            return(Library.CreateName(""));

Label_0060:
            return(Library.CreateNull());

Label_0066:
            return(Library.CreateString(""));

Label_0071:
            throw new ArgumentOutOfRangeException("type", type, "Invalid direct type");
        }
Esempio n. 2
0
        protected internal virtual PDFDirect CopyHandlerDirect(PDFDirect src, CopyHandlerDelegate ch)
        {
            PDFObject obj1;
            PDFArray  array1;
            PDFArray  array2;
            int       num1;
            PDFDict   dict1;
            PDFDict   dict2;
            PDFStream stream1;
            PDFStream stream2;

            if (ch != null)
            {
                obj1 = ch.Invoke(this.dstDoc, src);
                if ((obj1 is PDFDirect))
                {
                    src = ((PDFDirect)obj1);
                }
                else
                {
                    throw new PDFException("Can\'t convert direct into indirect");
                }
            }
            PDFObjectType type1 = src.PDFType;

            switch (type1)
            {
            case PDFObjectType.tPDFNull:
            {
                goto Label_0155;
            }

            case PDFObjectType.tPDFInteger:
            {
                goto Label_0133;
            }

            case PDFObjectType.tPDFFixed:
            {
                goto Label_0122;
            }

            case PDFObjectType.tPDFBoolean:
            {
                goto Label_00A2;
            }

            case PDFObjectType.tPDFName:
            {
                goto Label_0144;
            }

            case PDFObjectType.tPDFString:
            {
                goto Label_01E7;
            }

            case PDFObjectType.tPDFDict:
            {
                dict1 = (src as PDFDict);
                dict2 = Library.CreateDict();
                foreach (PDFName name1 in dict1.Keys)
                {
                    dict2[name1.Value] = this.CopyHandler(dict1[name1, 0], ch);
                }
                return(dict2);
            }

            case PDFObjectType.tPDFArray:
            {
                array1 = (src as PDFArray);
                array2 = Library.CreateArray(array1.Count);
                num1   = 0;
                goto Label_0097;
            }

            case PDFObjectType.tPDFStream:
            {
                stream1 = (src as PDFStream);
                stream2 = Library.CreateStream();
                foreach (PDFName name2 in stream1.Dict.Keys)
                {
                    stream2.Dict[name2.Value] = this.CopyHandler(stream1.Dict[name2, 0], ch);
                }
                stream2.SetRawStream(stream1.Decrypt());
                return(stream2);
            }
            }
            goto Label_01F8;
Label_007D:
            array2[num1] = this.CopyHandler(array1[num1, 0], ch);
            num1        += 1;
Label_0097:
            if (num1 < array1.Count)
            {
                goto Label_007D;
            }
            return(array2);

Label_00A2:
            return(Library.CreateBoolean((src as PDFBoolean).Value));

Label_0122:
            return(Library.CreateFixed((src as PDFFixed).Value));

Label_0133:
            return(Library.CreateInteger((src as PDFInteger).Value));

Label_0144:
            return(Library.CreateName((src as PDFName).Value));

Label_0155:
            return(Library.CreateNull());

Label_01E7:
            return(Library.CreateString((src as PDFString).Value));

Label_01F8:
            throw new Exception("Invalid object type");
        }