static BodyTable() { m_Entries = new Hashtable(); string filePath = FileManager.GetFilePath("body.def"); if (filePath == null) { return; } StreamReader def = new StreamReader(filePath); string line; int totalDataRead = 0; while ((line = def.ReadLine()) != null) { totalDataRead += line.Length; if ((line = line.Trim()).Length == 0 || line.StartsWith("#")) { continue; } try { int index1 = line.IndexOf(" {"); int index2 = line.IndexOf("} "); string param1 = line.Substring(0, index1); string param2 = line.Substring(index1 + 2, index2 - index1 - 2); string param3 = line.Substring(index2 + 2); int indexOf = param2.IndexOf(','); if (indexOf > -1) { param2 = param2.Substring(0, indexOf).Trim(); } int iParam1 = Convert.ToInt32(param1); int iParam2 = Convert.ToInt32(param2); int iParam3 = Convert.ToInt32(param3); m_Entries[iParam1] = new BodyTableEntry(iParam2, iParam1, iParam3); } catch { } } Metrics.ReportDataRead(totalDataRead); }
private static void LoadTable() { int count = 400 + ((m_FileIndex.Index.Length - 35000) / 175); m_Table = new int[count]; for (int i = 0; i < count; ++i) { object o = BodyTable.m_Entries[i]; if (o == null || BodyConverter.Contains(i)) { m_Table[i] = i; } else { BodyTableEntry bte = (BodyTableEntry)o; m_Table[i] = bte.m_OldID | (1 << 31) | (((bte.m_NewHue ^ 0x8000) & 0xFFFF) << 15); } } }
static BodyTable() { m_Entries = new Hashtable(); string filePath = FileManager.GetFilePath("body.def"); if (filePath == null) return; StreamReader def = new StreamReader(filePath); string line; int totalDataRead = 0; while ((line = def.ReadLine()) != null) { totalDataRead += line.Length; if ((line = line.Trim()).Length == 0 || line.StartsWith("#")) continue; try { int index1 = line.IndexOf(" {"); int index2 = line.IndexOf("} "); string param1 = line.Substring(0, index1); string param2 = line.Substring(index1 + 2, index2 - index1 - 2); string param3 = line.Substring(index2 + 2); int indexOf = param2.IndexOf(','); if (indexOf > -1) param2 = param2.Substring(0, indexOf).Trim(); int iParam1 = Convert.ToInt32(param1); int iParam2 = Convert.ToInt32(param2); int iParam3 = Convert.ToInt32(param3); m_Entries[iParam1] = new BodyTableEntry(iParam2, iParam1, iParam3); } catch { } } Metrics.ReportDataRead(totalDataRead); }