SIL.FieldWorks.Common.RootSites.CollectorEnv.ConvertVwEnvStackToSelLevInfo C# (CSharp) Method

ConvertVwEnvStackToSelLevInfo() protected static method

Converts the VwEnv Collector Stack to a SelLevInfo array.
protected static ConvertVwEnvStackToSelLevInfo ( IList locationStack, int cPropPrevRootLevel ) : SelLevInfo[]
locationStack IList The vwEnv collector stack.
cPropPrevRootLevel int The count of previous occurrences of the base item on the stack..
return SelLevInfo[]
		protected static SelLevInfo[] ConvertVwEnvStackToSelLevInfo(IList<StackItem> locationStack, int cPropPrevRootLevel)
		{
			var location = new SelLevInfo[locationStack.Count];
			for (int i = 0, iSelLevInfo = locationStack.Count - 1; i < locationStack.Count; i++, iSelLevInfo--)
			{
				StackItem item = locationStack[i];
				location[iSelLevInfo] = item.ToSelLevInfo();
				if (i > 0)
				{
					StackItem prevItem = locationStack[i - 1];
					int tagLevel = location[iSelLevInfo].tag;
					// See how many times the next outer level has seen the
					// property for this level.
					int cpropPrevious = prevItem.m_cpropPrev.GetCount(tagLevel);
					location[iSelLevInfo].cpropPrevious = cpropPrevious;
				}
				else
				{
					location[iSelLevInfo].cpropPrevious = cPropPrevRootLevel;
				}
			}
			//foreach (StackItem item in locationStack)
			//    m_location[iSelLevInfo--] = item.ToSelLevInfo();
			return location;
		}