private static unsafe string ParseName(Stream stream) { BinaryReader bin = new BinaryReader(stream); string tempName = String.Empty; bool esc = false; while (!esc && bin.PeekChar() != -1) { byte[] DATA = new byte[1]; bin.Read(DATA, 0, 1); char c = (char)DATA[0]; if (Char.IsLetterOrDigit(c) || Char.IsWhiteSpace(c) || Char.IsPunctuation(c)) { tempName += SkillsData.ToString(c); continue; } esc = true; } return(tempName.Trim()); }
private static unsafe Skill LoadSkill(int index, BinaryFileReader reader) { int nameLength = m_FileIndex.Index[index].length - 2; int extra = m_FileIndex.Index[index].extra; byte[] set1 = new byte[1]; byte[] set2 = new byte[nameLength]; byte[] set3 = new byte[1]; set1 = reader.ReadBytes(1); set2 = reader.ReadBytes(nameLength); set3 = reader.ReadBytes(1); bool useBtn = SkillsData.ToBool(set1); string name = SkillsData.ToString(set2); return(new Skill(new SkillVars(index, name, useBtn, extra, set3[0]))); }