Example #1
0
        private ChatTable.RowData BinarySearchid(uint key, int min, int max)
        {
            ChatTable.RowData rowData = this.Table[min];
            if (rowData.id == key)
            {
                return(rowData);
            }
            ChatTable.RowData rowData2 = this.Table[max];
            if (rowData2.id == key)
            {
                return(rowData2);
            }
            if (max - min <= 1)
            {
                return(null);
            }
            int num = min + (max - min) / 2;

            ChatTable.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);
        }
Example #2
0
 protected override bool OnLine(string[] Fields)
 {
     ChatTable.RowData rowData = new ChatTable.RowData();
     if (!base.Parse(Fields[this.ColMap[0]], ref rowData.id))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[1]], ref rowData.cd))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[2]], ref rowData.level))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[3]], ref rowData.isnotice))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[4]], ref rowData.isrecord))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[5]], ref rowData.length))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[6]], ref rowData.sprName))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[7]], ref rowData.miniSpr))
     {
         return(false);
     }
     if (!base.Parse(Fields[this.ColMap[8]], ref rowData.name))
     {
         return(false);
     }
     this.AddRowid(rowData.id, rowData, 0, this.Table.Count - 1);
     return(true);
 }
Example #3
0
 protected override void ReadLine(BinaryReader reader)
 {
     ChatTable.RowData rowData = new ChatTable.RowData();
     base.Read <uint>(reader, ref rowData.id, CVSReader.uintParse);
     this.columnno = 0;
     base.Read <uint>(reader, ref rowData.cd, CVSReader.uintParse);
     this.columnno = 1;
     base.Read <uint>(reader, ref rowData.level, CVSReader.uintParse);
     this.columnno = 2;
     base.Read(reader, ref rowData.isnotice);
     this.columnno = 3;
     base.Read(reader, ref rowData.isrecord);
     this.columnno = 4;
     base.Read <uint>(reader, ref rowData.length, CVSReader.uintParse);
     this.columnno = 5;
     base.Read <string>(reader, ref rowData.sprName, CVSReader.stringParse);
     this.columnno = 6;
     base.Read <string>(reader, ref rowData.miniSpr, CVSReader.stringParse);
     this.columnno = 7;
     base.Read <string>(reader, ref rowData.name, CVSReader.stringParse);
     this.columnno = 8;
     this.AddRowid(rowData.id, rowData, 0, this.Table.Count - 1);
     this.columnno = -1;
 }
Example #4
0
        private void AddRowid(uint key, ChatTable.RowData row, int min, int max)
        {
            if (this.Table.Count == 0)
            {
                this.Table.Add(row);
                return;
            }
            ChatTable.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: ChatTable duplicate id:{0}  lineno: {1}", new object[]
                {
                    key,
                    this.lineno
                });

                return;
            }
            ChatTable.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: ChatTable 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;

            ChatTable.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: ChatTable duplicate id:{0}  lineno: {1}", new object[]
            {
                key,
                this.lineno
            });
        }