bool CompareFields(ItemField x, Item that, ItemField y) { if (x.Length != y.Length) { Debug.WriteLine($"Field lengths mismatched ('{x.Type}, {x.Length}', '{y.Type}, {y.Length}')"); return(false); } if (x.Type != y.Type) { Debug.WriteLine($"Field types mismatched ('{x.Type}', '{y.Type}')"); return(false); } var a = GetField(x); var b = that.GetField(y); var result = a.SequenceEqual(b); #if DEBUG if (!result) { Debug.WriteLine($"Fields {x.Type} mismatched ('{string.Join(",", a)}', '{string.Join(", ", b)}')"); } #endif PwsUtil.TrashMemory(a); PwsUtil.TrashMemory(b); return(result); }
protected void SetUnkownField(PwsRecord field) { var f = new ItemField((FieldType)field.Type); f.Set(field.Buffer, (FieldType)field.Type, MakeBlowFish()); _unkownItemFields.Add(f); }
public void SetUnknownField(FieldType ft, byte[] data) { var unkrfe = new ItemField(ft); unkrfe.Set(data, ft, MakeBlowFish()); _unkownItemFields.Add(unkrfe); }
protected void SetField(FieldType type, string value) { if (!string.IsNullOrEmpty(value)) { if (!_fields.ContainsKey(type)) { _fields[type] = new ItemField(type); } _fields[type].Set(value, type, MakeBlowFish()); } else { _fields.Remove(type); } }
protected void SetField(FieldType type, byte[] data) { if (data != null && data.Length > 0) { if (!_fields.ContainsKey(type)) { _fields[type] = new ItemField(type); } _fields[type].Set(data, type, MakeBlowFish()); } else { _fields.Remove(type); } }
protected string GetFieldString(ItemField field) { return(field.GetString(MakeBlowFish())); }
protected byte[] GetField(ItemField field) { return(field.Get(MakeBlowFish())); }