public string AsString() { BaseIntegerType charType; if (BaseIntegerType.CommonCharType.Base != 8) { charType = BaseIntegerType.CommonCharType; } else { charType = new BaseIntegerType(8, false, "_tmp_char"); } List <Integer> chars = new List <Integer>(); foreach (Object obj in Collection) { if (obj.Type.Type == TypeReferenceType.Integer) { chars.AddRange(obj.IntegerValue.Cast(charType)); } else { chars.AddRange($"[{obj.Type.ToString()}]".Select(p => (Integer)p)); } } return(new string(chars.Select(p => (char)p).ToArray())); }
public Integer(ulong value, BaseIntegerType type) { unchecked { Type = type; Value = value & type.BitMask; } }
public List <Integer> Cast(BaseIntegerType type) { unchecked { if (Type.Base < type.Base) { return new List <Integer>() { new Integer(Value, type) } } ; int count = Type.Base / type.Base; var result = new List <Integer>(); for (int i = 0; i < count; i++) { result.Add(new Integer(Value >> i * type.Base, type)); } return(result); } }