private void SendHex(TextBox textBox) { var bytes = Hexadecimal.Parse(textBox.Text); textBox.Text = Hexadecimal.ToString(bytes); buffer.Output(bytes, false); ior.Run(() => iom.Write(bytes)); }
private void DataBind() { this.cmbColors.Items.Clear(); foreach (int argb in this.colors) { Color c = Color.FromArgb(argb); this.cmbColors.Items.Add("#" + Hexadecimal.ToString(c.R, 2) + Hexadecimal.ToString(c.G, 2) + Hexadecimal.ToString(c.B, 2)); } if (this.currentColor != null && this.currentColor.HasValue) { this.cmbColors.Text = "#" + Hexadecimal.ToString(this.currentColor.Value.R, 2) + Hexadecimal.ToString(this.currentColor.Value.G, 2) + Hexadecimal.ToString(this.currentColor.Value.B, 2); } else { this.cmbColors.Text = ""; } }
private static ExitCode RunDecodeOptionsAndReturnExitCode(DecodeOptions decodeOptions) { string decodedString = null; string errorMsg = null; switch (decodeOptions.DecodeType.ToLower()) { case "base64": { decodedString = Base64.ToString(decodeOptions.InputToDecode); } break; case "hex": { decodedString = Hexadecimal.ToString(decodeOptions.InputToDecode); } break; default: errorMsg = $"Unknown decode type \"{decodeOptions.DecodeType}\"."; break; } if (string.IsNullOrWhiteSpace(errorMsg)) { Console.WriteLine(decodedString); return(ExitCode.Sucess); } else { Console.WriteLine(errorMsg); return(ExitCode.Error); } }