protected override void OnKeyPress(KeyPressEventArgs e) { int v = 0; int num2 = 0; if ((this.m_TextSelected < 0) || (this.m_TextSelected >= this.m_TextParts.Count)) { base.OnKeyPress(e); } else { if ((e.KeyChar >= '0') && (e.KeyChar <= '9')) { num2 = e.KeyChar - '0'; } else { return; } TextPart p = (TextPart)this.m_TextParts[this.m_TextSelected]; DateTime valueInternal = this.GetValueInternal(); if ((p.Format.IndexOf("h") >= 0) || (p.Format.IndexOf("H") >= 0)) { v = valueInternal.Hour; } else if (p.Format.IndexOf("m") >= 0) { v = valueInternal.Minute; } else if (p.Format.IndexOf("d") >= 0) { v = valueInternal.Day; } else if (p.Format.IndexOf("M") >= 0) { v = valueInternal.Month; } else { if (p.Format.IndexOf("y") >= 0) { this.m_doParse = false; string str = p.Text + num2; if (str.Length > p.Format.Length) { str = str.Substring(1, str.Length - 1); } p.Text = str; v = valueInternal.Year; base.Invalidate(); return; } if (p.Format.IndexOf("s") >= 0) { v = valueInternal.Second; } } v = (v * 10) + num2; try { valueInternal = this.SetKeyDate(p, v, valueInternal); } catch { try { string str2 = v.ToString(); if (str2.Length > 1) { v = Convert.ToInt32(str2.Remove(0, 1)); } valueInternal = this.SetKeyDate(p, v, valueInternal); } catch { try { valueInternal = this.SetKeyDate(p, num2, valueInternal); } catch { return; } } } this.Value = valueInternal; } }