Skip to content

Commit

Permalink
[MapleLib] add method WzBinaryReader.PrintHexBytes
Browse files Browse the repository at this point in the history
needs moar debugging shit
staphh changing stuff nexon ;(
  • Loading branch information
lastbattle committed Mar 13, 2022
1 parent a650265 commit ca10d1d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 20 additions & 2 deletions MapleLib/WzLib/Util/WzBinaryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
along with this program. If not, see <http://www.gnu.org/licenses/>.*/

using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using MapleLib.MapleCryptoLib;
using MapleLib.PacketLib;

namespace MapleLib.WzLib.Util
{
Expand Down Expand Up @@ -216,12 +218,28 @@ public string ReadStringBlock(uint offset)

#endregion

#region Overrides
#region Debugging Methods
/// <summary>
/// Prints the next numberOfBytes in the stream in the system debug console.
/// </summary>
/// <param name="numberOfBytes"></param>
public void PrintHexBytes(int numberOfBytes)
{
#if DEBUG // only debug
string hex = HexTool.ToString(ReadBytes(numberOfBytes));
Debug.WriteLine(hex);

this.BaseStream.Position -= numberOfBytes;
#endif
}
#endregion

#region Overrides
public override void Close()
{
// debug here
base.Close();
}
#endregion
#endregion
}
}
4 changes: 2 additions & 2 deletions MapleLib/WzLib/WzDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ internal WzDirectory(WzBinaryReader reader, string dirName, uint verHash, byte[]
/// </summary>
internal void ParseDirectory(bool lazyParse = false)
{
//Debug.WriteLine(HexTool.ToString( reader.ReadBytes(20)));
//reader.BaseStream.Position = reader.BaseStream.Position - 20;
//reader.PrintHexBytes(20);

long available = reader.Available();
if (available == 0)
return;
Expand Down

0 comments on commit ca10d1d

Please sign in to comment.