protected string BuildFrameItemName(LibraryContext context, LibraryDimension dimension, LibraryStandardIdentity identity, LibraryStatus status, bool asAnyCivilian)
        {
            // Constructs a string containing the name of a frame, where each label value
            // is seperated by a DomainSeparator (usually a colon).  Builds this for each group
            // of related contexts, standard identities, and symbolsets.

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

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

            result = result + identity.Label.Replace(',', '-');

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

            if (status != null)
            {
                if (status.StatusCode == 1)
                    result = result + _configHelper.DomainSeparator + ((status.LabelAlias == "") ? status.Label : status.LabelAlias);
            }

            if (asAnyCivilian)
            {
                result = result + _configHelper.DomainSeparator + "Civilian";
            }

            return result;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            if (_legacyFrame != null)
            {
                result = BuildFrameItemName(context, dimension, identity, status, false);

                result = result + "," + BuildSIDCKey(_legacyStatusCode(_standard, status), _legacyFrame);

                if(_legacyFrame.LimitUseTo == "2525C" || _legacyFrame.LimitUseTo == "")
                    // For 2525C frames or 2525Bc2 frames that are the same we 2525C we use the 2525D icons
                    // (2525C and some 2525Bc2 frames are identical to 2525D)
                    result = result + "," + BuildFrameCode(context, identity, dimension, status, false);
                else
                    // For 2525Bc2 unique frames we use the unique icons that are keyed accordingly.
                    result = result + "," + BuildFrameCode(_legacyStatusCode(_standard, status), _legacyFrame);

                result = result + ","; // + "Modifier1";
                result = result + ","; // + "Modifier2";
                result = result + ","; // + "ExtraIcon";
                result = result + ","; // + "FullFrame";
                result = result + "," + "Point"; // + "GeometryType";
                result = result + "," + _legacyFrame.LimitUseTo; // + "Standard";
                result = result + ","; // + "Status";
                result = result + "," + _legacyFrame.Description; // + "Notes";
            }

            return result;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            result = BuildFrameItemName(null, null, identity, null, false) + "," + BuildFrameCode(null, identity, null, null, false);

            return result;
        }
        protected string BuildQuotedFrameCode(LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asAnyCivilian)
        {
            // Creates the unique idntifier code for a given frame, surrounded by quotes.

            string code = '"' + this.BuildFrameCode(context, identity, dimension, status, asAnyCivilian) + '"';

            return code;
        }
        public string NameIt(LibraryContext context, LibraryDimension dimension, LibraryStandardIdentity identity, LibraryStatus status, bool asAnyCivilian)
        {
            string name = "";

            if (identity != null)
                name = BuildFrameItemName(context, dimension, identity, status, asAnyCivilian);

            return name;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            _notes = "";

            string result = "";
            string graphic = "";

            string graphicPath = _configHelper.GetPath(context.ID, FindEnum.FindFrames);

            LibraryAffiliation affiliation = librarian.Affiliation(context.ID, dimension.ID, identity.ID);

            if (affiliation != null)
            {
                if (affiliation.Shape != ShapeType.NA && (status.StatusCode == 0 || affiliation.PlannedGraphic != ""))
                {
                    if (status.StatusCode == 0)
                        if (asCivilian && affiliation.CivilianGraphic != "")
                            graphic = affiliation.CivilianGraphic;
                        else
                            graphic = affiliation.Graphic;
                    else
                        if (asPlannedCivilian && affiliation.PlannedCivilianGraphic != "")
                            graphic = affiliation.PlannedCivilianGraphic;
                        else
                            graphic = affiliation.PlannedGraphic;

                    if (graphic == null)
                        _notes = _notes + "graphic is missing - frame is NA - frame is never to be drawn;";

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

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

                    string itemName = BuildFrameItemName(context, dimension, identity, status, asCivilian || asPlannedCivilian);
                    string itemCategory = "Frame";
                    string itemTags = BuildFrameItemTags(context, identity, dimension, status, graphicPath + "\\" + graphic, _omitSource, _omitLegacy, asCivilian || asPlannedCivilian);
                    string itemID = BuildFrameCode(context, identity, dimension, status, asCivilian || asPlannedCivilian);

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

            return result;
        }
        protected string BuildFrameCode(LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asAnyCivilian)
        {
            // Creates the unique idntifier code for a given frame.

            string code = "";

            if (context != null && dimension != null && status != null)
            {
                code = Convert.ToString(context.ContextCode) + "_" +
                       Convert.ToString(identity.StandardIdentityCode) +
                       Convert.ToString(dimension.DimensionCode.DigitOne) + Convert.ToString(dimension.DimensionCode.DigitTwo) + "_" +
                       Convert.ToString((status.StatusCode == 1) ? 1 : 0);

                if (asAnyCivilian)
                    code = code + "c";
            }
            else
                code = Convert.ToString(identity.StandardIdentityCode);

            return code;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";

            if (_legacyFrame != null)
            {
                result = BuildFrameItemName(context, dimension, identity, status, false);

                result = result + "," + BuildSIDCKey(_legacyStatusCode(_standard, status), _legacyFrame);

                result = result + "," + BuildFrameCode(context, identity, dimension, status, false);

                result = result + ","; // + "Modifier1";
                result = result + ","; // + "Modifier2";
                result = result + ","; // + "ExtraIcon";
                result = result + ","; // + "FullFrame";
                result = result + "," + "Point"; // + "GeometryType";
                result = result + ","; // + "Status";
                result = result + "," + _legacyFrame.Description; // + "Notes";
            }

            return result;
        }
        string IFrameExport.Line(Librarian librarian, LibraryContext context, LibraryStandardIdentity identity, LibraryDimension dimension, LibraryStatus status, bool asCivilian, bool asPlannedCivilian)
        {
            string result = "";
            string graphic = "";

            _notes = "";

            string graphicPath = _configHelper.GetPath("JMSML_2525BC2", FindEnum.Find2525BC2);

            graphic = _legacyFrame.Graphic;

            string id = BuildFrameCode(_legacyStatusCode(_standard, status), _legacyFrame);

            string geometryType = "Point";

            string itemRootedPath = _configHelper.BuildRootedPath(graphicPath, graphic);
            string itemOriginalPath = _configHelper.BuildOriginalPath(graphicPath, graphic);
            string tags = BuildFrameItemTags(context, identity, dimension, status, graphicPath, true, true, false);

            // Replace the 2525D ID with the 2525B Change 2 ID
            string dCode = BuildFrameCode(context, identity, dimension, status, false);
            tags = tags.Replace(dCode, id);

            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 + "," + "Frame";
            result = result + "," + tags;
            result = result + "," + id;
            result = result + "," + geometryType;
            result = result + "," + _notes;

            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 LibraryStandardIdentityGroup StandardIdentityGroup(LibraryStandardIdentity standardIdentity)
        {
            LibraryStandardIdentityGroup retObj = null;

            foreach (LibraryStandardIdentityGroup lObj in this._library.StandardIdentityGroups)
            {
                foreach (string id in lObj.StandardIdentityIDs.Split(' '))
                {
                    if (standardIdentity.ID == id)
                    {
                        return lObj;
                    }
                }
            }

            return retObj;
        }
        protected string BuildFrameItemTags(LibraryContext context, 
                                            LibraryStandardIdentity identity, 
                                            LibraryDimension dimension, 
                                            LibraryStatus status, 
                                            string graphicPath, 
                                            bool omitSource, 
                                            bool omitLegacy,
                                            bool asAnyCivilian)
        {
            // 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, Context, and Standard Identity.
            // Information includes the Label attributes, location of the original graphic file, the code, etc.

            string result = "Frame;";
            result = result + context.Label.Replace(',', '-') + ";";
            result = result + identity.Label.Replace(',', '-') + ";";
            result = result + dimension.Label.Replace(',', '-') + ";";

            if(status.StatusCode == 1)
                result = result + ((status.LabelAlias == "") ? status.Label.Replace(',', '-') : status.LabelAlias.Replace(',', '-')) + ";";

            if (asAnyCivilian)
                result = result + "Civilian;";

            // 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 + "FRAME;";

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

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

            if(_configHelper.Librarian.Affiliation(context.ID, dimension.ID, identity.ID).Graphic != null)
                result = result + "Point;";
            else
                result = result + "NotValid;";

            result = result + BuildFrameItemName(context, dimension, identity, status, asAnyCivilian) + ";";
            result = result + BuildFrameCode(context, identity, dimension, status, asAnyCivilian);

            return result;
        }