コード例 #1
0
        public static HeapCell.TDescriptorType DescriptorType(HeapCell aCell)
        {
            HeapCell.TDescriptorType ret = HeapCell.TDescriptorType.EUnknown;
            //
            int type = (int)(aCell.PossibleVTableAddress >> KDescriptorTypeShiftCount);

            if (type >= (int)HeapCell.TDescriptorType.EBufC && type < (int)HeapCell.TDescriptorType.EUnknown)
            {
                ret = (HeapCell.TDescriptorType)type;
            }
            //
            return(ret);
        }
        internal override bool IsDescriptor(HeapCell aCell, out DescriptorInfo aInfo)
        {
            // Base-class makes first pass.
            bool isDes = base.IsDescriptor(aCell, out aInfo);

            //
            if (isDes)
            {
                DescriptorInfo           info = new DescriptorInfo(aCell);
                HeapCell.TDescriptorType type = info.Type;

                // There needs to be at least two raw items, one for the descriptor type & length, and
                // another for the max length.
                if (type != HeapCell.TDescriptorType.EUnknown && RawItems.Count > 2 && type == HeapCell.TDescriptorType.EBuf)
                {
                    // Now we can check if it meet our requirements...
                    int length    = base.CalculatedDescriptorLength;
                    int maxLength = base.CalculatedDescriptorMaxLength;
                    //
                    bool allWerePrintableCharacers = false;
                    int  printCharCount            = PrintableCharacterCount(length, DesAsciiAlgorithmBase.KDescriptorRawItemOffsetEBufC, out allWerePrintableCharacers);
                    //
                    if (printCharCount == length && length <= maxLength)
                    {
                        aInfo      = info;
                        aInfo.Text = ConvertToText(length, DesAsciiAlgorithmBase.KDescriptorRawItemOffsetEBufC);
                        isDes      = true;
                    }
                }
                else if (type == HeapCell.TDescriptorType.EBufCPtr)
                {
                    int x = 0;
                    x++;
                }
            }
            //
            return(isDes);
        }