Inheritance: TargetObject
Example #1
0
		public EnumVariable(string name, StackFrame stackFrame, TargetEnumObject obj)
		{
			this.name = name;
			this.stackFrame = stackFrame;
			this.obj = obj;
			
			this.value = GetValue();
		}
Example #2
0
        protected void FormatEnum(Thread target, TargetEnumObject eobj)
        {
            TargetObject evalue = eobj.GetValue (target);
            TargetFundamentalObject fobj = evalue as TargetFundamentalObject;

            if ((DisplayFormat == DisplayFormat.HexaDecimal) || (fobj == null)) {
                FormatObjectRecursed (target, evalue, true);
                return;
            }

            object value = fobj.GetObject (target);

            SortedList members = new SortedList ();
            foreach (TargetEnumInfo field in eobj.Type.Members)
                members.Add (field.Name, field.ConstValue);

            if (!eobj.Type.IsFlagsEnum) {
                foreach (DictionaryEntry entry in members) {
                    if (entry.Value.Equals (value)) {
                        Append ((string) entry.Key);
                        return;
                    }
                }
            } else if (value is ulong) {
                bool first = true;
                ulong the_value = (ulong) value;
                foreach (DictionaryEntry entry in members) {
                    ulong fvalue = System.Convert.ToUInt64 (entry.Value);
                    if ((the_value & fvalue) != fvalue)
                        continue;
                    if (!first) {
                        Append (" | ");
                        CheckLineWrap ();
                    }
                    first = false;
                    Append ((string) entry.Key);
                }
                if (!first)
                    return;
            } else {
                bool first = true;
                long the_value = System.Convert.ToInt64 (value);
                foreach (DictionaryEntry entry in members) {
                    long fvalue = System.Convert.ToInt64 (entry.Value);
                    if ((the_value & fvalue) != fvalue)
                        continue;
                    if (!first) {
                        Append (" | ");
                        CheckLineWrap ();
                    }
                    first = false;
                    Append ((string) entry.Key);
                }
                if (!first)
                    return;
            }

            FormatObjectRecursed (target, fobj, true);
        }