protected override void Reload() { try { byte[] data = Current.GetContent(); if (data == null) { tbHexView.Text = "Unsupported compression method"; return; } tbHexView.Text = GameEncoding.ByteToHexTable(data); } catch (Exception ex) { tbHexView.Text = ex.ToString(); } }
protected override void ShowResource(Resource res, bool translated) { try { byte[] data = res.GetContent(translated); if (data == null) { tbHexView.Text = "Unsupported compression method"; return; } tbHexView.Text = GameEncoding.ByteToHexTable(data); } catch (Exception ex) { tbHexView.Text = ex.ToString(); } }
protected override void ShowResource(Resource res, bool translated) { var data = res.GetContent(translated); var vocab = (ResVocab)res; tbHex.Text = GameEncoding.ByteToHexTable(data); if (res.Number == 997) { var strings = vocab.GetVocabNames(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < strings.Length; i++) { sb.AppendFormat("{0:x3}: {1}", i, strings[i]).AppendLine(); } tbVocab.Text = sb.ToString(); } else if (res.Number == 998) { var opcodes = vocab.GetVocabOpcodes(); StringBuilder sb = new StringBuilder(); foreach (var kv in opcodes) { sb.AppendFormat("{0:x2}: {1} {2}", kv.Key, kv.Value.Type, kv.Value.Name).AppendLine(); } tbVocab.Text = sb.ToString(); } else if (res.Number == 999) { var lines = vocab.GetText(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < lines.Length; i++) { sb.AppendLine($"{i,-3}: {lines[i]}"); } tbVocab.Text = sb.ToString(); } else { tbVocab.Text = ""; } }