Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        protected void SetUnkownField(PwsRecord field)
        {
            var f = new ItemField((FieldType)field.Type);

            f.Set(field.Buffer, (FieldType)field.Type, MakeBlowFish());
            _unkownItemFields.Add(f);
        }
Exemplo n.º 3
0
        public void SetUnknownField(FieldType ft, byte[] data)
        {
            var unkrfe = new ItemField(ft);

            unkrfe.Set(data, ft, MakeBlowFish());
            _unkownItemFields.Add(unkrfe);
        }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 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);
     }
 }
Exemplo n.º 6
0
 protected string GetFieldString(ItemField field)
 {
     return(field.GetString(MakeBlowFish()));
 }
Exemplo n.º 7
0
 protected byte[] GetField(ItemField field)
 {
     return(field.Get(MakeBlowFish()));
 }