예제 #1
0
        private static bool LoadXMLFile(string filename)
        {
            try
            {
                if (!IsValidFile(filename))
                {
                    Console.WriteLine("Not a valid lyric file.");
                    return(false);
                }

                XElement jpXML = XElement.Load(filename);

                foreach (var vocal in jpXML.Elements("vocal"))
                {
                    string lyric        = vocal.Attribute("lyric").Value;
                    string lyricTrimmed = lyric.EndsWith("+") || lyric.EndsWith("-") ? lyric.Substring(0, lyric.Length - 1) : lyric;

                    FontGenerator.AddGlyphsFromWord(lyricTrimmed);
                }

                // Space is always included in official Japanese lyrics
                FontGenerator.AddGlyph(" ");
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error reading the xml file.\n" + ex.Message);
                return(false);
            }
        }