string IAmplifierExport.Line(LibraryAmplifierGroup amplifierGroup, LibraryAmplifierGroupAmplifier amplifier, LibraryAmplifierGroupAmplifierGraphic graphic)
        {
            //LibraryStandardIdentityGroup identityGroup = _configHelper.Librarian.StandardIdentityGroup(graphic.StandardIdentityGroup);

            string result = BuildAmplifierItemName(amplifierGroup, amplifier, null) + "," + BuildAmplifierCode(amplifierGroup, amplifier, null);

            return result;
        }
        string IAmplifierExport.Line(LibraryAmplifierGroup amplifierGroup, LibraryAmplifierGroupAmplifier amplifier, LibraryAmplifierGroupAmplifierGraphic graphic)
        {
            _notes = "";

            string result = "";
            string category = "";

            FindEnum find = FindEnum.FindEntities;

            switch(amplifierGroup.AmplifierGroupCode)
            {
                case 1:
                case 2:
                    find = FindEnum.FindEchelons;
                    category = "Echelon";
                    break;

                case 3:
                case 4:
                case 5:
                    find = FindEnum.FindMobilities;
                    category = "Mobility";
                    break;

                case 6:
                    find = FindEnum.FindAuxiliaryEquipment;
                    category = "Auxiliary Equipment";
                    break;
            }

            string graphicPath = _configHelper.GetPath("", find);

            string itemRootedPath = _configHelper.BuildRootedPath(graphicPath, graphic.Graphic);
            string itemOriginalPath = _configHelper.BuildOriginalPath(graphicPath, graphic.Graphic);

            if (!File.Exists(itemOriginalPath))
                _notes = _notes + "image file does not exist;";

            LibraryStandardIdentityGroup identityGroup = _configHelper.Librarian.StandardIdentityGroup(graphic.StandardIdentityGroup);

            string itemName = BuildAmplifierItemName(amplifierGroup, amplifier, identityGroup);
            string itemCategory = "Amplifier" + _configHelper.DomainSeparator + category;
            string itemTags = BuildAmplifierItemTags(amplifierGroup, amplifier, identityGroup, graphicPath + "\\" + graphic.Graphic, _omitSource, _omitLegacy);
            string itemID = BuildAmplifierCode(amplifierGroup, amplifier, identityGroup);

            result = itemRootedPath + "," +
                     Convert.ToString(_configHelper.PointSize) + "," +
                     itemName + "," +
                     itemCategory + "," +
                     itemTags + "," + 
                     itemID + "," +
                     "Point"+ "," +
                     _notes;

            return result;
        }
        protected string BuildQuotedAmplifierCode(LibraryAmplifierGroup amplifierGroup,
                                                  LibraryAmplifierGroupAmplifier amplifier,
                                                  LibraryStandardIdentityGroup identityGroup)
        {
            // Creates the quoted unique idntifier code for a given amplifier.

            string code = '"' + this.BuildAmplifierCode(amplifierGroup, amplifier, identityGroup) + '"';

            return code;
        }
        public string NameIt(LibraryAmplifierGroup amplifierGroup,
                             LibraryAmplifierGroupAmplifier amplifier,
                             LibraryStandardIdentityGroup identityGroup)
        {
            string name = "";

            if (amplifierGroup != null && amplifier != null)
                name = BuildAmplifierItemName(amplifierGroup, amplifier, identityGroup);

            return name;
        }
        protected string BuildAmplifierCode(LibraryAmplifierGroup amplifierGroup, 
                                            LibraryAmplifierGroupAmplifier amplifier,
                                            LibraryStandardIdentityGroup identityGroup)
        {
            // Creates the unique idntifier code for a given amplifier.

            string code = "";

            if (identityGroup != null)
            {
                code = Convert.ToString(identityGroup.StandardIdentityGroupCode);
            }

            code = code + Convert.ToString(amplifierGroup.AmplifierGroupCode) + Convert.ToString(amplifier.AmplifierCode);

            return code;
        }
        string IAmplifierExport.Line(LibraryAmplifierGroup amplifierGroup, LibraryAmplifierGroupAmplifier amplifier, LibraryAmplifierGroupAmplifierGraphic graphic)
        {
            string result = "";

            LibraryStandardIdentityGroup siGroup = _configHelper.Librarian.StandardIdentityGroup(graphic.StandardIdentityGroup);

            result = BuildAmplifierItemName(amplifierGroup, amplifier, siGroup);
            result = result + "," + BuildSIDCKey(amplifierGroup, amplifier, siGroup);
            result = result + "," + BuildAmplifierCode(amplifierGroup, amplifier, siGroup);
            result = result + ","; // + "Modifier1";
            result = result + ","; // + "Modifier2";
            result = result + ","; // + "ExtraIcon";
            result = result + ","; // + "FullFrame";
            result = result + "," + "Point"; // + "GeometryType";
            result = result + ","; // + "Status";
            result = result + ","; // + "Notes";

            return result;
        }
        protected string BuildAmplifierItemName(LibraryAmplifierGroup amplifierGroup,
                                                LibraryAmplifierGroupAmplifier amplifier,
                                                LibraryStandardIdentityGroup identityGroup)
        {
            // Constructs a string containing the name of an amplifier, where each label value
            // is seperated by a DomainSeparator (usually a colon).

            string category = "";
            string result = ""; //"Amplifier" + _configHelper.DomainSeparator;  //Removed because thought to be redundant

            switch (amplifierGroup.AmplifierGroupCode)
            {
                case 1:
                case 2:
                    category = "Echelon";
                    break;

                case 3:
                case 4:
                case 5:
                    category = "Mobility";
                    break;

                case 6:
                    category = "Auxiliary Equipment";
                    break;
            }

            //result = result + category + _configHelper.DomainSeparator; //Removed because thought to be redundant
            result = result + amplifier.Label.Replace(',', '-');

            if (identityGroup != null)
            {
                result = result + _configHelper.DomainSeparator;
                result = result + identityGroup.Label.Replace(',', '-');
            }

            return result;
        }
        private void _UpdateFromLegacy()
        {
            // Search for the appropriate JMSML Library elements, given the older/legacy (2525C, 2525B, etc.)
            // SIDC for this Symbol.

            _librarian.ResetStatusCode();

            _version = _librarian.Version(1, 0);

            _legacySymbol = _librarian.LegacySymbol(_legacySIDC, ref _dimension, ref _symbolSet);

            if (_legacySymbol != null)
            {
                _affiliation = _librarian.AffiliationByLegacyCode(_legacySIDC.Substring(1, 1), _dimension.ID);

                if (_affiliation != null)
                {
                    _context = _librarian.Context(_affiliation.ContextID);
                    _standardIdentity = _librarian.StandardIdentity(_affiliation.StandardIdentityID);
                    _sig = _librarian.StandardIdentityGroup(_standardIdentity);
                }

                _status = _librarian.Status(_legacySIDC.Substring(3, 1), _legacySIDC.Substring(0, 1));
                _hqTFDummy = _librarian.HQTFDummy(_legacySIDC.Substring(10, 1));

                _amplifier = _librarian.Amplifier(_legacySIDC.Substring(11, 1), _legacySIDC.Substring(0, 1));

                if (_amplifier != null)
                {
                    _amplifierGroup = _librarian.AmplifierGroup(_amplifier);
                }

                _entity = _librarian.Entity(_symbolSet, _legacySymbol.EntityID);
                _entityType = _librarian.EntityType(_entity, _legacySymbol.EntityTypeID);
                _entitySubType = _librarian.EntitySubType(_symbolSet, _entityType, _legacySymbol.EntitySubTypeID);
                _modifierOne = _librarian.ModifierOne(_symbolSet, _legacySymbol.ModifierOneID);
                _modifierTwo = _librarian.ModifierTwo(_symbolSet, _legacySymbol.ModifierTwoID);
            }

            _librarian.LogConversionResult(_legacySIDC);

            _ValidateStatus();
        }
        private void _UpdateFromCurrent()
        {
            // Search for the appropriate JMSML Library elements, given the current (2525D)
            // SIDC for this Symbol.

            string first10 = _sidc.PartAString;
            string second10 = _sidc.PartBString;

            _librarian.ResetStatusCode();

            _version = _librarian.Version(Convert.ToUInt16(first10.Substring(0, 1)),
                                          Convert.ToUInt16(first10.Substring(1, 1)));

            _context = _librarian.Context(Convert.ToUInt16(first10.Substring(2, 1)));
            _standardIdentity = _librarian.StandardIdentity(Convert.ToUInt16(first10.Substring(3, 1)));
            _sig = _librarian.StandardIdentityGroup(_standardIdentity);
            _symbolSet = _librarian.SymbolSet(Convert.ToUInt16(first10.Substring(4, 1)), Convert.ToUInt16(first10.Substring(5, 1)));

            if (_symbolSet != null)
            {
                _dimension = _librarian.DimensionBySymbolSet(_symbolSet.ID);
            }

            if (_context != null && _dimension != null && _standardIdentity != null)
            {
                _affiliation = _librarian.Affiliation(_context.ID, _dimension.ID, _standardIdentity.ID);
            }

            _status = _librarian.Status(Convert.ToUInt16(first10.Substring(6, 1)));
            _hqTFDummy = _librarian.HQTFDummy(Convert.ToUInt16(first10.Substring(7, 1)));
            _amplifierGroup = _librarian.AmplifierGroup(Convert.ToUInt16(first10.Substring(8, 1)));

            if (_amplifierGroup != null)
            {
                _amplifier = _librarian.Amplifier(_amplifierGroup, Convert.ToUInt16(first10.Substring(9, 1)));
            }

            if (_symbolSet != null)
            {
                _entity = _librarian.Entity(_symbolSet, Convert.ToUInt16(second10.Substring(0, 1)), Convert.ToUInt16(second10.Substring(1, 1)));

                if (_entity != null)
                {
                    _entityType = _librarian.EntityType(_entity, Convert.ToUInt16(second10.Substring(2, 1)), Convert.ToUInt16(second10.Substring(3, 1)));
                }

                if (_entityType != null)
                {
                    _entitySubType = _librarian.EntitySubType(_entityType, Convert.ToUInt16(second10.Substring(4, 1)), Convert.ToUInt16(second10.Substring(5, 1)));

                    if (_entitySubType == null)
                    {
                        _entitySubType = _librarian.EntitySubType(_symbolSet, Convert.ToUInt16(second10.Substring(4, 1)), Convert.ToUInt16(second10.Substring(5, 1)));
                    }
                }

                _modifierOne = _librarian.ModifierOne(_symbolSet, Convert.ToUInt16(second10.Substring(6, 1)), Convert.ToUInt16(second10.Substring(7, 1)));
                _modifierTwo = _librarian.ModifierTwo(_symbolSet, Convert.ToUInt16(second10.Substring(8, 1)), Convert.ToUInt16(second10.Substring(9, 1)));

                _legacySymbol = _librarian.LegacySymbol(_symbolSet, _entity, _entityType, _entitySubType, _modifierOne, _modifierTwo);
            }

            _librarian.LogConversionResult(_sidc.PartAString + ", " + _sidc.PartBString);

            _ValidateStatus();
        }
        private void _SetInvalidSymbolProps()
        {
            // If a symbol can't be recognized, this method sets up
            // the current symbol to represent the special Invalid symbol.

            _version = _librarian.Version(1, 0);
            _context = _librarian.Context(0);
            _dimension = _librarian.Dimension("INTERNAL");
            _standardIdentity = _librarian.StandardIdentity(1);
            _symbolSet = _librarian.SymbolSet(9, 8);
            _status = _librarian.Status(0);
            _hqTFDummy = _librarian.HQTFDummy(0);
            _amplifierGroup = _librarian.AmplifierGroup(0);
            _amplifier = _librarian.Amplifier(_amplifierGroup, 0);
            _affiliation = _librarian.Affiliation("REALITY", "INTERNAL", "SI_UNKNOWN");
            _entity = _librarian.Entity(_symbolSet, "INVALID");
            _entityType = null;
            _entitySubType = null;
            _modifierOne = null;
            _modifierTwo = null;
        }
        internal LibraryAmplifierGroup AmplifierGroup(LibraryAmplifierGroupAmplifier amplifier)
        {
            LibraryAmplifierGroup retObj = null;

            foreach (LibraryAmplifierGroup lObj in this._library.AmplifierGroups)
            {
                foreach (LibraryAmplifierGroupAmplifier lObj2 in lObj.Amplifiers)
                {
                    if (lObj2.Equals(amplifier))
                    {
                        return lObj;
                    }
                }
            }

            _statusFlag -= 128;

            return retObj;
        }
        protected string BuildSIDCKey(string codingScheme,
                                      LibraryAmplifierGroup amplifierGroup,
                                      LibraryAmplifierGroupAmplifier amplifier,
                                      LibraryStandardIdentityGroup identityGroup)
        {
            string key = codingScheme;

            key = key + identityGroup.LegacyStandardIdentityCode[0].Value;
            key = key + "-";

            switch(amplifierGroup.AmplifierGroupCode)
            {
                case 1:
                case 2:
                    key = key + amplifier.LegacyModifierCode[0].Value;
                    break;

                case 3:
                case 4:
                case 5:
                    key = key + "M" + amplifier.LegacyModifierCode[0].Value;
                    break;

                case 6:
                    key = key + "N" + amplifier.LegacyModifierCode[0].Value;
                    break;
            }

            return key;
        }
        protected string BuildAmplifierItemTags(LibraryAmplifierGroup amplifierGroup,
                                                LibraryAmplifierGroupAmplifier amplifier,
                                                LibraryStandardIdentityGroup identityGroup,
                                                string graphicPath,
                                                bool omitSource,
                                                bool omitLegacy)
        {
            // Constructs a string of semicolon delimited tags that users can utilize to search
            // for or find a given amplifier.

            // The information concatenated together for this comes from a given AmplifierGroup, Amplifier, and StandardIdentityGroup.
            // Information includes the Label attributes, location of the original graphic file, the code, etc.

            string category = "";
            string iType = "";
            string result = "Amplifier;";

            switch (amplifierGroup.AmplifierGroupCode)
            {
                case 1:
                case 2:
                    category = "Echelon;";
                    iType = "ECHELON";
                    break;

                case 3:
                case 4:
                case 5:
                    category = "Mobility;";
                    iType = "MOBILITY";
                    break;

                case 6:
                    category = "Auxiliary Equipment;";
                    iType = "AUXILIARY";
                    break;
            }

            result = result + category;
            result = result + amplifier.Label.Replace(',', '-') + ";";
            result = result + identityGroup.Label.Replace(',', '-') + ";";

            // Loop through standard identities in the group and add them

            foreach(string sIID in identityGroup.StandardIdentityIDs.Split(' '))
            {
                LibraryStandardIdentity si = _configHelper.Librarian.StandardIdentity(sIID);
                if(si != null)
                {
                    if (si.Label != identityGroup.Label)
                        result = result + si.Label.Replace(',', '-') + ";";
                }
            }

            result = result + iType + ";";

            if(!omitLegacy)
                result = result + _configHelper.SIDCIsNA + ";";

            if(!omitSource)
                result = result + graphicPath.Substring(1) + ";";

            result = result + "Point" + ";";
            result = result + BuildAmplifierItemName(amplifierGroup, amplifier, identityGroup) + ";";
            result = result + BuildAmplifierCode(amplifierGroup, amplifier, identityGroup);

            return result;
        }
 string IAmplifierExport.Line(LibraryAmplifierGroup amplifierGroup, LibraryAmplifierGroupAmplifier amplifier, LibraryAmplifierGroupAmplifierGraphic graphic)
 {
     throw new NotImplementedException();
 }
        protected string BuildSIDCKey(LibraryAmplifierGroup amplifierGroup,
                                      LibraryAmplifierGroupAmplifier amplifier,
                                      LibraryStandardIdentityGroup identityGroup)
        {
            string key = "";

            // TODO: WIll need to consider expanding this to support more than just
            // the UEI symbols

            key = "S";
            key = key + identityGroup.LegacyStandardIdentityCode[0].Value;
            key = key + "-";

            switch(amplifierGroup.AmplifierGroupCode)
            {
                case 1:
                case 2:
                    key = key + amplifier.LegacyModifierCode[0].Value;
                    break;

                case 3:
                case 4:
                case 5:
                    key = key + "M" + amplifier.LegacyModifierCode[0].Value;
                    break;

                case 6:
                    key = key + "N" + amplifier.LegacyModifierCode[0].Value;
                    break;
            }

            return key;
        }