Ejemplo n.º 1
0
        private void Process(bool transform)
        {
            MyListener ml = new MyListener();

            Trace.Listeners.Add(ml);

            Program.Conf.Save();
            List <IconTransform> itList = new List <IconTransform>();

            foreach (string s in File.ReadAllText(Program.Conf.TransformFile).Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
            {
                try
                {
                    IconTransform it = new IconTransform(s);
                    itList.Add(it);
                } catch (Exception ex)
                {
                    Trace.WriteLine("Cannot parse " + s + ":" + ex.Message);
                }
            }



            int cnt = 0;
            int num = panel1.Width / 100;

            panel1.Controls.Clear();
            foreach (IconTransform it in itList)
            {
                it.Load();
                if (transform)
                {
                    it.Process();
                }
                if (it.Image != null)
                {
                    PictureBox pb = new PictureBox();
                    pb.Image    = it.Image;
                    pb.Width    = it.Image.Width;
                    pb.Height   = it.Image.Height;
                    pb.Location = new Point((cnt % num) * 100, (cnt / num) * 100);
                    panel1.Controls.Add(pb);
                    cnt++;
                }
                it.Save();
            }

            string res = ml.GetData();

            if (res != null)
            {
                Console.WriteLine(res);
                MessageBox.Show(res);
            }
        }
Ejemplo n.º 2
0
        private void Process(bool transform)
        {
            MyListener ml = new MyListener();
              Trace.Listeners.Add(ml);

              Program.Conf.Save();
              List<IconTransform> itList = new List<IconTransform>();

              foreach (string s in File.ReadAllText(Program.Conf.TransformFile).Split(new char[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries))
              {
            try
            {
              IconTransform it = new IconTransform(s);
              itList.Add(it);
            } catch (Exception ex)
            {
              Trace.WriteLine("Cannot parse " + s + ":" + ex.Message);
            }
              }

              int cnt = 0;
              int num = panel1.Width/100;
              panel1.Controls.Clear();
              foreach(IconTransform it in itList)
              {
            it.Load();
            if (transform) it.Process();
            if (it.Image != null)
            {
              PictureBox pb = new PictureBox();
              pb.Image = it.Image;
              pb.Width = it.Image.Width;
              pb.Height = it.Image.Height;
              pb.Location = new Point((cnt%num)*100, (cnt/num)*100);
              panel1.Controls.Add(pb);
              cnt++;
            }
            it.Save();
              }

              string res = ml.GetData();
              if (res != null) {
            Console.WriteLine(res);
            MessageBox.Show(res);
              }
        }