Пример #1
0
        // end builtin records
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[STYLE]\n");
            buffer.Append("    .xf_index_raw    = ")
            .Append(HexDump.ShortToHex(field_1_xf_index)).Append("\n");
            buffer.Append("        .type        = ")
            .Append(IsBuiltin?"built-in":"user-defined").Append("\n");
            buffer.Append("        .xf_index    = ")
            .Append(HexDump.ShortToHex(XFIndex)).Append("\n");
            if (IsBuiltin)
            {
                buffer.Append("    .builtin_style   = ").Append(HexDump.ByteToHex(field_2_builtin_style)).Append("\n");
                buffer.Append("    .outline_level   = ").Append(HexDump.ByteToHex(field_3_outline_style_level)).Append("\n");
            }
            else
            {
                buffer.Append("    .name            = ").Append(Name).Append("\n");
            }
            buffer.Append("[/STYLE]\n");
            return(buffer.ToString());
        }
Пример #2
0
        /**
         * Reads VBA Project modules from a VBA Project directory located at
         * <tt>macroDir</tt> into <tt>modules</tt>.
         *
         * @since 3.15-beta2
         */
        protected void ReadMacros(DirectoryNode macroDir, ModuleMap modules)
        {
            foreach (Entry entry in macroDir)
            {
                if (!(entry is DocumentNode))
                {
                    continue;
                }

                String              name     = entry.Name;
                DocumentNode        document = (DocumentNode)entry;
                DocumentInputStream dis      = new DocumentInputStream(document);
                try
                {
                    if ("dir".Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        // process DIR
                        RLEDecompressingInputStream in1 = new RLEDecompressingInputStream(dis);
                        String streamName = null;
                        int    recordId   = 0;
                        try
                        {
                            while (true)
                            {
                                recordId = in1.ReadShort();
                                if (EOF == recordId ||
                                    VERSION_INDEPENDENT_TERMINATOR == recordId)
                                {
                                    break;
                                }
                                int recordLength = in1.ReadInt();
                                switch (recordId)
                                {
                                case PROJECTVERSION:
                                    TrySkip(in1, 6);
                                    break;

                                case PROJECTCODEPAGE:
                                    int codepage = in1.ReadShort();
                                    ModuleMap.charset = Encoding.GetEncoding(codepage);     //Charset.ForName("Cp" + codepage);
                                    break;

                                case STREAMNAME:
                                    streamName = ReadString(in1, recordLength, ModuleMap.charset);
                                    break;

                                case MODULEOFFSET:
                                    ReadModule(in1, streamName, modules);
                                    break;

                                default:
                                    TrySkip(in1, recordLength);
                                    break;
                                }
                            }
                        }
                        catch (IOException e)
                        {
                            throw new IOException(
                                      "Error occurred while Reading macros at section id "
                                      + recordId + " (" + HexDump.ShortToHex(recordId) + ")", e);
                        }
                        finally
                        {
                            in1.Close();
                        }
                    }
                    else if (!name.StartsWith("__SRP", StringComparison.OrdinalIgnoreCase) &&
                             !name.StartsWith("_VBA_PROJECT", StringComparison.OrdinalIgnoreCase))
                    {
                        // process module, skip __SRP and _VBA_PROJECT since these do not contain macros
                        ReadModule(dis, name, modules);
                    }
                }
                finally
                {
                    dis.Close();
                }
            }
        }
Пример #3
0
 protected override void AppendValueText(StringBuilder sb)
 {
     sb.Append("  .sstIndex = ");
     sb.Append(HexDump.ShortToHex(SSTIndex));
 }
Пример #4
0
 public void Confirmshort(int expVal)
 {
     cmp(HexDump.ShortToHex(expVal), HexDump.ShortToHex(_bds.ReadUShort()));
 }
Пример #5
0
 public override string ToString()
 {
     return(string.Format("    " + OfficeArtProperties.GetFillStyleName(Opid.OpId) + "opid=" + HexDump.ShortToHex(Opid.OpId)
                          + "; op=" + HexDump.IntToHex(Op)));
 }
Пример #6
0
 protected override void AppendValueText(StringBuilder sb)
 {
     sb.Append("    .string_len= ").Append(HexDump.ShortToHex(field_4_string_len)).Append("\n");
     sb.Append("    .value       = ").Append(Value).Append("\n");
 }