public override object GetValue(object component)
        {
            FieldType type = this.field.descriptor.type;

            if (type != FieldType.Guid)
            {
                if (type == FieldType.RawGuid)
                {
                    return(BiConverter.ToString(this.field.value as byte[]));
                }
                return(this.field.value);
            }
            else
            {
                uint num = (uint)this.field.value;
                if (num >> 31 == 1u)
                {
                    Tuple <byte[], byte[]> tuple = this.field.dbx.externalGuids[(int)(num & 2147483647u)];
                    if (this.field.dbx.catHandle.guidTable.ContainsKey(tuple.Item1))
                    {
                        return(this.field.dbx.catHandle.guidTable[tuple.Item1] + "/" + BiConverter.ToString(tuple.Item2));
                    }
                    return(BiConverter.ToString(tuple.Item1) + "-" + BiConverter.ToString(tuple.Item2));
                }
                else
                {
                    if (num != 0u)
                    {
                        return(BiConverter.ToString(this.field.dbx.internalGuids[(int)(num - 1u)]));
                    }
                    return("*nullGuid*");
                }
            }
        }
 public static string ToString(byte[] value, int startIndex)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     return(BiConverter.ToString(value, startIndex, value.Length - startIndex));
 }
 public static string ToString(byte[] value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     return(BiConverter.ToString(value, 0, value.Length));
 }
 public static byte[] unhexlify(string str)
 {
     if (str.Length % 2 != 0)
     {
         throw new Exception("Cannot unhexlify. Wrong length.");
     }
     byte[] array = new byte[str.Length / 2];
     for (int i = 0; i < str.Length; i += 2)
     {
         char i2  = str[i];
         char i3  = str[i + 1];
         int  num = (int)(BiConverter.UnHexValue(i2) * 16 + BiConverter.UnHexValue(i3));
         array[i / 2] = (byte)num;
     }
     return(array);
 }
示例#5
0
 public void InitializePayload()
 {
     this.internalGuids = new List <byte[]>();
     this.binaryReader.BaseStream.Position = (long)((ulong)this.payloadSectionStart);
     this.instances = new Dictionary <string, Complex>();
     foreach (InstanceRepeater current in this.instanceRepeaters)
     {
         int num = 0;
         while ((long)num < (long)((ulong)current.repetitions))
         {
             byte[] array = this.binaryReader.ReadBytes(16);
             this.internalGuids.Add(array);
             Complex value = this.parseComplex((int)current.complexIndex, this.binaryReader);
             this.instances.Add(BiConverter.ToString(array), value);
             num++;
         }
     }
 }
        public static string ToString(byte[] value, int startIndex, int length)
        {
            if (value == null)
            {
                throw new ArgumentNullException("byteArray");
            }
            if (length == 0)
            {
                return(string.Empty);
            }
            int num = length * 2;

            char[] array = new char[num];
            int    num2  = startIndex;

            for (int i = 0; i < num; i += 2)
            {
                byte b = value[num2++];
                array[i]     = BiConverter.GetHexValue((int)(b / 16));
                array[i + 1] = BiConverter.GetHexValue((int)(b % 16));
            }
            return(new string(array));
        }