Esempio n. 1
0
        private List <Rec> list; // does not include version

        private string VersionToText(int major, int minor, string comment)
        {
            string majorMinor = FtStandardText.Get(major) + VersionPartsSeparator.ToString() + FtStandardText.Get(minor);

            if (comment.Length == 0)
            {
                return(majorMinor);
            }
            else
            {
                return(majorMinor + VersionPartsSeparator.ToString() + comment);
            }
        }
Esempio n. 2
0
        internal protected virtual bool ResolveItemsTo(FtMetaSequence sequence, FtMetaFieldList fieldList, FtMetaSequenceList sequenceList, out string errorDescription)
        {
            ItemSorter.Rec[]          sorterRecArray = new ItemSorter.Rec[itemList.Count + fieldIndices.Length];
            SequenceItemReadElement[] sortedItemElements;

            for (int i = 0; i < itemList.Count; i++)
            {
                SequenceItemReadElement itemElement = itemList[i];

                sorterRecArray[i].Target   = itemElement;
                sorterRecArray[i].Implicit = i;
                sorterRecArray[i].Explicit = itemElement.ExplicitIndex;
            }

            int elementallyDefinedItemCount = itemList.Count;

            for (int i = 0; i < fieldIndices.Length; i++)
            {
                SequenceItemReadElement itemElement = new SequenceItemReadElement();
                // Add FieldIndex to element as if it were read from an attribute.
                int    fieldIndex     = fieldIndices[i];
                string attributeName  = SequenceItemPropertyIdFormatter.ToAttributeName(FtMetaSequenceItem.PropertyId.FieldIndex);
                string attributeValue = FtStandardText.Get(fieldIndex);
                if (!itemElement.TryAddOrIgnoreAttribute(attributeName, attributeValue, out errorDescription))
                {
                    throw FtInternalException.Create(InternalError.SequenceReadElement_ResolveItemsTo_TryAddOrIgnoreAttribute, errorDescription); // program error
                }
                else
                {
                    int implicitIndex = elementallyDefinedItemCount + i;
                    sorterRecArray[implicitIndex].Target   = itemElement;
                    sorterRecArray[implicitIndex].Implicit = implicitIndex;
                    sorterRecArray[implicitIndex].Explicit = -1;
                }
            }

            int duplicateExplicitIndex;

            if (!ItemSorter.TrySort(sorterRecArray, out sortedItemElements, out duplicateExplicitIndex))
            {
                errorDescription = string.Format(Properties.Resources.SequenceReadElement_ResolveItemsTo_DuplicateExplicitIndex, duplicateExplicitIndex);
                return(false);
            }
            else
            {
                errorDescription = "";
                bool result = true;

                for (int i = 0; i < sortedItemElements.Length; i++)
                {
                    SequenceItemReadElement itemElement = sortedItemElements[i];
                    FtMetaSequenceItem      item        = sequence.ItemList.New();
                    if (!itemElement.ResolveTo(item, fieldList, sequenceList, out errorDescription))
                    {
                        result = false;
                        break;
                    }
                }

                return(result);
            }
        }