protected string BuildQuotedHQTFFDCode(LibraryStandardIdentityGroup identityGroup, LibraryDimension dimension, LibraryHQTFDummy hqTFFD)
        {
            // Creates the quoted unique idntifier code for a given HQTFFD.

            string code = '"' + this.BuildHQTFFDCode(identityGroup, dimension, hqTFFD) + '"';

            return code;
        }
        protected string BuildQuotedOCACode(LibraryStandardIdentityGroup identity, LibraryDimension dimension, LibraryStatus status)
        {
            // Creates the quoted unique idntifier code for a given OCA.

            string code = '"' + this.BuildOCACode(identity, dimension, status) + '"';

            return code;
        }
        string IEntityExport.Line(LibraryStandardIdentityGroup sig, 
                                  SymbolSet ss, 
                                  EntitySubTypeType eSubType)
        {
            string code = BuildEntityCode(null, null, null, null, eSubType);

            return BuildEntityItemName(null, null, null, null, eSubType) + "," + code;
        }
        public string NameIt(LibraryStandardIdentityGroup identityGroup, LibraryDimension dimension, LibraryHQTFDummy hqTFFD)
        {
            string name = "";

            if(dimension != null && hqTFFD != null)
                name = BuildHQTFFDItemName(identityGroup, dimension, hqTFFD);

            return name;
        }
        public string NameIt(LibraryStandardIdentityGroup identity, LibraryDimension dimension, LibraryStatus status)
        {
            string name = "";

            if(status != null)
                name = BuildOCAItemName(identity, dimension, status);

            return name;
        }
        public string NameIt(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType)
        {
            string name = "";

            if(ss != null && e != null)
                name = BuildEntityItemName(sig, ss, e, eType, eSubType);

            return name;
        }
        public string CodeIt(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType)
        {
            string code = "";

            if (ss != null); // && (e != null || (e == null && eType == null)))
                code = BuildEntityCode(sig, ss, e, eType, eSubType);

            return code;
        }
        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;
        }
        protected string BuildHQTFFDItemTags(LibraryStandardIdentityGroup identityGroup,
                                             LibraryDimension dimension, 
                                             LibraryHQTFDummy hqTFFD, 
                                             string graphicPath, 
                                             bool omitSource,
                                             bool omitLegacy)
        {
            // Constructs a string of semicolon delimited tags that users can utilize to search
            // for or find a given symbol.

            // The information concatenated together for this comes from a given HQTFFD, Dimension, and Standard Identity.
            // Information includes the Label attributes, location of the original graphic file, the code, etc.

            string result = "HQTFFD;";
            result = result + hqTFFD.Label.Replace(',', '-') + ";";
            result = result + dimension.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(',', '-') + ";";
                }
            }

            // Loop through each symbol set in the dimension and add any labels from those

            if (dimension.SymbolSets != null)
            {
                foreach (LibraryDimensionSymbolSetRef ssRef in dimension.SymbolSets)
                {
                    if (ssRef.Label != dimension.Label)
                        result = result + ssRef.Label.Replace(',', '-') + ";";
                }
            }

            result = result + "HQTFFD;";

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

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

            result = result + "Point;";
            result = result + BuildHQTFFDItemName(identityGroup, dimension, hqTFFD) + ";";
            result = result + BuildHQTFFDCode(identityGroup, dimension, hqTFFD);

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

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

            return name;
        }
        string IEntityExport.Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetEntity e, SymbolSetEntityEntityType eType, EntitySubTypeType eSubType)
        {
            GeometryType geoType = GeometryType.POINT;
            IconType icoType = IconType.MAIN;

            string result = Convert.ToString(ss.SymbolSetCode.DigitOne) + Convert.ToString(ss.SymbolSetCode.DigitTwo);
            
            string code = BuildEntityCode(sig, ss, e, eType, eSubType);

            // Remove the first two characters as this output does not require the symbol set code, and exclude any trailing underbar digit
            // Note that these code will not be unique, with the substring operation in place.

            code = code.Substring(2,6);
            
            result = result + ",";

            result = result + e.Label.Replace(',', '-');
            geoType = e.GeometryType;
            icoType = e.Icon;

            result = result + ",";

            if (eType != null)
            {
                result = result + eType.Label.Replace(',', '-');
                geoType = eType.GeometryType;
                icoType = eType.Icon;
            }

            result = result + ",";

            if (eSubType != null)
            {
                result = result + eSubType.Label.Replace(',', '-');
                geoType = eSubType.GeometryType;
                icoType = eSubType.Icon;
            }

            if (sig != null)
            {
                result = result + "," + sig.Label;
            }
            else
            {
                result = result + ",";
            }

            result = result + "," + code + "," + _geometryList[(int)geoType];

            result = result + "," + Convert.ToString(icoType) + "," + BuildEntityItemName(sig, ss, e, eType, eSubType); 

            return result;
        }
        protected string BuildEntityCode(LibraryStandardIdentityGroup sig,
                                         SymbolSet ss,
                                         SymbolSetEntity e,
                                         SymbolSetEntityEntityType eType,
                                         EntitySubTypeType eSubType)
        {
            // Constructs a string containing the symbol set and entity codes for a given
            // set of those objects.

            string code = "";

            if (ss != null)
            {
                code = code + Convert.ToString(ss.SymbolSetCode.DigitOne) + Convert.ToString(ss.SymbolSetCode.DigitTwo);
            }

            if (e == null && eType == null && eSubType != null)
            {
                // Deal with the special entity sub types as a special case

                code = code + eSubType.EntityCode + eSubType.EntityTypeCode + Convert.ToString(eSubType.EntitySubTypeCode.DigitOne) + Convert.ToString(eSubType.EntitySubTypeCode.DigitTwo);
            }
            else
            {
                // Almost everything is dealt with below

                code = code + Convert.ToString(e.EntityCode.DigitOne) + Convert.ToString(e.EntityCode.DigitTwo);

                if (eType != null)
                    code = code + Convert.ToString(eType.EntityTypeCode.DigitOne) + Convert.ToString(eType.EntityTypeCode.DigitTwo);
                else
                    code = code + "00";

                if (eSubType != null)
                    code = code + Convert.ToString(eSubType.EntitySubTypeCode.DigitOne) + Convert.ToString(eSubType.EntitySubTypeCode.DigitTwo);
                else
                    code = code + "00";
            }
            
            if (sig != null)
            {
                code = code + sig.GraphicSuffix;
            }

            return code;
        }
        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;
        }
        protected string BuildOCACode(LibraryStandardIdentityGroup identity, LibraryDimension dimension, LibraryStatus status)
        {
            // Creates the unique idntifier code for a given OCA.
            
            string code = "";

            if (identity != null && dimension != null)
            {
                code = "0" + Convert.ToString(identity.StandardIdentityGroupCode) +
                             Convert.ToString(dimension.DimensionCode.DigitOne) + Convert.ToString(dimension.DimensionCode.DigitTwo) +
                             Convert.ToString(status.StatusCode) + "2";
            }
            else
                code = Convert.ToString(status.StatusCode);

            return code;
        }
        protected string BuildOCAItemName(LibraryStandardIdentityGroup identity, LibraryDimension dimension, LibraryStatus status)
        {
            // Constructs a string containing the name of an OCA, where each label value
            // is seperated by a DomainSeparator (usually a colon).

            string result = "";

            if (identity != null && dimension != null)
            {
                result = result + ((status.LabelAlias != "") ? status.LabelAlias.Replace(',', '-') : status.Label.Replace(',', '-')) + _configHelper.DomainSeparator;
                result = result + dimension.Label.Replace(',', '-') + _configHelper.DomainSeparator;
                result = result + identity.Label.Replace(',', '-');
            }
            else
                result = (status.LabelAlias != "") ? status.LabelAlias.Replace(',', '-') : status.Label.Replace(',', '-');

            return result;
        }
        protected string BuildHQTFFDCode(LibraryStandardIdentityGroup identityGroup, LibraryDimension dimension, LibraryHQTFDummy hqTFFD)
        {
            // Creates the unique idntifier code for a given HQTFFD.

            string code = "";

            if (identityGroup != null)
            {
                code = Convert.ToString(identityGroup.StandardIdentityGroupCode);
            }
            
            if(dimension != null)
            {
                code = code + Convert.ToString(dimension.DimensionCode.DigitOne) + Convert.ToString(dimension.DimensionCode.DigitTwo);
            }      
                    
            code = code + Convert.ToString(hqTFFD.HQTFDummyCode);

            return code;
        }
        protected string BuildHQTFFDItemName(LibraryStandardIdentityGroup identityGroup, LibraryDimension dimension, LibraryHQTFDummy hqTFFD)
        {
            // Constructs a string containing the name of a HQTFFD, where each label value
            // is seperated by a DomainSeparator (usually a colon).  Builds this for each group
            // of related identity, dimension, and HQTFFD.

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

            string hqTFFDLabel = (hqTFFD.LabelAlias == "") ? hqTFFD.Label : hqTFFD.LabelAlias;
            result = result + hqTFFDLabel.Replace(',', '-');

            if (identityGroup != null && dimension != null)
            {
                result = result + _configHelper.DomainSeparator;
                result = result + dimension.Label.Replace(',', '-') + _configHelper.DomainSeparator;
                result = result + identityGroup.Label.Replace(',', '-');
            }
            
            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;
        }
        protected string BuildOCAItemTags(LibraryStandardIdentityGroup identity, 
                                          LibraryDimension dimension,
                                          LibraryStatus status,
                                          string graphicPath,
                                          bool omitSource,
                                          bool omitLegacy)
        {
            // Constructs a string of semicolon delimited tags that users can utilize to search
            // for or find a given OCA.

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

            string result = "Operational Condition;";

            if (identity != null && dimension != null)
            {
                result = result + ((status.LabelAlias != "") ? status.LabelAlias.Replace(',', '-') : status.Label.Replace(',', '-')) + ";";
                result = result + dimension.Label.Replace(',', '-') + ";";
                result = result + identity.Label.Replace(',', '-') + ";";
            }
            else
                result = result + ((status.LabelAlias != "") ? status.LabelAlias.Replace(',', '-') : status.Label.Replace(',', '-')) + ";";

            result = result + "OCA;";

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

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

            result = result + "Point" + ";";
            result = result + BuildOCAItemName(identity, dimension, status) + ";";
            result = result + BuildOCACode(identity, dimension, status);

            return result;
        }
        public string Line(LibraryStandardIdentityGroup sig, SymbolSet ss, SymbolSetLegacySymbol symbol, LegacyEntityType entity, LegacyFunctionCodeType code)
        {
            string result = "";
            string graphic = "";

            _notes = "";

            string graphicPath = _configHelper.GetPath("JMSML_2525C", FindEnum.Find2525C);

            if (entity.Graphic != "" && entity.Icon != IconType.FULL_FRAME)
                graphic = entity.Graphic;
            else
                graphic = GrabGraphic(entity.CloverGraphic, entity.RectangleGraphic, entity.SquareGraphic, entity.DiamondGraphic, sig.GraphicSuffix);

            string id = graphic.Substring(0, graphic.Length - 4); ;

            IconType iType = entity.Icon;
            string geometryType = GeometryIs(entity.GeometryType);

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

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

            result = result + itemRootedPath;
            result = result + "," + Convert.ToString(_configHelper.PointSize);
            result = result + "," + id;
            result = result + "," + BuildEntityItemCategory(ss, iType, geometryType);
            result = result + "," + BuildEntityItemTags(sig, ss, symbol, entity, code);
            result = result + "," + id;
            result = result + "," + geometryType;
            result = result + "," + _notes;

            return result;
        }
        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 BuildEntityItemName(LibraryStandardIdentityGroup sig,
                                             SymbolSet ss,
                                             SymbolSetEntity e,
                                             SymbolSetEntityEntityType eType,
                                             EntitySubTypeType eSubType)
        {
            // Constructs a string containing the name of an entity, where each label value
            // is seperated by a DomainSeparator (usually a colon).  Builds this for each group
            // of related SymbolSet and entity.

            string result = "";

            if (e == null && eType == null && eSubType != null)
            {
                result = "Special Entity Subtypes" + _configHelper.DomainSeparator + eSubType.Label.Replace(',', '-');
            }
            else
            {
                result = (e.LabelAlias == "") ? e.Label : e.LabelAlias;

                if (eType != null)
                {
                    string eTypeLabel = (eType.LabelAlias == "") ? eType.Label : eType.LabelAlias;
                    result = result + _configHelper.DomainSeparator + eTypeLabel.Replace(',', '-');
                }

                if (eSubType != null)
                {
                    string eSubTypeLabel = (eSubType.LabelAlias == "") ? eSubType.Label : eSubType.LabelAlias;
                    result = result + _configHelper.DomainSeparator + eSubTypeLabel.Replace(',', '-');
                }
            }

            if (sig != null)
            {
                result = result + _configHelper.DomainSeparator + sig.Label;
            }

            return result;
        }
        protected string BuildEntityItemTags(LibraryStandardIdentityGroup sig,
                                             SymbolSet ss,
                                             SymbolSetEntity e,
                                             SymbolSetEntityEntityType eType,
                                             EntitySubTypeType eSubType,
                                             bool omitSource,
                                             bool omitLegacy)
        {
            // Constructs a string of semicolon delimited tags that users can utilize to search
            // for or find a given symbol.

            // The information concatenated together for this comes from a given SymbolSet and
            // entity (type and sub type).  Information includes the Label attributes, geometry
            // type, location of the original graphic file, the code, etc.

            string result = ss.Label.Replace(',', '-');
            string graphic = "";
            string geometry = "";
            string iType = "NO_ICON";

            string[] xmlTags = null;

            if (e == null && eType == null && eSubType != null)
            {
                result = result + ";" + "Special Entity Subtypes";
            }

            if(e != null)
            {
                result = result + ";" + e.Label.Replace(',', '-');
                iType = Convert.ToString(e.Icon);
            }

            if (eType != null)
            {
                result = result + ";" + eType.Label.Replace(',', '-');
                iType = Convert.ToString(eType.Icon);
            }

            if (eSubType != null)
            {
                result = result + ";" + eSubType.Label.Replace(',', '-');
                iType = Convert.ToString(eSubType.Icon);

                // Add the type of geometry

                geometry = _geometryList[(int)eSubType.GeometryType];

                if (eSubType.Icon == IconType.FULL_FRAME)
                {
                    if (sig != null)
                    {
                        graphic = GrabGraphic(eSubType.CloverGraphic, eSubType.RectangleGraphic, eSubType.SquareGraphic, eSubType.DiamondGraphic, sig.GraphicSuffix);
                    }

                    _notes = _notes + "icon touches frame;";
                }
                else if (eSubType.Icon == IconType.NA)
                    graphic = "";
                else
                    graphic = eSubType.Graphic;

                // Grab any custom XML tags that might exist

                xmlTags = eSubType.Tags;
            }
            else if(eType != null)
            {
                // Add the type of geometry

                geometry = _geometryList[(int)eType.GeometryType];

                if (eType.Icon == IconType.FULL_FRAME)
                {
                    if (sig != null)
                    {
                        graphic = GrabGraphic(eType.CloverGraphic, eType.RectangleGraphic, eType.SquareGraphic, eType.DiamondGraphic, sig.GraphicSuffix);
                    }

                    _notes = _notes + "icon touches frame;";
                }
                else if (eType.Icon == IconType.NA)
                    graphic = "";
                else
                    graphic = eType.Graphic;

                // Grab any custom XML tags that might exist

                xmlTags = eType.Tags;
            }
            else if(e != null)
            {
                // Add the type of geometry

                geometry = _geometryList[(int)e.GeometryType];

                if (e.Icon == IconType.FULL_FRAME)
                {
                    if (sig != null)
                    {
                        graphic = GrabGraphic(e.CloverGraphic, e.RectangleGraphic, e.SquareGraphic, e.DiamondGraphic, sig.GraphicSuffix);
                    }

                    _notes = _notes + "icon touches frame;";
                }
                else if (e.Icon == IconType.NA)
                    graphic = "";
                else
                    graphic = e.Graphic;

                // Grab any custom XML tags that might exist

                xmlTags = e.Tags;
            }

            // Create the unique ID/code for this object

            string code = BuildEntityCode(sig, ss, e, eType, eSubType);

            // If there is a standard identity group, add it

            if (sig != null)
            {
                result = result + ";" + sig.Label;
            }

            // Add any custom XML or export tags that might exist

            result = _configHelper.AddCustomTags(result, code, xmlTags);

            // Add an equivalent 2525C SIDC tag, if one exists

            if (!omitLegacy)
            {
                string sidcTag = BuildLegacySIDCTag(sig, ss, e, eType, eSubType);
                if (sidcTag != "")
                    result = result + ";" + sidcTag;
            }

            // Add the icon's type

            result = result + ";" + iType;

            // Add the svg source

            if (!omitSource)
                result = result + ";" + _configHelper.GetPath(ss.ID, FindEnum.FindEntities, true) + "\\" + graphic;

            // Add the three most important pieces of information

            result = result + ";" + geometry;
            result = result + ";" + BuildEntityItemName(sig, ss, e, eType, eSubType);
            result = result + ";" + code;

            if (result.Length > 255)
            {
                // Can't have a tag string greater than 255 in length.
                // Human interaction will be required to resolve these on a case by case basis.

                _notes = _notes + "styleItemTags > 255;";
            }

            return result;
        }
        protected string BuildLegacySIDCTag(LibraryStandardIdentityGroup sig,
                                            SymbolSet ss,
                                            SymbolSetEntity e,
                                            SymbolSetEntityEntityType eType,
                                            EntitySubTypeType eSubType)
        {
            string result = _configHelper.SIDCIsNew;

            if(ss != null && e != null)
            {
                uint partA = 1000000000 + (ss.SymbolSetCode.DigitOne * (uint)100000) + (ss.SymbolSetCode.DigitTwo * (uint)10000);

                if (sig != null)
                {
                    partA = partA + (sig.StandardIdentityGroupCode * (uint)1000000);
                }

                uint partB = (e.EntityCode.DigitOne * (uint)1000000000) + (e.EntityCode.DigitTwo * (uint)100000000);

                if (eType != null)
                {
                    partB = partB + (eType.EntityTypeCode.DigitOne * (uint)10000000) + (eType.EntityTypeCode.DigitTwo * (uint)1000000);
                }

                if (eSubType != null)
                {
                    partB = partB + (eSubType.EntitySubTypeCode.DigitOne * (uint)100000) + (eSubType.EntitySubTypeCode.DigitTwo * (uint)10000);
                }

                Symbol symbol = _configHelper.Librarian.MakeSymbol(new SIDC(partA, partB));

                //
                // If the symbol has a 2525C equivalent, return it
                //

                if (symbol != null)
                {
                    if (symbol.SymbolStatus == SymbolStatusEnum.statusEnumOld)
                    {
                        result = symbol.LegacySIDC;

                        if (sig == null && result.Substring(1, 1) == "P")
                        {
                            result = result.Substring(0, 1) + "*" + result.Substring(2);
                        }

                        if (result.Substring(14, 1) == "X")
                            result = result.Substring(0, 10) + "****X";

                        else if (result.Substring(0, 1) == "W")
                            result = result.Substring(0, 13) + "**";

                        else if (result.Substring(10, 5) == "-----")
                            result = result.Substring(0, 10) + "*****";

                        else if (result.Substring(11, 4) == "----")
                            result = result.Substring(0, 11) + "****";
                    }
                }
                else
                {
                    logger.Warn("Symbol could not be built from: " + partA + ":" + partB);
                }
            }

            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();
        }
        protected string BuildQuotedEntityCode(LibraryStandardIdentityGroup sig,
                                               SymbolSet ss,
                                               SymbolSetEntity e,
                                               SymbolSetEntityEntityType eType,
                                               EntitySubTypeType eSubType)
        {
            // Constructs a quoted string containing the symbol set and entity codes for a given
            // set of those objects.

            string code = '"' + this.BuildEntityCode(sig, ss, e, eType, eSubType) + '"';

            return code;
        }
        protected string BuildSIDCKey(LibraryStandardIdentityGroup identityGroup, LibraryDimension dimension, LibraryHQTFDummy hqTFFD)
        {
            string key = "";

            key = "S";
            key = key + identityGroup.LegacyStandardIdentityCode[0].Value;
            key = key + dimension.LegacyDimensionCode[0].Value;
            key = key + "-";
            key = key + (dimension.LegacyDimensionCode[0].FirstFunctionLetter == "" ? "-" : dimension.LegacyDimensionCode[0].FirstFunctionLetter);
            key = key + hqTFFD.LegacyHQTFDummyCode[0].Value;

            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;
        }
        protected string BuildSIDCKey(LibraryStandardIdentityGroup identity, LibraryDimension dimension, LibraryStatus status)
        {
            string key = "";

            if (status.LegacyStatusCode != null)
            {
                if (identity != null && dimension != null)
                {
                    key = key + identity.LegacyStandardIdentityCode[0].Value;
                    key = key + dimension.LegacyDimensionCode[0].Value;
                }

                key = key + status.LegacyStatusCode[0].Value;

                if (dimension != null)
                {
                    LegacyLetterCodeType code = dimension.LegacyDimensionCode[0];
                    key = key + (code.FirstFunctionLetter == "" ? "-" : code.FirstFunctionLetter);
                }
            }

            return key;
        }