Esempio 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);
        }
Esempio 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);
        }
Esempio n. 3
0
        public void SetUnknownField(FieldType ft, byte[] data)
        {
            var unkrfe = new ItemField(ft);

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