private SevenImportTable.RowData BinarySearchID(int key, int min, int max) { SevenImportTable.RowData rowData = this.Table[min]; if (rowData.ID == key) { return(rowData); } SevenImportTable.RowData rowData2 = this.Table[max]; if (rowData2.ID == key) { return(rowData2); } if (max - min <= 1) { return(null); } int num = min + (max - min) / 2; SevenImportTable.RowData rowData3 = this.Table[num]; if (rowData3.ID.CompareTo(key) > 0) { return(this.BinarySearchID(key, min, num)); } if (rowData3.ID.CompareTo(key) < 0) { return(this.BinarySearchID(key, num, max)); } return(rowData3); }
protected override bool OnLine(string[] Fields) { SevenImportTable.RowData rowData = new SevenImportTable.RowData(); if (!base.Parse(Fields[this.ColMap[0]], ref rowData.ID)) { return(false); } if (!base.Parse(Fields[this.ColMap[1]], ref rowData.ItemID)) { return(false); } if (!base.Parse(Fields[this.ColMap[2]], ref rowData.SharedTexture)) { return(false); } if (!base.Parse(Fields[this.ColMap[3]], ref rowData.SharedIcon)) { return(false); } if (!base.Parse(Fields[this.ColMap[4]], ref rowData.DialogSharedTexture)) { return(false); } this.AddRowID(rowData.ID, rowData, 0, this.Table.Count - 1); return(true); }
protected override void ReadLine(BinaryReader reader) { SevenImportTable.RowData rowData = new SevenImportTable.RowData(); base.Read <int>(reader, ref rowData.ID, CVSReader.intParse); this.columnno = 0; base.Read <int>(reader, ref rowData.ItemID, CVSReader.intParse); this.columnno = 1; base.Read <string>(reader, ref rowData.SharedTexture, CVSReader.stringParse); this.columnno = 2; base.Read <string>(reader, ref rowData.SharedIcon, CVSReader.stringParse); this.columnno = 3; base.Read <string>(reader, ref rowData.DialogSharedTexture, CVSReader.stringParse); this.columnno = 4; this.AddRowID(rowData.ID, rowData, 0, this.Table.Count - 1); this.columnno = -1; }
private void AddRowID(int key, SevenImportTable.RowData row, int min, int max) { if (this.Table.Count == 0) { this.Table.Add(row); return; } SevenImportTable.RowData rowData = this.Table[min]; if (rowData.ID.CompareTo(key) > 0) { this.Table.Insert(min, row); return; } if (rowData.ID == key) { XSingleton <XDebug> .singleton.AddErrorLog2("Table: SevenImportTable duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); return; } SevenImportTable.RowData rowData2 = this.Table[max]; if (rowData2.ID.CompareTo(key) < 0) { this.Table.Insert(max + 1, row); return; } if (rowData2.ID == key) { XSingleton <XDebug> .singleton.AddErrorLog2("Table: SevenImportTable duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); return; } if (max - min <= 1) { this.Table.Insert(min + 1, row); return; } int num = min + (max - min) / 2; SevenImportTable.RowData rowData3 = this.Table[num]; if (rowData3.ID.CompareTo(key) > 0) { this.AddRowID(key, row, min, num); return; } if (rowData3.ID.CompareTo(key) < 0) { this.AddRowID(key, row, num, max); return; } XSingleton <XDebug> .singleton.AddErrorLog2("Table: SevenImportTable duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); }