internal static string ToAttributeValue(DateTimeStyles styles) { string[] textArray = new string[basicRecArray.Length]; int count = 0; // Composite must match exactly for (int i = 0; i < compositeRecArray.Length; i++) { if (styles == compositeRecArray[i].Styles) { textArray[count++] = compositeRecArray[i].Text; break; } } if (count > 0) { return(FtCommaText.Get(textArray, 0, count)); } else { foreach (BasicRec rec in basicRecArray) { if (styles.HasFlag(rec.Flag)) { textArray[count++] = rec.Text; } } return(FtCommaText.Get(textArray, 0, count)); } }
private bool ResolveFieldIndices(FtMetaSequence sequence, FtMetaFieldList fieldList, out string errorDescription) { errorDescription = ""; bool result = true; string attributeValue; if (!attributeDictionary.TryGetValue(FtMetaSequence.PropertyId.FieldIndices, out attributeValue)) { fieldIndices = new int[0]; } else { int[] propertyValue; if (FtCommaText.TryParse(attributeValue, out propertyValue, out errorDescription)) { fieldIndices = propertyValue; } else { errorDescription = string.Format(Properties.Resources.SequenceReadElement_ResolveFieldIndices_Invalid, attributeValue); result = false; } } return(result); }
internal static bool TryParseAttributeValue(string attributeValue, out DateTimeStyles styles) { string[] textArray; string errorDescription; styles = DateTimeStyles.None; attributeValue = attributeValue.Trim(); if (attributeValue == "") { return(true); } else { if (!FtCommaText.TryParse(attributeValue, out textArray, out errorDescription)) { return(false); } else { bool result = true; foreach (string text in textArray) { DateTimeStyles flags; if (TryParseText(text.Trim(), out flags)) { styles |= flags; } else { result = false; break; } } return(result); } } }