public string ToString(int maxLength = -1) { string str = string.Empty; byte[] dump = GetBytes(); if (sendBuffer.Length <= maxLength) { str = HexDump.GetString(dump, 8, 16); } return(string.Format("Cmd[{0}] Seq[{1}] Reply[{2}] Length[{7}] ReadBufferLen[{3}] SendBufferLen[{4}]:{5}{6}", cmd, seq, (option & (int)Options.Reply) == (int)Options.Reply, readBuffer != null ? readBuffer.Length.ToString(CultureInfo.InvariantCulture) : "N/A", sendBuffer.Length, string.IsNullOrEmpty(str) ? string.Empty : Environment.NewLine, str, dump.Length)); }
public string DumpRegionCache(Session session, String[] parms) { bool help = false; uint x = uint.MaxValue; uint y = uint.MaxValue; try { var p = new OptionSet { { "?|help|h", v => help = true }, { "x=", v => x = uint.Parse(v.TrimMatchingQuotes()) }, { "y=", v => y = uint.Parse(v.TrimMatchingQuotes()) } }; p.Parse(parms); } catch (Exception) { help = true; } if (help || x == uint.MaxValue || y == uint.MaxValue) { return("dumpregioncache --x=x --y=y"); } var region = world.Regions.GetRegion(x, y); if (region == null) { return("Invalid x/y"); } var bytes = region.GetObjectBytes(); return(HexDump.GetString(bytes, 0)); }