Beispiel #1
0
        public void DrawText(string text, Typeface typeface, double fontSize, PDFColor color,
                             double x, double y)
        {
            PDFFont pdfFont;

            if (!_fontMapping.TryGetValue(typeface, out pdfFont))
            {
                pdfFont = new PDFTrueTypeFont(CreateIndirectDictionary(), typeface);
                _fontMapping[typeface] = pdfFont;
                pdfFont.ResourceKeyId  = _fontMapping.Count;
            }
            int fontKey = pdfFont.ResourceKeyId;

            pdfFont.AddStringToSubset(text);

            // Let's create a temporary PDFString, which takes care of escaping special characters.
            PDFString str = new PDFString(text);

            WriteColor(color, false);

            AppendToContentStream(
                "BT\r\n" +
                $"  /F{fontKey} {PDFReal.RealToString(fontSize)} Tf\r\n" +
                $"  {PDFReal.RealToString(x)} {PDFReal.RealToString(-y)} Td\r\n" +
                $"  {str.ToString()} Tj\r\n" +
                "ET\r\n");
        }
        public byte[] EncryptString(PDFString src, int id, int gene)
        {
            byte[]             numArray1  = src.Bytes;
            RC4CryptoTransform transform1 = new RC4CryptoTransform(this.ComputeObjKey(id, gene));

            return(transform1.TransformFinalBlock(numArray1, 0, numArray1.Length));
        }
        private string convertToRawStringDisplay(byte[] buffer)
        {
            PDFString   str        = new PDFString(buffer, PDFDoc, false, false);
            List <char> exceptions = new List <char>();

            return(replaceNonPrintingASCII(str.Value, '.', exceptions));
        }
Beispiel #4
0
        private bool containsField(string fieldName, PDFArray fields)
        {
            if (fields == null)
            {
                return(false);
            }

            for (int i = 0; i < fields.Count; ++i)
            {
                PDFDictionary dict = fields[i] as PDFDictionary;
                if (dict != null)
                {
                    PDFString name = dict["T"] as PDFString;
                    if (name != null && name.GetValue() == fieldName)
                    {
                        return(true);
                    }

                    PDFArray kids = dict["Kids"] as PDFArray;
                    if (kids != null)
                    {
                        return(containsField(fieldName, kids));
                    }
                }
            }

            return(false);
        }
        public void PDFStringConstructor_Test()
        {
            string    value  = "Hello World";
            PDFString target = new PDFString(value);

            Assert.AreEqual(value, target.Value);
        }
        private string convertToCookedStringDisplay(byte[] buffer)
        {
            PDFString   str        = new PDFString(buffer, PDFDoc, false, false);
            List <char> exceptions = new List <char>();

            exceptions.Add('\n');
            exceptions.Add(' ');
            return(replaceNonPrintingASCII(str.Value, '.', exceptions).Replace("\n", "\r\n"));
        }
        public void Type_Test()
        {
            PDFString target = new PDFString();

            PDFObjectType expected = PDFObjectTypes.String;
            PDFObjectType actual;

            actual = target.Type;
            Assert.AreEqual(expected, actual);
        }
Beispiel #8
0
 // Properties
 public string this[int index]
 {
     get
     {
         return((base._GetObject(index) as PDFString).Value);
     }
     set
     {
         PDFString text1 = Library.CreateString(value);
         base._SetObject(index, text1, text1.Direct);
     }
 }
Beispiel #9
0
        // Methods
        internal PDFIndexedCSDoubleArrayString(PDFString str, int pos, int ncomponet, byte[] data, int start) : base(ncomponet)
        {
            int num1;

            this.Position    = pos;
            this.mNComponent = ncomponet;
            this.mStr        = str;
            for (num1 = 0; (num1 < ncomponet); num1 += 1)
            {
                this.mArr[num1] = ((double)data[(num1 + start)]);
            }
        }
        public void op_Explicit_Test()
        {
            string    str      = "Hello World";
            PDFString expected = new PDFString(str);
            PDFString actual;

            actual = (PDFString)str;
            Assert.AreEqual(expected, actual);

            str    = "Not Hello World";
            actual = (PDFString)str;
            Assert.AreNotEqual(expected, actual);
        }
        public void op_Explicit_Test1()
        {
            string    expected = "Hello world";
            PDFString str      = new PDFString(expected);
            string    actual;

            actual = ((string)(str));
            Assert.AreEqual(expected, actual);

            str    = new PDFString("Not Hello world");
            actual = (string)str;
            Assert.AreNotEqual(expected, actual);
        }
        public void GetHashCode_Test()
        {
            string    value    = "Hello World";
            PDFString target   = new PDFString(value);
            int       expected = value.GetHashCode();
            int       actual;

            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);

            PDFString other = new PDFString(value);

            expected = other.GetHashCode();
            actual   = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }
        public void Value_Test()
        {
            string    expected = "Hello World";
            PDFString target   = new PDFString(expected);
            string    actual;

            actual = target.Value;
            Assert.AreEqual(expected, actual);

            expected = "New Hello World";

            target.Value = expected;
            actual       = target.Value;

            Assert.AreEqual(expected, actual);
        }
Beispiel #14
0
        /// <summary>
        /// Writes the specified value to the PDF stream.
        /// </summary>
        public void Write(PDFString value)
        {
            WriteSeparator(CharCat.Delimiter);
#if true
            PDFStringEncoding encoding = (PDFStringEncoding)(value.Flags & PDFStringFlags.EncodingMask);
            string            pdf      = (value.Flags & PDFStringFlags.HexLiteral) == 0 ?
                                         PDFEncoders.ToStringLiteral(value.Value, encoding, SecurityHandler) :
                                         PDFEncoders.ToHexStringLiteral(value.Value, encoding, SecurityHandler);
            WriteRaw(pdf);
#else
            switch (value.Flags & PDFStringFlags.EncodingMask)
            {
            case PDFStringFlags.Undefined:
            case PDFStringFlags.PDFDocEncoding:
                if ((value.Flags & PDFStringFlags.HexLiteral) == 0)
                {
                    WriteRaw(PDFEncoders.DocEncode(value.Value, false));
                }
                else
                {
                    WriteRaw(PDFEncoders.DocEncodeHex(value.Value, false));
                }
                break;

            case PDFStringFlags.WinAnsiEncoding:
                throw new NotImplementedException("Unexpected encoding: WinAnsiEncoding");

            case PDFStringFlags.Unicode:
                if ((value.Flags & PDFStringFlags.HexLiteral) == 0)
                {
                    WriteRaw(PDFEncoders.DocEncode(value.Value, true));
                }
                else
                {
                    WriteRaw(PDFEncoders.DocEncodeHex(value.Value, true));
                }
                break;

            case PDFStringFlags.StandardEncoding:
            case PDFStringFlags.MacRomanEncoding:
            case PDFStringFlags.MacExpertEncoding:
            default:
                throw new NotImplementedException("Unexpected encoding");
            }
#endif
            _lastCat = CharCat.Delimiter;
        }
Beispiel #15
0
        private PDFString CreateRecipientString(X509Certificate cert, UserAccessPermissions perm, int keyLength)
        {
            PDFString text1 = Library.CreateString("");
            ASN1      asn1  = new ASN1(48);

            asn1.Add(ASN1Convert.FromOID("1.2.840.113549.1.7.3"));
            ASN1 asn2 = new ASN1(160);

            byte[] numArray1 = new byte[1];
            asn2.Add(new ASN1(2, numArray1));
            ASN1 asn3 = new ASN1(48);
            ASN1 asn4 = new ASN1(48);

            asn3.Add(asn4);
            new ASN1(2, cert.GetSerialNumber());
            return(text1);
        }
        public void Equals_Test1()
        {
            string    value    = "Hello World";
            PDFString target   = new PDFString(value);
            object    obj      = new PDFString(value);
            bool      expected = true;
            bool      actual;

            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);

            value    = "Not Hello World";
            obj      = new PDFString(value);
            expected = false;
            actual   = target.Equals(obj);

            Assert.AreEqual(expected, actual);
        }
        static string[] get_text_info(PDFDict field)
        {
            string    svalue;
            string    sdefault_value;
            string    sMax_Length;
            PDFObject entry;

            entry = field.Get("V");
            if (entry is PDFString)
            {
                PDFString value = (PDFString)entry;
                svalue = "Value: " + value.Value;
            }
            else
            {
                svalue = "";
            }

            entry = field.Get("DV");
            if (entry is PDFString)
            {
                PDFString defvalue = (PDFString)entry;
                sdefault_value = "Default Value: " + defvalue.Value;
            }
            else
            {
                sdefault_value = "";
            }

            entry = field.Get("MaxLen");
            if (entry is PDFInteger)
            {
                PDFInteger int_entry   = (PDFInteger)entry;
                int        nMax_Length = 0;
                nMax_Length = int_entry.Value;
                sMax_Length = String.Format("Max Length: {0}", nMax_Length);
            }
            else
            {
                sMax_Length = "";
            }

            return(new string[] { svalue, sdefault_value, sMax_Length });
        }
        private PDFObject createNewValueForSelectedScalar(PDFObject selectedPDFObject, string newValue)
        {
            PDFObject newPDFObject = null;

            if (selectedPDFObject is PDFString)
            {
                PDFString selectedPDFString = selectedPDFObject as PDFString;
                newPDFObject = new PDFString(newValue, PDFDoc, selectedPDFString.Indirect, selectedPDFString.StoredAsHex);
            }
            else if (selectedPDFObject is PDFName)
            {
                newPDFObject = new PDFName(newValue, PDFDoc, selectedPDFObject.Indirect);
            }
            else if (selectedPDFObject is PDFReal)
            {
                double newVal;
                if (double.TryParse(newValue, out newVal))
                {
                    newPDFObject = new PDFReal(newVal, PDFDoc, selectedPDFObject.Indirect);
                }
                else
                {
                    throw new FormatException("The value is not of type double.");
                }
            }
            else if (selectedPDFObject is PDFInteger)
            {
                int newVal;
                if (int.TryParse(newValue, out newVal))
                {
                    newPDFObject = new PDFInteger(newVal, PDFDoc, selectedPDFObject.Indirect);
                }
                else
                {
                    throw new FormatException("The value is not of type integer.");
                }
            }
            else
            {
                throw new InvalidOperationException("Non scalar types can't be altered");
            }
            return(newPDFObject);
        }
Beispiel #19
0
        public static AnnotationState PDFStringToPDFAnnotationState(PDFString state, PDFString stateModel)
        {
            if (state == null)
            {
                if (stateModel == null)
                {
                    return(AnnotationState.None);
                }

                if (stateModel.GetValue() == "Marked")
                {
                    return(AnnotationState.Unmarked);
                }
                else
                {
                    return(AnnotationState.None);
                }
            }

            switch (state.GetValue())
            {
            case "Accepted":
                return(AnnotationState.Accepted);

            case "Cancelled":
                return(AnnotationState.Cancelled);

            case "Completed":
                return(AnnotationState.Completed);

            case "Marked":
                return(AnnotationState.Marked);

            case "Rejected":
                return(AnnotationState.Rejected);

            case "Unmarked":
                return(AnnotationState.Unmarked);
            }

            return(AnnotationState.None);
        }
        public void Equals_Test()
        {
            string    value    = "Hello World";
            PDFString target   = new PDFString(value);
            PDFString other    = new PDFString(value);
            bool      expected = true;
            bool      actual;

            actual = target.Equals(other);
            Assert.AreEqual(expected, actual);

            value    = "No Hello";
            other    = new PDFString(value);
            expected = false;
            actual   = target.Equals(other);
            Assert.AreEqual(expected, actual);

            value    = null;
            other    = new PDFString(value);
            expected = false;
            actual   = target.Equals(other);
            Assert.AreEqual(expected, actual);
        }
Beispiel #21
0
        public PDFCreator(string pdfFileName)
        {
            this.pdfFileName = pdfFileName;

            pageKidsArray = CreateIndirectArray();
            mediaBox      = new PDFArray(PDFObject.DirectObject,
                                         0.0, 0.0, 595.2756, 841.8898); // A4

            pagesDictionary = CreateIndirectDictionary();
            pagesDictionary.Put("Type", new PDFName("Pages"));
            pagesDictionary.Put("Kids", pageKidsArray);
            //pagesDictionary.Put("Resources", ); // all PDF pages would inherit these resources

            PDFDictionary catalog = CreateIndirectDictionary();

            catalog.Put("Type", new PDFName("Catalog"));
            catalog.Put("Pages", pagesDictionary);

            PDFDictionary infoDictionary = CreateIndirectDictionary();

            infoDictionary.Put("Creator", new PDFString("Menu Master"));
            infoDictionary.Put("CreationDate", PDFString.GetDateString());

            PDFString fileIdString = PDFString.CreateFileIDString();

            trailerDictionary = new PDFDictionary(PDFObject.DirectObject);
            trailerDictionary.Put("Root", catalog);
            trailerDictionary.Put("ID", new PDFArray(PDFObject.DirectObject, fileIdString, fileIdString));
            trailerDictionary.Put("Info", infoDictionary);

            _commonResources     = CreateIndirectDictionary();
            _commonFontResources = CreateIndirectDictionary();
            _commonResources.Put("Font", _commonFontResources);

            // PDF must have at least one page
            AddPage();
        }
Beispiel #22
0
        private PDFDictionary findRadioButtonGroup(string name)
        {
            PDFArray fields = _dictionary["Fields"] as PDFArray;

            for (int i = 0; i < fields.Count; ++i)
            {
                PDFDictionary dict = fields[i] as PDFDictionary;
                if (dict != null)
                {
                    PDFName   ft = dict["FT"] as PDFName;
                    PDFNumber ff = dict["Ff"] as PDFNumber;
                    PDFString t  = dict["T"] as PDFString;
                    if (ft != null && ff != null && t != null)
                    {
                        if (ft.GetValue() == "Btn" && t.GetValue() == name &&
                            ((uint)ff.GetValue() >> 15) % 2 != 0)
                        {
                            return(dict);
                        }
                    }
                }
            }
            return(null);
        }
        public void WriteData_Test()
        {
            PDFString expected = (PDFString)"This is some text";
            string    result;
            PDFString actual;

            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
            {
                using (PDFWriter writer = new PDFWriter14(stream, new Scryber.Logging.DoNothingTraceLog(TraceRecordLevel.Diagnostic)))
                {
                    expected.WriteData(writer);
                    writer.InnerStream.Flush();
                }
                stream.Position = 0;

                using (System.IO.StreamReader sr = new System.IO.StreamReader(stream))
                {
                    result = sr.ReadToEnd();
                }
            }

            actual = PDFString.Parse(result.Trim());
            Assert.AreEqual(expected, actual);
        }
Beispiel #24
0
 public byte[] EncryptString(PDFString src, int id, int gene)
 {
     return(src.Bytes);
 }
Beispiel #25
0
 public byte[] DecryptString(PDFString src, int id, int gene)
 {
     return(null);
 }
Beispiel #26
0
 public Date(PDFString s)
 {
     this.mStr      = s;
     this.mDateTime = new DateTime(((long)0));
     this.ParseString();
 }
Beispiel #27
0
        static void Main(string[] args)
        {
            Console.WriteLine("NumberTree Sample:");
            using (Library lib = new Library())
            {
                Console.WriteLine("Initialized the library.");

                // Create a new document and blank first page
                Document doc  = new Document();
                Rect     rect = new Rect(0, 0, 612, 792);
                Page     page = doc.CreatePage(Document.BeforeFirstPage, rect);
                Console.WriteLine("Created new document and first page.");

                // Create a NumberTree and put a key-value pair in it
                NumberTree numbertree = new NumberTree(doc);

                // Use put() to put a key-value pair in it
                int       key   = 1;
                PDFString value = new PDFString("Smorgasbord", doc, false, false);
                numbertree.Put(key, value);
                Console.WriteLine("\nCreated NumberTree and added first key-value pair.");

                // Put another key-value pair in it
                numbertree.Put(2, new PDFString("Copasetic", doc, false, false));

                // Retrieve second entry
                int       keysearchinteger = 2;
                PDFObject lookup           = numbertree.Get(keysearchinteger);
                Console.WriteLine("\nRetrieving two entries:");
                Console.WriteLine(lookup);

                // Retrieve first entry
                lookup = numbertree.Get(1);
                Console.WriteLine(lookup);

                // Use remove() method to remove first entry
                numbertree.Remove(1);

                // Get 1 and 2, and demonstrate that 1 is now gone
                Console.WriteLine("\nAfter removing entry 1, we now have:");
                lookup = numbertree.Get(1);
                Console.WriteLine(lookup);
                lookup = numbertree.Get(2);
                Console.WriteLine(lookup);

                // Create two new NumberTrees and set each to our original numbertree
                NumberTree abc = numbertree;
                NumberTree xyz = numbertree;

                // Show they are equal
                if (abc.Equals(xyz))
                {
                    Console.WriteLine("\nThe two NumberTrees abc and xyz are the same");
                }
                else
                {
                    Console.WriteLine("\nThe two NumberTrees abc and xyz are not the same");
                }

                // Create two new NumberTrees
                abc = new NumberTree(doc);
                xyz = new NumberTree(doc);

                // Show they are not equal
                if (abc.Equals(xyz))
                {
                    Console.WriteLine("\nThe two NumberTrees abc and xyz are the same");
                }
                else
                {
                    Console.WriteLine("\nThe two NumberTrees abc and xyz are not the same");
                }

                // Get the PDFDict from the NumberTree
                PDFDict dict = numbertree.PDFDict;
                Console.WriteLine("\nThe PDFDict from the NumberTree:");
                Console.WriteLine(dict);

                // Kill the NumberTree object
                numbertree.Dispose();
                Console.WriteLine("\nKilled the NumberTree object.");

                // Kill the doc object
                doc.Dispose();
                Console.WriteLine("Killed document object.");
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("NameTree Sample:");
            using (Library lib = new Library())
            {
                Console.WriteLine("Initialized the library.");

                // Create a new document and blank first page
                Document doc  = new Document();
                Rect     rect = new Rect(0, 0, 612, 792);
                Page     page = doc.CreatePage(Document.BeforeFirstPage, rect);
                Console.WriteLine("Created new document and first page.");

                // Create a NumberTree and put a key-value pair in it
                NameTree nametree = new NameTree(doc);

                // Use put() to put a key-value pair in it
                PDFString key   = new PDFString("Bailout", doc, false, false);;
                PDFString value = new PDFString("Smorgasbord", doc, false, false);
                nametree.Put(key, value);
                Console.WriteLine("\nCreated NameTree and added first key-value pair.");

                // Put another key-value pair in it
                nametree.Put(new PDFString("Brandish", doc, false, false), new PDFString("Copasetic", doc, false, false));

                // Retrieve second entry
                PDFString keysearchstring = new PDFString("Brandish", doc, false, false);
                PDFObject lookup          = nametree.Get(keysearchstring);
                Console.WriteLine("\nRetrieving two entries:");
                Console.WriteLine(lookup);

                // Retrieve first entry
                lookup = nametree.Get(new PDFString("Bailout", doc, false, false));
                Console.WriteLine(lookup);

                // Use remove() method to remove first entry
                nametree.Remove(new PDFString("Bailout", doc, false, false));

                // Get both entries, and demonstrate that first is now gone
                Console.WriteLine("\nAfter removing entry 1, we now have:");
                lookup = nametree.Get(new PDFString("Bailout", doc, false, false));
                Console.WriteLine(lookup);
                lookup = nametree.Get(new PDFString("Brandish", doc, false, false));
                Console.WriteLine(lookup);

                // Create two new NameTrees and set each to our original numbertree
                NameTree abc = nametree;
                NameTree xyz = nametree;

                // Show they are equal
                if (abc.Equals(xyz))
                {
                    Console.WriteLine("\nThe two NameTrees abc and xyz are the same");
                }
                else
                {
                    Console.WriteLine("\nThe two NameTrees abc and xyz are not the same");
                }

                // Create two new NameTrees
                abc = new NameTree(doc);
                xyz = new NameTree(doc);

                // Show they are not equal
                if (abc.Equals(xyz))
                {
                    Console.WriteLine("\nThe two NameTrees abc and xyz are the same");
                }
                else
                {
                    Console.WriteLine("\nThe two NameTrees abc and xyz are not the same");
                }

                // Get the PDFDict from the NameTree
                PDFDict dict = nametree.PDFDict;
                Console.WriteLine("\nThe PDFDict from the NameTree:");
                Console.WriteLine(dict);

                // Kill the NameTree object
                nametree.Dispose();
                Console.WriteLine("\nKilled the NameTree object.");

                //////////////////////////////////////////////////
                // Now use Document methods to operate on NameTree
                //////////////////////////////////////////////////

                // Create a NameTree in the document using createNameTree() method
                NameTree docCreatedNameTree = doc.CreateNameTree("MyNameTree");
                docCreatedNameTree.Put(new PDFString("Argyle", doc, false, false), new PDFString("Seamstress", doc, false, false));
                Console.WriteLine("Created a NameTree object in the document.");

                // Look for the NameTree in the document by using the getNameTree() method
                Console.WriteLine("\nTwo searches for NameTree using getNameTree() method; first fails, second succeeeds:");
                docCreatedNameTree = doc.GetNameTree("Garbage");
                Console.WriteLine(docCreatedNameTree);
                docCreatedNameTree = doc.GetNameTree("MyNameTree");
                Console.WriteLine(docCreatedNameTree);

                // Remove the NameTree from the document by using the remove NameTree() method
                Console.WriteLine("\nRemove the NameTree from the document.");
                doc.RemoveNameTree("Garbage");
                docCreatedNameTree = doc.GetNameTree("MyNameTree");
                Console.WriteLine(docCreatedNameTree);
                doc.RemoveNameTree("MyNameTree");
                docCreatedNameTree = doc.GetNameTree("MyNameTree");
                Console.WriteLine(docCreatedNameTree);

                // Kill the doc object
                doc.Dispose();
            }
        }
Beispiel #29
0
        static void Main(string[] args)
        {
            Console.WriteLine("PDFObject Sample:");

            // ReSharper disable once UnusedVariable
            using (Library lib = new Library())
            {
                String sInput  = Library.ResourceDirectory + "Sample_Input/sample_links.pdf";
                String sOutput = "PDFObject-out.pdf";

                if (args.Length > 0)
                {
                    sInput = args[0];
                }

                if (args.Length > 1)
                {
                    sOutput = args[1];
                }

                Console.WriteLine("Input file: " + sInput + ". Writing to output " + sOutput);

                Document doc  = new Document(sInput);
                Page     page = doc.GetPage(0);

                LinkAnnotation annot = (LinkAnnotation)page.GetAnnotation(1);
                URIAction      uri   = (URIAction)annot.Action;

                // Print some info about the URI action, before we modify it
                Console.WriteLine("Initial URL: " + uri.URI);
                Console.WriteLine("Is Map property: " + uri.IsMap);

                // Modify the URIAction
                //
                // A URI action is a dictionary containing:
                //    Key: S     Contents: a name object with the value "URI" (required)
                //    Key: URI   Contents: a string object for the uniform resource locator (required)
                //    Key: IsMap Contents: a boolean for whether the link is part of a map (optional)
                //    (see section 8.5.3, "Action Types", of the PDF Reference)
                //
                // We will change the URI entry and delete the IsMap entry for this dictionary

                PDFDict uri_dict = uri.PDFDict; // Extract the dictionary

                // Create a new string object
                PDFString uri_string = new PDFString("http://www.google.com", doc, false, false);

                uri_dict.Put("URI", uri_string); // Change the URI (replaces the old one)
                uri_dict.Remove("IsMap");        // Remove the IsMap entry

                // Check that we deleted the IsMap entry
                Console.WriteLine("Does this dictionary have an IsMap entry? " + uri_dict.Contains("IsMap"));

                doc.Save(SaveFlags.Full, sOutput);
                doc.Close();

                // Check the modified contents of the link
                doc   = new Document(sOutput);
                page  = doc.GetPage(0);
                annot = (LinkAnnotation)page.GetAnnotation(1);
                uri   = (URIAction)annot.Action;

                Console.WriteLine("Modified URL: " + uri.URI);
                Console.WriteLine("Is Map property (if not present, defaults to false): " + uri.IsMap);
            }
        }
Beispiel #30
0
        public void WriteString(PDFString val)
        {
            byte num3;

            byte[]    numArray1 = val.Bytes;
            PDFObject obj1      = val;

            while (!obj1.IsIndirect)
            {
                obj1 = obj1.Parent;
                if (obj1 == null)
                {
                    break;
                }
            }
            if ((this.Encryption != null) && (obj1 != null))
            {
                numArray1 = this.Encryption.EncryptString(val, obj1.Indirect.Id, obj1.Indirect.Generation);
            }
            byte[] numArray2 = new byte[((val.Bytes.Length * 2) + 2)];
            numArray2[0] = 40;
            int num1 = 1;
            int num2 = 0;

            while ((num2 < numArray1.Length))
            {
                num3 = numArray1[num2];
                if (num3 <= 13)
                {
                    if (num3 == 10)
                    {
                        goto Label_00EE;
                    }
                    if (num3 == 13)
                    {
                        goto Label_00DA;
                    }
                    goto Label_0102;
                }
                switch (num3)
                {
                case 40:
                {
                    int num6 = num1;
                    num1            = (num6 + 1);
                    numArray2[num1] = 92;
                    int num7 = num1;
                    num1            = (num7 + 1);
                    numArray2[num1] = 40;
                    goto Label_010D;
                }

                case 41:
                {
                    int num8 = num1;
                    num1            = (num8 + 1);
                    numArray2[num1] = 92;
                    int num9 = num1;
                    num1            = (num9 + 1);
                    numArray2[num1] = 41;
                    goto Label_010D;
                }
                }
                if (num3 != 92)
                {
                    goto Label_0102;
                }
                int num4 = num1;
                num1            = (num4 + 1);
                numArray2[num1] = 92;
                int num5 = num1;
                num1            = (num5 + 1);
                numArray2[num1] = 92;
                goto Label_010D;
Label_00DA:
                int num10       = num1;
                num1            = (num10 + 1);
                numArray2[num1] = 92;
                int num11 = num1;
                num1            = (num11 + 1);
                numArray2[num1] = 114;
                goto Label_010D;
Label_00EE:
                int num12       = num1;
                num1            = (num12 + 1);
                numArray2[num1] = 92;
                int num13 = num1;
                num1            = (num13 + 1);
                numArray2[num1] = 110;
                goto Label_010D;
Label_0102:
                int num14       = num1;
                num1            = (num14 + 1);
                numArray2[num1] = numArray1[num2];
Label_010D:
                num2 += 1;
            }
            int num15 = num1;

            num1            = (num15 + 1);
            numArray2[num1] = 41;
            this.mWriter.Flush();
            this.mStream.Write(numArray2, 0, num1);
        }