Ejemplo n.º 1
0
        public ExcelLongStrings(BinaryReader br, int remainingSize, ExcelLongStrings previousStrings)
        {
            this.Strings = new ArrayList();
            int    charsRemaining         = 0;
            ushort richTextRunsRemaining  = 0;
            uint   asianPhoneticRemaining = 0;

            if (previousStrings != null)
            {
                charsRemaining         = previousStrings.CharsRemaining;
                richTextRunsRemaining  = previousStrings.RichTextRunsRemaining;
                asianPhoneticRemaining = previousStrings.AsianPhoneticRemaining;
            }
            while (remainingSize != 0)
            {
                ExcelLongString str = new ExcelLongString(br, ref remainingSize, ref charsRemaining, ref richTextRunsRemaining, ref asianPhoneticRemaining);
                this.Strings.Add(str);
            }
            this.CharsRemaining         = charsRemaining;
            this.RichTextRunsRemaining  = richTextRunsRemaining;
            this.AsianPhoneticRemaining = asianPhoneticRemaining;
        }
Ejemplo n.º 2
0
        public static void ParseHelper(BinaryReader br, object[] format, ref object[] loadedArgs, ref int currentArgIndex, VariableArrayCountDelegate vaCount, StringLengthDelegate lastStringLength)
        {
            foreach (object obj2 in format)
            {
                if (obj2 is string)
                {
                    Stream baseStream = br.BaseStream;
                    baseStream.Position += Utilities.GetByteArrLengthFromHexStr((string)obj2);
                    continue;
                }
                if (obj2 is Type)
                {
                    Type enumType = (Type)obj2;
                    if (enumType.IsEnum)
                    {
                        enumType = Enum.GetUnderlyingType(enumType);
                    }
                    switch (enumType.FullName)
                    {
                    case "System.Int16":
                        loadedArgs[currentArgIndex] = br.ReadInt16();
                        break;

                    case "System.UInt16":
                        loadedArgs[currentArgIndex] = br.ReadUInt16();
                        break;

                    case "System.UInt32":
                        loadedArgs[currentArgIndex] = br.ReadUInt32();
                        break;

                    case "System.UInt64":
                        loadedArgs[currentArgIndex] = br.ReadUInt64();
                        break;

                    case "System.Byte":
                        loadedArgs[currentArgIndex] = br.ReadByte();
                        break;

                    case "System.Char":
                        loadedArgs[currentArgIndex] = br.ReadChar();
                        break;

                    case "System.Single":
                        loadedArgs[currentArgIndex] = br.ReadSingle();
                        break;

                    case "System.Double":
                        loadedArgs[currentArgIndex] = br.ReadDouble();
                        break;

                    case "ebexcel.ExcelShortString":
                        loadedArgs[currentArgIndex] = new ExcelShortString(br);
                        break;

                    case "ebexcel.ExcelLongString":
                        loadedArgs[currentArgIndex] = new ExcelLongString(br);
                        break;

                    case "ebexcel.ExcelStringWithoutLength":
                        loadedArgs[currentArgIndex] = new ExcelStringWithoutLength(br, lastStringLength(loadedArgs));
                        break;

                    case "ebexcel.ExcelLongStrings":
                    {
                        int remainingSize = vaCount(loadedArgs, null, (int)br.BaseStream.Length);
                        loadedArgs[currentArgIndex] = new ExcelLongStrings(br, remainingSize, null);
                        break;
                    }

                    case "ebexcel.CellRecordHeader":
                        loadedArgs[currentArgIndex] = new CellRecordHeader(br);
                        break;

                    case "ebexcel.SheetIndexes":
                        loadedArgs[currentArgIndex] = new SheetIndexes(br);
                        break;

                    case "ebexcel.MsoBaseRecord":
                        loadedArgs[currentArgIndex] = ImageRecordsFactory.CreateFromReader(br);
                        break;

                    default:
                        throw new Exception("Internal error: unsupported type in format.");
                    }
                    currentArgIndex++;
                    continue;
                }
                if (!(obj2 is object[]))
                {
                    throw new Exception("Internal error: wrong format in descriptor.");
                }
                object[] varArr    = (object[])obj2;
                int      num2      = vaCount(loadedArgs, varArr, (int)br.BaseStream.Length);
                object[] objArray2 = new object[varArr.Length * num2];
                int      num3      = 0;
                for (int i = 0; i < num2; i++)
                {
                    ParseHelper(br, varArr, ref objArray2, ref num3, vaCount, lastStringLength);
                }
                object[] destinationArray = new object[num3];
                Array.Copy(objArray2, destinationArray, num3);
                loadedArgs[currentArgIndex] = destinationArray;
                currentArgIndex++;
            }
        }
Ejemplo n.º 3
0
 public ContinueRecord(ExcelLongStrings excelStrings) : base(staticDescriptor)
 {
     base.ExcelStrings = excelStrings;
     base.InitializeDelayed(new object[] { excelStrings });
 }