Exemplo n.º 1
0
 public RectanglesAndInputs(int n)
 {
     this.n = n;
     input_list = new List<TextBox>();
     output_list = new List<TextBox>();
     rectangles_list = new List<List<Rectangles>>();
     floors = Convert.ToInt32(2 * Math.Log((double)n, 2) - 1);
     rtag = new int[floors - 1, n];
     inports = new int[floors, n];
     outports = new int[floors, n];
     swtichs = new int[floors, n / 2];
     benes = new Benes();
     view = new CreateView(n, input_list, output_list, rectangles_list);
 }
Exemplo n.º 2
0
 public RectanglesAndInputs(int n)
 {
     this.n          = n;
     input_list      = new List <TextBox>();
     output_list     = new List <TextBox>();
     rectangles_list = new List <List <Rectangles> >();
     floors          = Convert.ToInt32(2 * Math.Log((double)n, 2) - 1);
     rtag            = new int[floors - 1, n];
     inports         = new int[floors, n];
     outports        = new int[floors, n];
     swtichs         = new int[floors, n / 2];
     benes           = new Benes();
     view            = new CreateView(n, input_list, output_list, rectangles_list);
 }
Exemplo n.º 3
0
        //打开操作
        public void OpenProject(string filename)
        {
            try
            {
                FileStream   openfile = new FileStream(filename, FileMode.Open);
                StreamReader sr       = new StreamReader(openfile);
                string       line     = sr.ReadLine();
                int          num      = Convert.ToInt32(line);
                this.n               = num;
                this.input_list      = new List <TextBox>();
                this.output_list     = new List <TextBox>();
                this.rectangles_list = new List <List <Rectangles> >();
                this.floors          = Convert.ToInt32(2 * Math.Log((double)n, 2) - 1);
                this.rtag            = new int[floors - 1, n];
                this.inports         = new int[floors, n];
                this.outports        = new int[floors, n];
                this.swtichs         = new int[floors, n / 2];



                for (int i = 0; i < n; i++)
                {
                    input_list.Add(new TextBox());
                    output_list.Add(new TextBox());
                }
                for (int i = 0; i < n / 2; i++)
                {
                    List <Rectangles> rect_list = new List <Rectangles>();
                    for (int j = 0; j < floors; j++)
                    {
                        rect_list.Add(new Rectangles());
                    }
                    rectangles_list.Add(rect_list);
                }

                line = sr.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    line = sr.ReadLine();
                    input_list[i].Text = line;
                }
                line = sr.ReadLine();
                for (int i = 0; i < floors - 1; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        line       = sr.ReadLine();
                        rtag[i, j] = Convert.ToInt32(line);
                    }
                }
                line = sr.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    line = sr.ReadLine();
                    output_list[i].Text = line;
                }
                line = sr.ReadLine();
                for (int i = 0; i < floors; i++)
                {
                    for (int j = 0; j < n / 2; j++)
                    {
                        line          = sr.ReadLine();
                        swtichs[i, j] = Convert.ToInt32(line);
                    }
                }
                sr.Close();
                this.benes = new Benes();
                ShowSave(n, rtag);
                this.view = new CreateView(n, input_list, output_list, rectangles_list);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        //打开操作
        public void OpenProject(string filename)
        {
            try
            {

                FileStream openfile = new FileStream(filename, FileMode.Open);
                StreamReader sr = new StreamReader(openfile);
                string line = sr.ReadLine();
                int num = Convert.ToInt32(line);
                this.n = num;
                this.input_list = new List<TextBox>();
                this.output_list = new List<TextBox>();
                this.rectangles_list = new List<List<Rectangles>>();
                this.floors = Convert.ToInt32(2 * Math.Log((double)n, 2) - 1);
                this.rtag = new int[floors - 1, n];
                this.inports = new int[floors, n];
                this.outports = new int[floors, n];
                this.swtichs = new int[floors, n / 2];

                for (int i = 0; i < n; i++)
                {
                    input_list.Add(new TextBox());
                    output_list.Add(new TextBox());
                }
                for (int i = 0; i < n / 2; i++)
                {
                    List<Rectangles> rect_list = new List<Rectangles>();
                    for (int j = 0; j < floors; j++)
                    {
                        rect_list.Add(new Rectangles());
                    }
                    rectangles_list.Add(rect_list);
                }

                line = sr.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    line = sr.ReadLine();
                    input_list[i].Text = line;
                }
                line = sr.ReadLine();
                for (int i = 0; i < floors - 1; i++)
                {
                    for (int j = 0; j < n ; j++)
                    {
                        line = sr.ReadLine();
                        rtag[i, j] = Convert.ToInt32(line);
                    }
                }
                line = sr.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    line = sr.ReadLine();
                    output_list[i].Text = line;
                }
                line = sr.ReadLine();
                for (int i = 0; i < floors; i++)
                {
                    for (int j = 0; j < n / 2; j++)
                    {
                        line = sr.ReadLine();
                        swtichs[i, j] = Convert.ToInt32(line);
                    }
                }
                sr.Close();
                this.benes = new Benes();
                ShowSave(n, rtag);
                this.view = new CreateView(n, input_list, output_list, rectangles_list);

            }
            catch (Exception)
            {
                throw;
            }
        }