Exemplo n.º 1
0
        /// <summary>
        /// The header row only has the bottom bits of the column header, so it has redundancies or incomplete names.
        /// </summary>
        /// <param name="headerRow"></param>
        private static void MapHeaderColumns(IList <PositionedDiv> headerRow)
        {
            int placeCount = 0;
            int timeCount  = 0;
            int typeCount  = 0;
            int dayCount   = 0;
            int nightCount = 0;

            HashSet <string> hs = new HashSet <string>();

            for (int i = 0; i < headerRow.Count; i++)
            {
                PositionedDiv pd = headerRow[i];
                switch (pd.value.ToUpperInvariant())
                {
                case "FLIGHT":
                    pd.value = "Flight Number";
                    break;

                case "PLACE":
                    pd.value = (placeCount == 0) ? "From" : "To";
                    placeCount++;
                    break;

                case "TIME":
                    pd.value = (timeCount == 0) ? "Block Out Time" : ((timeCount == 1) ? "Block In Time" : "Ground Simulator");
                    timeCount++;
                    break;

                case "TYPE":
                    pd.value = (typeCount == 0) ? "Model" : "Simulator/Training Device Identifier";
                    typeCount++;
                    break;

                case "OF FLIGHT":
                    pd.value = "Total Flight Time";
                    break;

                case "DAY":
                    pd.value = (dayCount == 0) ? "Takeoffs (any)" : "FS Day Landings";
                    dayCount++;
                    break;

                case "NIGHT":
                    pd.value = (nightCount == 0) ? "Takeoffs - Night" : "FS Night Landings";
                    nightCount++;
                    break;

                default:
                {
                    // avoid other duplicates.  E.g., "#" is on some ecrew.  Also catch any empty values.
                    string szValue = pd.value.Trim();
                    int    ext     = 0;
                    while (String.IsNullOrEmpty(szValue) || hs.Contains(szValue))
                    {
                        szValue = pd.value + ext++.ToString(CultureInfo.InvariantCulture);
                    }
                    pd.value = szValue;
                    hs.Add(szValue);
                }
                break;
                }
            }
        }
Exemplo n.º 2
0
        public int CompareTo(Object obj)
        {
            PositionedDiv pd = obj as PositionedDiv;

            return((pd.y == y) ? x.CompareTo(pd.x) : y.CompareTo(pd.y));
        }