/* ���ڴ洢�õ�List<ArrayList>��ʽ����Ϣ���ݺ�
         * Cassview��ʹ�õĿؼ���ϢctrlsInfo
         * ����ʹ�õĿؼ���������ϢblockInfo��linesInfo
         * ����֮���ת�� */
        /// <summary>
        /// ����Ϣ�����ж�ȡ��Ϣ
        /// </summary>
        /// <param name="infoArray"></param>
        private void ReadInfo(List<List<ArrayList>> infoArray)
        {
            List<ArrayList> ctrol = infoArray[0];
            List<ArrayList> line = infoArray[1];
            for (int i = 0; i < ctrol.Count; i++)
            {
                ArrayList temp = ctrol[i];
                ControlInfo tempCtrl = new ControlInfo();
                BlockInfo tempBlock = new BlockInfo();

                string[] BasicInfo = (string[])(temp[0]);
                Point[] SizeInfo = (Point[])(temp[3]);
                List<string[]> FuncInfo1 = (List<string[]>)(temp[1]);
                List<string[]> FuncInfo2 = (List<string[]>)(temp[2]);
                //��������
                tempCtrl.ControlNum = Convert.ToInt32(BasicInfo[0]);
                tempCtrl.ControlName = BasicInfo[1];
                tempBlock.BlockNum = tempCtrl.ControlNum;
                tempBlock.BlockName = tempCtrl.ControlName;
                tempCtrl.SortName = BasicInfo[2];
                if (BasicInfo[3] != null)
                {
                    tempCtrl.OtherProperty = BasicInfo[3].Split('$');
                }
                tempCtrl.HasEnumProperty = Convert.ToBoolean(BasicInfo[4]);
                tempCtrl.CodeInfo = new string[3];
                tempCtrl.CodeInfo[0] = BasicInfo[5];
                tempCtrl.CodeInfo[1] = BasicInfo[6];
                tempCtrl.CodeInfo[2] = BasicInfo[7];
                string[] LoadInfo = BasicInfo[8].Split(';');
                tempCtrl.CanOptimize = Convert.ToBoolean(BasicInfo[10]);

                if (LoadInfo[0] != "0")
                {//��������˿ڱ��� �˿ڳ�ֵ��Ϣ20090616
                    List<string[]> tempIOinfo = new List<string[]>();
                    foreach (string element in LoadInfo)
                    {
                        string[] info = new string[4];
                        info[2] = element.Split(',')[0];
                        info[3] = element.Split(',')[1];
                        tempIOinfo.Add(info);
                    }
                    tempCtrl.InputInfo = tempIOinfo;
                }
                else
                {
                    tempCtrl.InputInfo = InitializeIOinfo(Convert.ToInt32(BasicInfo[8]));
                }
                tempCtrl.OutputInfo = InitializeIOinfo(Convert.ToInt32(BasicInfo[9]));
                tempCtrl.VisibleFunctionProperty = new List<XProp>();
                tempCtrl.UnvisibleFunctionProperty = new List<XProp>();
                if (FuncInfo1 != null)
                {//�ɼ�����
                    for (int x = 0; x < FuncInfo1.Count; x++)
                    {
                        XProp attribute = new XProp();
                        attribute.EnumValue = FuncInfo1[x][0];
                        attribute.Name = FuncInfo1[x][1];
                        attribute.TheValue = FuncInfo1[x][2];
                        attribute.ValueType = FuncInfo1[x][3];
                        attribute.VarName = FuncInfo1[x][4];
                        attribute.ValueExplain = FuncInfo1[x][5];
                        attribute.Opnode = FuncInfo1[x][6];
                        attribute.Optype = FuncInfo1[x][7];
                        attribute.Opvalue = FuncInfo1[x][8];
                        attribute.Relate = FuncInfo1[x][9];
                        tempCtrl.VisibleFunctionProperty.Add(attribute);
                    }
                }
                if (FuncInfo2 != null)
                {//��������
                    for (int y = 0; y < FuncInfo2.Count; y++)
                    {
                        XProp attribute = new XProp();
                        attribute.EnumValue = FuncInfo2[y][0];
                        attribute.Name = FuncInfo2[y][1];
                        attribute.TheValue = FuncInfo2[y][2];
                        attribute.ValueType = FuncInfo2[y][3];
                        attribute.VarName = FuncInfo2[y][4];
                        attribute.ValueExplain = FuncInfo2[y][5];
                        attribute.Opnode = FuncInfo2[y][6];
                        attribute.Optype = FuncInfo2[y][7];
                        attribute.Opvalue = FuncInfo2[y][8];
                        attribute.Relate = FuncInfo2[y][9];
                        tempCtrl.UnvisibleFunctionProperty.Add(attribute);
                    }
                }
                //λ�á���С��Ϣ
                tempBlock.StartPoint = SizeInfo[0];
                tempBlock.Width = SizeInfo[1].X;
                tempBlock.Height = SizeInfo[1].Y;

                this.ctrlsInfo.Add(tempCtrl);
                this.blocksInfo.Add(tempBlock);
            }
            for (int i = 0; i < line.Count; i++)
            {//������Ϣ
                LineInfo tempLine = new LineInfo();

                Point[] SEinfo = (Point[])(line[i][0]);
                string[] SEctrl = (string[])(line[i][1]);
                tempLine.StartPoint = SEinfo[0];
                tempLine.EndPoint = SEinfo[1];
                tempLine.StartInfo = SEctrl[0];
                tempLine.EndInfo = SEctrl[1];

                this.linesInfo.Add(tempLine);
            }
            portReflash();//ˢ�¿ؼ��˿���Ϣ
            //���¼��������м��
            DrawLineArithmetic newArith = new DrawLineArithmetic(this.linesInfo, this.blocksInfo);
            this.linesInfo = newArith.ModifyLines;
        }
        /// <summary>
        /// �ӿؼ�λ�ñ仯�¼��������
        /// </summary>
        /// <param name="sender">�¼�������</param>
        /// <param name="e">�¼�����</param>
        private void Control_LocationChanged(object sender, EventArgs e)
        {
            Control control = (Control)sender;
            if (control.Location.X < 0 || control.Location.Y < 0)
            {
                control.Location = this.PointToClient(MousePosition);
            }
            else
            {
                ControlInfoChanged(control);
                DrawLineArithmetic newArith = new DrawLineArithmetic(this.linesInfo, this.blocksInfo);
                this.linesInfo = newArith.ModifyLines;

                DrawBackgroundImage();
            }
        }