Example #1
0
            /// <summary>
            /// Builds the dictionary mapping an element type to its ordinal index relative to other siblings within
            /// the parent.
            /// </summary>
            /// <returns>The dictionary of ordinal indexes.</returns>
            private Dictionary <string, int> BuildInputOrderDictionary()
            {
                Dictionary <string, int> result;
                IEnumerable <OutputItem> inputOrder;
                int index;

                result = new Dictionary <string, int>();

                index      = 0;
                inputOrder = this.Consumer.XliffInputOrder;
                foreach (OutputItem item in inputOrder)
                {
                    string key;

                    switch (item.ItemType)
                    {
                    case OutputItemType.Child:
                        key = ElementState.MakeKey(item.ItemType, item.ChildType);
                        break;

                    case OutputItemType.Extension:
                        key = ElementState.MakeKey(item.ItemType, typeof(IExtension));
                        break;

                    case OutputItemType.Text:
                        key = ElementState.MakeKey(item.ItemType, typeof(string));
                        break;

                    default:
                        Debug.Assert(false, string.Format("OutputItemType.{0} is not supported.", item.ItemType));
                        key = null;
                        break;
                    }

                    result.Add(key, item.GroupOrdinal);
                    index++;
                }

                return(result);
            }