Exemplo n.º 1
0
        public Write_file(List <Tpoint> l, string arg, Tpoint rc)
        {
            FileStream   output  = new FileStream(Directory.GetCurrentDirectory() + @"\filesw" + @"\" + arg + ".txt", FileMode.Create, FileAccess.Write);
            BinaryWriter Boutput = new BinaryWriter(output);

            Boutput.Write(rc.r);//playground r*c
            Boutput.Write(rc.c);

            for (int i = 0; i < l.Count; i++)
            {
                output.Position = (i + 1) * sizeof(Int32) * 2;//2:int32 r,int32 c
                Boutput.Write(l[i].r);
                Boutput.Write(l[i].c);
            }
            Boutput.Close();
            output.Close();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*StreamWriter myf = File.AppendText(Directory.GetCurrentDirectory() + @"\namepath" + @"\" + "namepath.txt");
             * myf.WriteLine(textBox1.Text);
             * myf.Close();*/
            // FileStream output = new FileStream(" ",FileMode.Append,FileAccess.Write);


            //!!!!!!!!!!!!!!!!!!!!!!!!!!!
            Tpoint p = new Tpoint(row, culmn);

            f = new Write_file(map.lp, textBox1.Text, p);
            Form objform = new Form4(textBox1.Text);

            objform.Show();
            this.Dispose();
        }
Exemplo n.º 3
0
        //private List<Tblock>Listp;

        public Form3(int r, int c)
        {
            InitializeComponent();
            row   = r;
            culmn = c;
            cv    = new Constvar();

            widtht_pg = cv.width_pic * culmn;
            hight_pg  = cv.hight_pic * row;

            map = new Tmap();
            map.makeTmap(row, culmn);
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < culmn; j++)
                {
                    Controls.Add(map.block[i, j]); map.block[i, j].Visible = false;
                }
            }


            butterfly           = new Tblock(0, 0);
            butterfly.BackColor = SystemColors.Control;
            Controls.Add(butterfly);
            butterfly.Image = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "butterfly[1].gif");

            Pview        = new Tblock(0, 0);
            Pview.Width  = widtht_pg;
            Pview.Height = hight_pg;
            //Pview.Image = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "g1.jpg");
            Pview.BackColor = Color.Black;
            Controls.Add(Pview);

            gh = new Ghab(row, culmn);
            for (int i = 0; i < gh.sizeghab; i++)
            {
                Controls.Add(gh.ghab[i]);
            }

            map.lp = new List <Tpoint>();
            Tpoint start = new Tpoint(0, 0);

            map.lp.Add(start);
        }
Exemplo n.º 4
0
        public Read_file(ref List <Tpoint> l, string arg, ref Tpoint rc)
        {
            FileStream   input  = new FileStream(Directory.GetCurrentDirectory() + @"\filesw" + @"\" + arg + ".txt", FileMode.Open, FileAccess.Read);
            BinaryReader Binput = new BinaryReader(input);

            rc.r = Binput.ReadInt32();
            rc.c = Binput.ReadInt32();

            int i = 0; int r0, c0; Tpoint b;

            while (Binput.PeekChar() != -1)
            {
                //input.Seek(i*2*sizeof(Int32), SeekOrigin.Begin);
                r0 = Binput.ReadInt32();
                c0 = Binput.ReadInt32();
                b  = new Tpoint(r0, c0);
                l.Add(b);
                i++;
            }
            Binput.Close();
            input.Close();
        }
Exemplo n.º 5
0
        public Form4(string st)
        {
            InitializeComponent();

            //-------------------------load path-----------------------------------------------------------------------------------------------
            Tpoint point = new Tpoint();

            map = new Tmap();
            Read_file rf = new Read_file(ref map.lp, st, ref point);

            row   = point.r;
            culmn = point.c;

            //-------------------------make map-----------------------------------------------------------------------------------------------
            map.makeTmap(row, culmn);
            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < culmn; j++)
                {
                    Controls.Add(map.block[i, j]); map.block[i, j].Visible = false;
                }
            }
            int c = 0;

            while (c != map.lp.Count)
            {
                map.block[map.lp[c].r, map.lp[c].c].Image   = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "1.jpg");
                map.block[map.lp[c].r, map.lp[c].c].Visible = true;
                c++;
            }

            //------------------------------------------------------------------------------------------------------------------------------
            cv        = new Constvar();
            widtht_pg = cv.width_pic * culmn;
            hight_pg  = cv.hight_pic * row;

            Width  = widtht_pg + 300;
            Height = hight_pg + 300;

            //-------------------------make Butterfky-----------------------------------------------------------------------------------------------
            butterfly = new Tbutterfly(row, culmn, row + 1, -1);
            Controls.Add(butterfly);
            butterfly.ball[0].BringToFront();
            Controls.Add(butterfly.ball[0]);

            //-------------------------make view-----------------------------------------------------------------------------------------------
            Pview           = new Tblock(0, 0);
            Pview.Width     = widtht_pg;
            Pview.Height    = hight_pg;
            Pview.Image     = Image.FromFile(Directory.GetCurrentDirectory() + @"\pictures" + @"\" + "Score.jpg");
            Pview.BackColor = Color.Black;
            Controls.Add(Pview);
            //-------------------------make ghab-----------------------------------------------------------------------------------------------

            gh = new Ghab(row, culmn);
            for (int i = 0; i < gh.sizeghab; i++)
            {
                Controls.Add(gh.ghab[i]);
            }

            //--------------------------------------------------------------------------------------------------------------------------
        }
Exemplo n.º 6
0
 public Tpoint(Tpoint p0)
 {
     r = p0.r;
     c = p0.c;
 }