Ejemplo n.º 1
0
        public static GraphicalChar Parse(string str)
        {
            GraphicalChar result;

            result.Backround  = GraphicalChar.CodeToColor(str[0]);
            result.Foreground = GraphicalChar.CodeToColor(str[1]);
            result.Character  = str[2];
            return(result);
        }
Ejemplo n.º 2
0
        public void LoadFromFile(string fileName)
        {
            string content = File.ReadAllText(fileName);
            string header  = content.Substring(0, 6);
            string pixels  = content.Substring(6);

            this.Width  = int.Parse(header.Substring(0, 3));
            this.Height = int.Parse(header.Substring(3, 3));

            try {
                for (int i = 0; i < pixels.Length; i += 3)
                {
                    GraphicalChar pixel = GraphicalChar.Parse(pixels.Substring(i, 3));
                    this.Characters.Add(pixel);
                }
            }
            catch {
            }
        }