public static FntParse GetFntParse(ref string text)
    {
        FntParse parse = null;

        if (text.StartsWith("info"))
        {
            parse = new FntParse();
            parse.DoTextParse(ref text);
        }
        else if (text.StartsWith("<"))
        {
            parse = new FntParse();
            parse.DoXMLPase(ref text);
        }

        return(parse);
    }
Beispiel #2
0
    static List <icon> icons;//= new List<icon>();
    static void Main(string[] args)
    {
        icons = new List <icon>();
        using (TextFieldParser parser = new TextFieldParser(@"c:\temp\map.csv"))
        {
            parser.TextFieldType = FieldType.Delimited;
            parser.SetDelimiters(",");
            while (!parser.EndOfData)
            {
                //Process row                  s
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

                string[] fields = parser.ReadFields();
                var      str1   = Strings.StrConv(fields[0], VbStrConv.Wide, 1041);
                var      idd    = (int)char.Parse(str1);
                icon     s      = new icon
                {
                    id     = idd.ToString(),
                    x      = ToInt(fields[2]),
                    y      = ToInt(fields[3]),
                    height = ToInt(fields[4]),
                    width  = ToInt(fields[3])
                };
                icons.Add(s);
            }
            //foreach (var item in icons)
            //{
            //    Console.WriteLine($"{item.id} {item.x} {item.y} {item.height} {item.width}");
            //}
        }
        using (StreamReader sw = new StreamReader(@"c:\temp\m.fnt"))
        {
            string s = sw.ReadToEnd();
            FntParse.DoXMLPase(s, icons);
        }


        // Console.ReadKey();
    }