(&mut self, data: CSVCMsg_UpdateStringTable)
| 216 | } |
| 217 | |
| 218 | pub fn update_string_table_msg(&mut self, data: CSVCMsg_UpdateStringTable) -> Option<bool> { |
| 219 | let st = self.stringtables.get_mut(data.table_id() as usize).unwrap(); |
| 220 | let mut buf = MyBitreader::new(data.string_data()); |
| 221 | let entry_bits = (st.max_entries as f32).log2() as i32; |
| 222 | let mut index = 0; |
| 223 | let mut last_inx: i32 = -1; |
| 224 | let mut idx = 0; |
| 225 | let mut btc = 0; |
| 226 | let mut history: Vec<String> = Vec::new(); |
| 227 | let mut entry = String::new(); |
| 228 | buf.read_boolie()?; |
| 229 | |
| 230 | if !(st.name == "userinfo" || st.name == "instancebaseline") { |
| 231 | return Some(true); |
| 232 | } |
| 233 | |
| 234 | for _i in 0..data.num_changed_entries() { |
| 235 | index = last_inx + 1; |
| 236 | if !(buf.read_boolie()?) { |
| 237 | index = buf |
| 238 | .read_nbits(entry_bits.try_into().unwrap())? |
| 239 | .try_into() |
| 240 | .unwrap(); |
| 241 | } |
| 242 | last_inx = index; |
| 243 | if buf.read_boolie()? { |
| 244 | if buf.read_boolie()? { |
| 245 | let idx = buf.read_nbits(5)? as i32; |
| 246 | let bytes_to_copy = buf.read_nbits(5)?; |
| 247 | let s = &history[idx as usize]; |
| 248 | let s_slice = &s[..bytes_to_copy as usize + 1]; |
| 249 | entry = s_slice.to_owned() + &buf.read_string(4096)?; |
| 250 | } else { |
| 251 | entry = buf.read_string(4096)?; |
| 252 | } |
| 253 | st.data[index as usize].entry = entry.to_string() |
| 254 | } |
| 255 | if history.len() >= 32 { |
| 256 | history.remove(0); |
| 257 | } |
| 258 | history.push(entry.clone()); |
| 259 | if buf.read_boolie()? { |
| 260 | let user_data = if st.udfs { |
| 261 | vec![buf |
| 262 | .read_nbits(st.uds.try_into().unwrap())? |
| 263 | .try_into() |
| 264 | .unwrap()] |
| 265 | } else { |
| 266 | let size = buf.read_nbits(14)?; |
| 267 | buf.read_bits_st(size)? |
| 268 | }; |
| 269 | if st.name == "instancebaseline" { |
| 270 | let k = entry.parse::<u32>().unwrap_or(999999); |
| 271 | match self.serverclass_map.get(&(k as u16)) { |
| 272 | Some(sv_cls) => { |
| 273 | parse_baselines(&user_data, sv_cls, &mut self.baselines); |
| 274 | } |
| 275 | None => { |
no test coverage detected