public SameCaseSpacingSuppressor( int minSpace = 0, int?maxSpace = 1, string trackedChars = null, CharCase trackedCharCase = CharCase.Upper) : base(minSpace, maxSpace, trackedChars, trackedCharCase, true) { }
public AdjacentSameCaseSuppressor( int minLength = 0, int?maxLength = 1, string trackedChars = null, CharCase trackedCharCase = CharCase.Upper) : base(minLength, maxLength, trackedChars, trackedCharCase, true) { }
public static string ToChangeCase(string data, CharCase charCase) { switch (charCase) { case CharCase.lower: return data.ToLower(); case CharCase.upper: return data.ToUpper(); default: return System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(data); } }
/// <summary> /// Used for injection of pre-parsed value list /// </summary> public FieldAttribute( JSONDataMap valueList, string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, metadata) { if (valueList == null) { throw new DataException("FieldAttribute(JSONDataMap valueList==null)"); } StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; m_CacheValueListPresetInCtor = true; m_CacheValueList_Insensitive = valueList; m_CacheValueList_Sensitive = valueList; ValueList = null; }
public FieldAttribute( string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, string valueList = null, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null, bool isArow = false ) : base(targetName, metadata) { StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; ValueList = valueList; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; IsArow = isArow; }
protected SuppressorBase(int min, int?max, string trackedChars, CharCase trackedCharCase, bool ignoreCase) { MaxInternal = NormalizeMax(max); MinInternal = NormalizeMin(min, max); TrackedChars = trackedChars; TrackedCharCaseInternal = trackedCharCase; if (trackedCharCase == CharCase.Lower) { HasTrackedCase = char.IsLower; } else { HasTrackedCase = char.IsUpper; } IgnoreCaseInternal = ignoreCase; BuildTrackedCharset(); IsEmpty = TrackedCharset == null; }
public FixedVariationGenerator( string chars, int?minLength = null, CharCase charCase = CharCase.AsDefined, IList <ISuppressor> suppressors = null, ICharMapper mapper = null) : base(suppressors, mapper) { if (string.IsNullOrEmpty(chars)) { throw new ArgumentNullException(nameof(chars), $"Empty parameter: {nameof(chars)}"); } OriginalChars = chars; MinLength = NormalizeMinLength(minLength); CharCase = charCase; BuildChars(); Reset(); LoopCount = GetLoopCount(); }
/// <summary> /// Из кириллицы в латиницу /// </summary> public static string Transliterate(string text, CharCase charCase = CharCase.Upper, TransliterationType type = TransliterationType.ISO) { Dictionary <string, string> tdict = GetDictionaryByType(type); string output = string.Empty; StringBuilder sb = new StringBuilder(text); for (int i = 0; i < sb.Length; i++) { if (tdict.ContainsKey(sb[i].ToString())) { output += tdict[sb[i].ToString()]; } else { output += sb[i].ToString(); } } switch (charCase) { case CharCase.AsIs: return(output); case CharCase.Upper: return(output.ToUpper()); case CharCase.Lower: return(output.ToLower()); default: return(output); } /* * string output = text; * Dictionary<string, string> tdict = GetDictionaryByType(type); * * foreach (var key in tdict) * { * output = output.Replace(key.Key, key.Value); * } * return output; */ }
public FieldAttribute( string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, string valueList = null, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string description = null, string metadata = null, bool nonUI = false ) : base(targetName, metadata) { StoreFlag = storeFlag; BackendName = backendName; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; ValueList = valueList; Description = description; NonUI = nonUI; }
protected virtual string MapCLRCharCaseToJS(CharCase kind) { return(kind.ToString().ToLowerInvariant()); }
public FieldAttribute( Type protoType, string protoFieldName, //Schema:Field string targetName = ANY_TARGET, object storeFlag = null, object key = null, object kind = null, object required = null, object visible = null, string valueList = null, object dflt = null, object min = null, object max = null, object minLength = null, object maxLength = null, object charCase = null, string backendName = null, string backendType = null, string description = null, string metadata = null, object nonUI = null, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, null) { if (protoType==null || protoFieldName.IsNullOrWhiteSpace()) throw new CRUDException(StringConsts.ARGUMENT_ERROR+"FieldAttr.ctor(protoType|protoFieldName=null|empty)"); try { var schema = Schema.GetForTypedRow(protoType); var protoTargetName = targetName; var segs = protoFieldName.Split(':'); if (segs.Length>1) { protoTargetName = segs[0].Trim(); protoFieldName = segs[1].Trim(); } if (protoTargetName.IsNullOrWhiteSpace()) throw new Exception("Wrong target syntax"); if (protoFieldName.IsNullOrWhiteSpace()) throw new Exception("Wrong field syntax"); var protoFieldDef = schema[protoFieldName]; if (protoFieldDef==null) throw new Exception("Prototype '{0}' field '{1}' not found".Args(protoType.FullName, protoFieldName)); var protoAttr = protoFieldDef[protoTargetName]; try { StoreFlag = storeFlag == null? protoAttr.StoreFlag : (StoreFlag)storeFlag; BackendName = backendName == null? protoAttr.BackendName : backendName; BackendType = backendType == null? protoAttr.BackendType : backendType; Key = key == null? protoAttr.Key : (bool)key; Kind = kind == null? protoAttr.Kind : (DataKind)kind; Required = required == null? protoAttr.Required : (bool)required; Visible = visible == null? protoAttr.Visible : (bool)visible; Min = min == null? protoAttr.Min : min; Max = max == null? protoAttr.Max : max; Default = dflt == null? protoAttr.Default : dflt; MinLength = minLength == null? protoAttr.MinLength : (int)minLength; MaxLength = maxLength == null? protoAttr.MaxLength : (int)maxLength; CharCase = charCase == null? protoAttr.CharCase : (CharCase)charCase; ValueList = valueList == null? protoAttr.ValueList : valueList; Description = description == null? protoAttr.Description : description; NonUI = nonUI == null? protoAttr.NonUI : (bool)nonUI; FormatRegExp = formatRegExp == null? protoAttr.FormatRegExp: formatRegExp; FormatDescription= formatDescr == null? protoAttr.FormatDescription: formatDescr; DisplayFormat = displayFormat== null? protoAttr.DisplayFormat : displayFormat; if (metadata.IsNullOrWhiteSpace()) m_MetadataContent = protoAttr.m_MetadataContent; else if (protoAttr.m_MetadataContent.IsNullOrWhiteSpace()) m_MetadataContent = metadata; else { var conf1 = ParseMetadataContent(protoAttr.m_MetadataContent); var conf2 = ParseMetadataContent(metadata); var merged = new LaconicConfiguration(); merged.CreateFromMerge(conf1, conf2); m_MetadataContent = merged.SaveToString(); } } catch(Exception err) { throw new Exception("Invalid assignment of prototype override value: " + err.ToMessageWithType()); } } catch(Exception error) { throw new CRUDException(StringConsts.CRUD_FIELD_ATTR_PROTOTYPE_CTOR_ERROR.Args(error.Message)); } }
/// <summary> /// Used for injection of pre-parsed value list /// </summary> public FieldAttribute( JSONDataMap valueList, string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, metadata) { if (valueList == null) throw new CRUDException("FieldAttribute(JSONDataMap valueList==null)"); StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; m_CacheValueListPresetInCtor = true; m_CacheValueList_Insensitive = valueList; m_CacheValueList_Sensitive = valueList; ValueList = null; }
protected virtual string MapCLRCharCaseToJS(CharCase kind) { return kind.ToString().ToLowerInvariant(); }
public MaskItem(int kind, CharCase charCase, char simbol) { Kind = kind; Simbol = simbol; OldSimbol = simbol; CharCase = charCase; }
public MaskItem(int kind, CharCase charCase) { Kind = kind; Simbol = '\0'; OldSimbol = '\0'; CharCase = charCase; }