private IDictionary <string, string> MakeResults(BitsModel bit) { int index = Array.IndexOf(this.sizes, bit.TypeSize); double[] result = new double[this.sizes.Length]; result[index] = bit.Value; this.CalculateToLeft(result, index - 1); this.CalculateToRight(result, index + 1); IDictionary <string, string> pairs = new Dictionary <string, string>(); for (int i = 0; i < result.Length; i++) { string keyByte = this.sizes[i].ToString(); string keyBit = keyByte.Replace("Byte", "bit"); string valueByte = result[i].ToString(); string valuebite = (result[i] * BitByteDifferance).ToString(); pairs[keyBit] = valuebite; pairs[keyByte] = valueByte; } return(pairs); }
public ActionResult Index(BitsModel bits) { if (bits.Value != 0) { bits.Result = this.MakeResults(bits); } return(View(bits)); }