private static void ParseWidth(FormatSetting formatSetting, string width) { if (string.IsNullOrEmpty(width)) { return; } if (!width.Contains(".")) { formatSetting.IsWidthSpecified = true; formatSetting.IntegerWidth = int.Parse(width); return; } if (width.StartsWith(".")) { formatSetting.FractionWidth = int.Parse(width.Substring(1)); } else { string[] parts = width.Split("."); formatSetting.IntegerWidth = int.Parse(parts[0]); formatSetting.FractionWidth = int.Parse(parts[1]); formatSetting.IsWidthSpecified = true; } formatSetting.IsFractionWidthSpecified = true; }
public virtual void UpdateBarcodeFormat(FormatSetting barcodeFormat) { if (barcodeFormat == null) { throw new ArgumentNullException(nameof(barcodeFormat)); } _formatSettingRepository.Update(barcodeFormat); }
public async Task InsertShelfLocationFormat(FormatSetting shelfLocationFormat) { if (shelfLocationFormat == null) { throw new ArgumentNullException(nameof(shelfLocationFormat)); } await _formatSettingRepository.InsertAsync(shelfLocationFormat); }
public virtual void DeleteShelfLocationFormat(FormatSetting shelfLocationFormat) { if (shelfLocationFormat == null) { throw new ArgumentNullException(nameof(shelfLocationFormat)); } _formatSettingRepository.Delete(shelfLocationFormat); }
private static void ParseFlags(FormatSetting formatSetting, string flags) { foreach (var flag in flags) { if (flag == '0') { formatSetting.IsZeroPadded = true; continue; } if (flag == ',') { formatSetting.HasLocalSpesificSeparator = true; continue; } throw new NotSupportedException(); } }
private static void ConvertParts(string[] parts) { int index = 0; for (int i = 0; i < parts.Length; i++) { var part = parts[i]; if (string.IsNullOrWhiteSpace(part)) { continue; } if (_stringSplitter.Match(part).Success) { var formatparts = _formatSplitter.Split(part); var flags = formatparts[1]; var width = formatparts[2]; var conversion = formatparts[3]; var formatSetting = new FormatSetting { Index = index }; if (!string.IsNullOrWhiteSpace(flags)) { ParseFlags(formatSetting, flags); } if (!string.IsNullOrWhiteSpace(width)) { ParseWidth(formatSetting, width); } formatSetting.SetConversion(conversion[0]); parts[i] = formatSetting.ToString(); index++; } } }
public override string FormatAsCSSSupport(FormatSetting setting) { return(Value); }
public abstract string FormatAsCSSSupport(FormatSetting setting);
public string FormatAsCSSSupport(FormatSetting setting) { return(string.Join(Environment.NewLine, FormatableCSSElements.Select(x => x.FormatAsCSSSupport(null)))); }
public string FormatAsCSSSupport(FormatSetting setting) { var format = $"{Name} {{ {string.Join(Environment.NewLine,Properties.Select(x=>x.FormatAsCSSSupport(setting)))} }}"; return(format); }