Exemplo n.º 1
0
        public static void Read(BinaryReader reader, CremaBinaryTable table)
        {
            int stringCount = reader.ReadInt32();
            var strings     = GetTableStrings(table);

            for (int i = 0; i < stringCount; i++)
            {
                int id     = reader.ReadInt32();
                int length = reader.ReadInt32();

                if (strings.ContainsKey(id) == false)
                {
                    string text = string.Empty;
                    if (length != 0)
                    {
                        var bytes = reader.ReadBytes(length);
                        text = Encoding.UTF8.GetString(bytes);
                    }

                    strings.Add(id, text);
                }
                else
                {
                    reader.BaseStream.Seek(length, SeekOrigin.Current);
                }
            }
        }
Exemplo n.º 2
0
        public static StringValueDictionary GetTableStrings(CremaBinaryTable table)
        {
            if (table == null)
            {
                return(fileStrings);
            }

            if (tableStrings.ContainsKey(table))
            {
                return(tableStrings[table]);
            }

            tableStrings.Add(table, new StringValueDictionary());
            return(tableStrings[table]);
        }