public override string[] GetStrings() { if (_strings != null) { return(_strings); } List <string> strings = new List <string>(); var data = GetContent(); int s = 0; int ind = 0; for (int i = 0; i < data.Length; i++) { if (data[i] == 0x00) { strings.Add(GameEncoding.GetString(data, s, i - s)); ind++; s = i + 1; } } return(_strings = strings.ToArray()); }
/// <summary> /// \0 terminated lines /// </summary> /// <returns></returns> public string[] GetText() { if (_text != null) { return(_text); } List <string> lines = new List <string>(); var data = GetContent(false); int s = 0; int ind = 0; for (int i = 0; i < data.Length; i++) { if (data[i] == 0x00) { string strRes = GameEncoding.GetString(data, s, i - s); lines.Add(strRes); ind++; s = i + 1; } } return(_text = lines.ToArray()); }
public void ReadText(byte[] data, GameEncoding encoding) { for (int i = TextOffset; i < data.Length; i++) { if (data[i] == 0) { Text = encoding.GetString(data, TextOffset, i - TextOffset); return; } } }
public static string ReadString(this Stream stream, GameEncoding encoding) { List <byte> buff = new List <byte>(); while (true) { var b = stream.ReadByte(); if (b == 0) { break; } buff.Add((byte)b); } return(encoding.GetString(buff.ToArray())); }
public string[] GetText(bool translateDir) { List <string> lines = new List <string>(); var data = GetContent(translateDir); int s = 0; int ind = 0; for (int i = 0; i < data.Length; i++) { if (data[i] == 0x00) { lines.Add(GameEncoding.GetString(data, s, i - s)); ind++; s = i + 1; } } return(lines.ToArray()); }