/// <summary> /// Adds strings from binary reader. /// </summary> /// <param name="reader">Reader to add strings from.</param> public void AppendStrings(BinaryReader reader) { byte[] buffer = new byte[(int)Math.Pow(2, 15)]; reader.ReadInt32(); reader.ReadInt16(); while (reader.BaseStream.Position < reader.BaseStream.Length) { int number = reader.ReadInt32(); reader.ReadByte(); int length = reader.ReadInt16(); reader.Read(buffer, 0, length); string text = Encoding.UTF8.GetString(buffer, 0, length); if (!Dictionary.ContainsKey(number)) { UltimaStringCollectionItem item = new UltimaStringCollectionItem(number, text); Dictionary.Add(number, item); List.Add(item); } } }
/// <summary> /// Adds strings from binary reader. /// </summary> /// <param name="reader">Reader to add strings from.</param> public void AppendStrings( BinaryReader reader ) { byte[] buffer = new byte[ (int) Math.Pow( 2, 15 ) ]; reader.ReadInt32(); reader.ReadInt16(); while ( reader.BaseStream.Position < reader.BaseStream.Length ) { int number = reader.ReadInt32(); reader.ReadByte(); int length = reader.ReadInt16(); reader.Read( buffer, 0, length ); string text = Encoding.UTF8.GetString( buffer, 0, length ); if ( !_Dictionary.ContainsKey( number ) ) { UltimaStringCollectionItem item = new UltimaStringCollectionItem( number, text ); _Dictionary.Add( number, item ); _List.Add( item ); } } }