Example #1
0
 public TypeSignature(TypeSignatureEnum signatureEnum, string modifier, string returnType, string name)
 {
     TypeSignatureEnum = signatureEnum;
     Modifier          = modifier;
     ReturnType        = returnType;
     Name = name;
 }
Example #2
0
        public TextDescription(TypeSignatureEnum type, TagTableEntry profDesc)
        {
            if (type!=TypeSignatureEnum.multiLocalizedUnicode)
            {
                Text = Utils.ASCIIString((int)profDesc.OffsetOfBegin+12, (int)profDesc.SizeOfTagData - 20);
            }
            else
            {
                string curCulture = Thread.CurrentThread.CurrentCulture.Name;
                int index = (int)profDesc.OffsetOfBegin+8;//first 8 byte is type signature or reserved
                int RecordCount = (int)Utils.uInt32Number(index);//Number of records
                int RecordSize = (int)Utils.uInt32Number(index + 4);//the length in bytes of every record. The value is 12

                string[] cltInfo = new string[RecordCount];// information about what language and region the string is for
                int[] strLen = new int[RecordCount];
                int[] strOffset = new int[RecordCount];
                int end = index + 8 + RecordCount * RecordSize;
                int j = 0;
                for (int i = index + 8; i < end; i += RecordSize)
                {
                    cltInfo[j] = Utils.ASCIIString(i, 2)+"-"+Utils.ASCIIString(i + 2, 2);
                    strLen[j] = (int)Utils.uInt32Number(i + 4);
                    strOffset[j] = (int)Utils.uInt32Number(i + 8);
                    j++;
                }
                lsText = new LocaleString[RecordCount];
                for (int i = 0; i < RecordCount; i++)
                { lsText[i] = new LocaleString(cltInfo[i], index + strOffset[i] - 8, strLen[i]); }

                LocaleString ls = lsText.Where(x=>x.Locale.Name==curCulture).FirstOrDefault();
                if (ls!=null)
                {
                    Text = ls.Text;
                }
                else
                {
                    Text = lsText[0].Text;
                }
            }
        }