예제 #1
0
        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);
        }
예제 #2
0
        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);
                }
            }
        }