Esempio n. 1
0
        private static void PrintModifierAsStyleCsv(SymbolLookup symbolLookup, SymbolSetType symbolSet,
                                                    int modifierNumber, int modifierCode, string modifierName)
        {
            string symbolSetName = symbolSet.ToString().Replace('_', ' ');

            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            string modifierCategory = symbolLookup.GetModifierCategoryFromName(symbolSet,
                                                                               modifierName, modifierNumber);

            string sModifierCode = modifierCode.ToString();

            // this one has to be 2 chars:
            if (sModifierCode.Length < 2)
            {
                sModifierCode = sModifierCode.PadLeft(2, '0');
            }

            string modifierIconName = MilitarySymbolToGraphicLayersMaker.GetModfierIconName(
                symbolSet, modifierNumber, modifierCode);

            string modifierIconNameWithFolder = MilitarySymbolToGraphicLayersMaker.GetModfierIconNameWithFolder(
                symbolSet, modifierNumber, modifierCode);

            StringBuilder sbNotes = new StringBuilder();

            string imageFile = MilitarySymbolToGraphicLayersMaker.GetModfierIconNameWithFullPath(
                symbolSet, modifierNumber, modifierCode);

            if (IMAGE_FORMAT_IS_EMF)
            {
                imageFile = imageFile.Replace(".svg", ".emf");
            }

            // WORKAROUND: check that files exists & it is not one of the _0,_1,_2,_3,xxxx ones
            if (!System.IO.File.Exists(imageFile))
            {
                sbNotes.Append("ImageFile not found: " + modifierIconNameWithFolder);
            }

            string styleItemName = symbolSetName + TypeUtilities.NameSeparator +
                                   "Modifier " + modifierNumber.ToString() + TypeUtilities.NameSeparator +
                                   modifierCategory + TypeUtilities.NameSeparator +
                                   modifierName;

            string nameAsTags = styleItemName.Replace(TypeUtilities.NameSeparator, ";");

            string styleItemTags = nameAsTags + ";" + modifierIconNameWithFolder + ";" +
                                   styleItemName + ";" + modifierIconName;

            string styleItemCategory = symbolSetName + TypeUtilities.NameSeparator + "Modifier " + modifierNumber.ToString();

            if (styleItemName.Length > MAX_STYLE_LENGTH)
            {
                sbNotes.Append(" Name > " + MAX_STYLE_LENGTH);
            }
            if (styleItemTags.Length > MAX_STYLE_LENGTH)
            {
                sbNotes.Append(" Tags > " + MAX_STYLE_LENGTH);
            }

            if (!INCLUDE_NOTES)
            {
                sbNotes.Clear();
            }

            // filePath, pointSize, styleItemName, styleItemCategory, styleItemTags
            // modifierCode + "," +
            Console.WriteLine(imageFile + "," + POINT_SIZE_STRING + "," +
                              styleItemName + "," + styleItemCategory + "," + styleItemTags + "," + sbNotes.ToString());
        }