Esempio n. 1
0
        /// <summary>
        /// Get the combined modifier code for the coding scheme.
        /// </summary>
        /// <param name="symbolCode">the symbol code</param>
        /// <returns>a friendly name for the combined modifier code</returns>
        public static string GetName(string symbolCode)
        {
            if (!SymbolData.Check(ref symbolCode))
            {
                return(string.Empty);
            }

            char leadCode  = ModifierCode.GetCode(symbolCode);
            char trailCode = Echelon.GetCode(symbolCode);

            if (leadCode == ModifierCode.Mobility || leadCode == ModifierCode.Towed)
            {
                return(Mobility.GetName(symbolCode));
            }

            if (leadCode == ModifierCode.Installation)
            {
                return((trailCode == 'B') ? "Feint Dummy Installation" : "Installation");
            }

            string mod = ModifierCode.GetName(symbolCode);
            string ech = Echelon.GetName(symbolCode);

            if (string.IsNullOrEmpty(mod) || string.IsNullOrEmpty(ech))
            {
                return(string.Empty);
            }

            if (mod == "None" && ech == "None")
            {
                return(string.Empty);
            }

            if (mod == "None")
            {
                return(ech);
            }

            if (ech == "None")
            {
                return(mod);
            }

            return(mod + "\n" + ech);
        }
Esempio n. 2
0
        public void EchelonTest()
        {
            char gc = Echelon.GetCode(string.Empty);

            Assert.AreEqual(gc, (char)0);
            gc = Echelon.GetCode(null);
            Assert.AreEqual(gc, (char)0);
            gc = Echelon.GetCode("qqqqqqqqqqqqqqq");
            Assert.AreEqual(gc, 'Q');
            string str = Echelon.GetName(string.Empty);

            Assert.AreEqual(str, string.Empty);
            str = Echelon.GetName(null);
            Assert.AreEqual(str, string.Empty);
            str = Echelon.GetName("qqqqqqqqqqqqqqq");
            Assert.AreEqual(str, string.Empty);
            str = Echelon.GetName("qqpqqqqqqqqhqqq");
            Assert.AreEqual(str, "Brigade");
        }