public override bool DoCheck(FValidatorParameters parameters) { string value = RString.Nvl(parameters.Value); if (!RString.IsEmpty(value)) { string[] items = value.Split('.'); if (items.Length != 4) { parameters.Description = _resource.FindDisplay(MSG_INVALID, _description); return(false); } foreach (string item in items) { int result = 0; if (!Int32.TryParse(item, out result)) { parameters.Description = _resource.FindDisplay(MSG_INVALID, _description); return(false); } if (result < 0 || result > 255) { parameters.Description = _resource.FindDisplay(MSG_INVALID, _description); return(false); } } } return(true); }
//============================================================ // <T>序列化内容到输出流。</T> // // @param output 输出流 //============================================================ public override void OnSerialize(IOutput output) { base.OnSerialize(output); output.WriteUint8((byte)_textAlignCd); _font.Serialize(output); output.WriteWideString(RString.Nvl(_text, _label)); }
//============================================================ public static string MakeFileName(string path) { path = RString.Nvl(path).Replace('/', '\\'); if (path.EndsWith(@"\")) { path = path.Substring(0, path.Length - 1); } return(path); }
public override bool DoCheck(FValidatorParameters parameters) { string value = RString.Nvl(parameters.Value); if (RString.IsBlank(value)) { parameters.Description = _resource.FindDisplay(MSG_IS_BLANK, _description); return(false); } return(true); }
public override FDumpInfo Dump(FDumpInfo info) { RDump.StartDump(info); info.AppendProperty(PTY_ID, _id, true); info.AppendProperty(PTY_FACE, _faceName, true); info.AppendProperty(PTY_TYPE, _typeName, true); info.AppendProperty(PTY_SCOPE, _scope, true); // Get max id length int idlength = 0; if (!_initializes.IsEmpty() || _releases.IsEmpty()) { // Initialize max id length for (int n = 0; n < _initializes.Count; n++) { idlength = Math.Max(idlength, RString.Nvl(_initializes[n].Id).Length); } // Release max id length for (int n = 0; n < _releases.Count; n++) { idlength = Math.Max(idlength, RString.Nvl(_releases[n].Id).Length); } } // Initializes if (!_initializes.IsEmpty()) { for (int n = 0; n < _initializes.Count; n++) { info.AppendLine(); RDump.AppendSpace(info, info.Deep + 1); info.Append("Initialize: "); info.Append(RString.Nvl(_initializes[n].Id).PadRight(idlength)); info.Append(" = "); _initializes[n].Dump(info); } } // Releases if (!_releases.IsEmpty()) { for (int n = 0; n < _releases.Count; n++) { info.AppendLine(); RDump.AppendSpace(info, info.Deep + 1); info.Append("Release: "); info.Append(RString.Nvl(_releases[n].Id).PadRight(idlength)); info.Append(" = "); _releases[n].Dump(info); } } return(info); }
public override bool DoCheck(FValidatorParameters parameters) { string value = RString.Nvl(parameters.Value); if (!RString.IsEmpty(value)) { if (!RString.CheckPattern(value, _partternChars)) { parameters.Description = _resource.FindDisplay(MSG_INVALID_PARTTERN, _description); return(false); } } return(true); }
//============================================================ public static string MakeFileName(string path, string name) { path = RString.Nvl(path).Replace('/', '\\'); name = RString.Nvl(name).Replace('/', '\\'); if (path.EndsWith(@"\")) { path = path.Substring(0, path.Length - 1); } if (!name.StartsWith(@"\")) { name = '\\' + name; } return(path + name); }
//============================================================ // <T>处理鼠标单击变更标志事件。</T> // // @param sender 发送者 // @param e 事件 //============================================================ private void pbxSign_Click(object sender, EventArgs e) { // 设置文本 txtContent.Text = RString.Nvl(_textOrign); pbxSign.Visible = false; // 产生事件 if (SignClick != null) { SignClick(sender, e); } // 光标定位到文本最后 txtContent.Select(txtContent.TextLength, 0); txtContent.ScrollToCaret(); }
//============================================================ // <T>格式化路径为代码。</T> //============================================================ public static string FormatPathToCode(string path) { path = RString.Nvl(path).Trim(); // 置换分隔符 path = path.Replace('\\', '.').Replace('/', '.'); if (path.StartsWith(".")) { path = path.Substring(1); } // 去除前缀 int find = path.IndexOf('_'); if (-1 != find) { path = path.Substring(find); } return(path); }
public override bool DoCheck(FValidatorParameters parameters) { string value = RString.Nvl(parameters.Value); if (!RString.IsEmpty(value)) { int length = value.Length; // Min check if (_minLength > 0 && length < _minLength) { parameters.Description = _resource.FindDisplay(MSG_LENGTH_LOWER, _description, length, _minLength); } // Max check if (_maxLength > 0 && length > _maxLength) { parameters.Description = _resource.FindDisplay(MSG_LENGTH_LAGER, _description, length, _maxLength); } return(false); } return(true); }
//============================================================ // <T>测试一个对象内容是否为真。</T> // // @param value 对象 // @return 是否为真 //============================================================ public static bool IsTrue(object value) { return(IsTrue(RString.Nvl(value))); }