private void AddInputSequence(string txt, InputType type, bool hasParan, bool isSet) { // if we're in a programmer mode if (_isMainWindow && _mainPage.isProgrammer() && isValue(type)) { // get our decimal converted value string dec = GetTextFromList(); // first get the original expression string expOrig = GetExpression(dec, false); // add onto it the new value string expLong = expOrig + GetExpression(txt, true); //string binRep expOrig += GetExpression(txt, false); // get the new decimal expression dec = GetDecimal(expLong, true); // if there was an overflow exception converting out value if (dec == CalcViews.Programmer.EXCEPTION_STR) { return; } else if (dec == string.Empty) { dec = "0"; } // for current bitness make sure the value isn't too big // Here we're right shifting since this stuff is signed if ((currentView as ProgrammerView).currentBits == Calculator.CalcViews.Programmer.ProgrammerCalcBits.Byte && (long.Parse(dec) >> 1) > sbyte.MaxValue || (currentView as ProgrammerView).currentBits == Calculator.CalcViews.Programmer.ProgrammerCalcBits.Word && (long.Parse(dec) >> 1) > short.MaxValue || (currentView as ProgrammerView).currentBits == Calculator.CalcViews.Programmer.ProgrammerCalcBits.Dword && (long.Parse(dec) >> 1) > int.MaxValue || (currentView as ProgrammerView).currentBits == Calculator.CalcViews.Programmer.ProgrammerCalcBits.Qword && (long.Parse(dec) >> 1) > long.MaxValue) { return; } // now that we validated, get the real SIGNED value dec = GetDecimal(expOrig, false); if (dec == string.Empty) { dec = "0"; } // clear input sequence _inputSequence.Clear(); // re-add to the sequence _inputSequence.Add(new InputValue(InputType.Int, dec, hasParan)); } // if we're in scientific or stat mode else { _inputSequence.Add(new InputValue(type, txt, hasParan)); } }