LegacyFunction() public method

public LegacyFunction ( LegacyFunctionCodeType functionArray, string standard ) : LegacyFunctionCodeType
functionArray LegacyFunctionCodeType
standard string
return LegacyFunctionCodeType
        private string _buildSIDCKey(SymbolSet ss, SymbolSetLegacySymbol legacySymbol)
        {
            // Builds a unique key from a select number of characters from an SIDC.
            // The pattern for this is:
            //
            // S-D-FFFFFF
            //
            // Where:
            //
            // S = Schema code
            // D = Dimension code
            // FFFFFF = Function code

            string result = "";

            LegacyFunctionCodeType functionCode = _configHelper.LegacyFunction(legacySymbol.LegacyFunctionCode, _standard);

            if (functionCode != null)
            {
                if (functionCode.SchemaOverride == "")
                {
                    LegacyLetterCodeType letterCode = _configHelper.LegacyLetter(ss.LegacyCodingSchemeCode, _standard);
                    if (letterCode != null)
                    {
                        result = letterCode.Value;
                    }
                }
                else
                {
                    result = functionCode.SchemaOverride;
                }

                result = result + "-";

                Librarian        lib       = _configHelper.Librarian;
                LibraryDimension dimension = lib.Dimension(ss.DimensionID);

                if (functionCode.DimensionOverride == "")
                {
                    LegacyLetterCodeType letterCode = _configHelper.LegacyLetter(dimension.LegacyDimensionCode, _standard);
                    if (letterCode != null)
                    {
                        result = result + letterCode.Value;
                    }
                }
                else
                {
                    result = result + functionCode.DimensionOverride;
                }

                result = result + "-";
                result = result + functionCode.Value;
            }

            return(result);
        }
Example #2
0
        private void _exportLegacyEntities(StreamWriter w, bool isFirst, string standard, long size)
        {
            LegacyEntityExport entityExport = new LegacyEntityExport(_helper, standard, size);

            if (isFirst)
            {
                string headers = entityExport.Headers;

                w.WriteLine(headers);
                w.Flush();
            }

            foreach (SymbolSet ss in _lib.SymbolSets)
            {
                // For each symbol set in JMSML...

                logger.Info("Exporting legacy entities for: " + ss.ID);

                try
                {
                    if (ss.LegacySymbols != null)
                    {
                        foreach (SymbolSetLegacySymbol legacySymbol in ss.LegacySymbols)
                        {
                            // For each legacy symbol in that symbol set...

                            if (legacySymbol.LegacyEntity != null)
                            {
                                foreach (LegacyEntityType legacyEntity in legacySymbol.LegacyEntity)
                                {
                                    // Get the list of Legacy Function IDs for the specified legacy version of the standard

                                    if (legacyEntity.LegacyFunctionCode != null)
                                    {
                                        LegacyFunctionCodeType functionCode = _helper.LegacyFunction(legacyEntity.LegacyFunctionCode, standard);

                                        string line = "";

                                        // If the icon is Full Frame then four lines need to be exported, to reflect the four icon shapes.
                                        // Else just write out one line for non-Full-Frame.

                                        if (legacyEntity.Icon == IconType.FULL_FRAME)
                                        {
                                            foreach (LibraryStandardIdentityGroup sig in _lib.Library.StandardIdentityGroups)
                                            {
                                                line = string.Format("{0}", entityExport.Line(sig, ss, legacySymbol, legacyEntity, functionCode));

                                                w.WriteLine(line);
                                                w.Flush();
                                            }
                                        }
                                        else
                                        {
                                            line = string.Format("{0}", entityExport.Line(null, ss, legacySymbol, legacyEntity, functionCode));

                                            w.WriteLine(line);
                                            w.Flush();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }