Ejemplo n.º 1
0
        private void LoadTask(string TClassPath, string TaskName)
        {
            //ÿ�μ�������ǰ�������뽫�������ÿ�
            int i = 0;
            m_listNaviRules = null;
            m_listNaviRules = new List<cNavigRules>();

            Task.cTask t = new Task.cTask();

            try
            {
                t.LoadTask(TClassPath + "\\" + TaskName);
            }
            catch (cSoukeyException ex)
            {
                throw ex;
            }

            //��ʼ�ж�����汾�ţ��������汾�Ų�ƥ�䣬�򲻽���������Ϣ�ļ���
            if (this.SupportTaskVersion !=t.TaskVersion)
            {
                t = null;
                MessageBox.Show(rm.GetString("Info1"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.tTask.Text =t.TaskName ;
            this.txtTaskDemo.Text = t.TaskDemo;

            if (t.TaskClass == "")
            {
                this.comTaskClass.SelectedIndex = 0;
            }
            else
            {
                this.comTaskClass.SelectedItem=t.TaskClass ;
            }

            this.TaskType.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.TaskType));
            this.comRunType.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.RunType));

            if (this.comRunType.SelectedIndex == 0)
            {
                //���ڵ�������
                switch ((cGlobalParas.PublishType)int.Parse(t.ExportType))
                {
                    case cGlobalParas.PublishType.PublishExcel :
                        this.raExportExcel.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishTxt :

                        this.raExportTxt.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishAccess:
                        this.raExportAccess.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishMSSql :
                        this.raExportMSSQL.Checked = true;
                        break;
                    case cGlobalParas.PublishType .PublishMySql :
                        this.raExportMySql.Checked = true;
                        break;
                    case cGlobalParas.PublishType .PublishWeb :
                        this.raExportWeb.Checked = true;
                        break;
                    default :
                        break;
                }
                this.txtFileName.Text = t.ExportFile;
                this.txtDataSource.Text = t.DataSource;
                this.comTableName.Text = t.DataTableName;
                this.txtInsertSql.Text  = t.InsertSql;
                this.txtExportUrl.Text  = t.ExportUrl;
                if (t.ExportUrlCode == null || t.ExportUrlCode =="")
                    this.comExportUrlCode.SelectedIndex = 0;
                else
                    this.comExportUrlCode.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.ExportUrlCode));
                this.txtExportCookie.Text  = t.ExportCookie;
            }
            else
            {
                //���ɼ�����
                this.groupBox4.Enabled = false;
                this.txtFileName.Text = "";
                this.comTableName.Text = "";

            }

            this.txtSavePath.Text = t.SavePath;
            this.udThread.Value = t.ThreadCount;
            this.txtStartPos.Text = t.StartPos;
            this.txtEndPos.Text = t.EndPos;
            this.txtWeblinkDemo.Text = t.DemoUrl;
            this.txtCookie.Text = t.Cookie;
            this.comWebCode.SelectedItem = cGlobalParas.ConvertName(int.Parse (t.WebCode));
            this.IsLogin.Checked = t.IsLogin;
            this.txtLoginUrl.Text = t.LoginUrl;
            this.IsUrlEncode.Checked = t.IsUrlEncode;
            if (t.UrlEncode == "")
            {
                this.comUrlEncode.SelectedIndex = -1;
            }
            else
            {
                this.comUrlEncode.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.UrlEncode));
            }

            //���ظ߼�����
            this.udAgainNumber.Value = t.GatherAgainNumber;
            this.IsIgnore404.Checked = t.IsIgnore404;
            this.IsSaveErrorLog.Checked = t.IsErrorLog;
            this.IsDelRepRow.Checked = t.IsDelRepRow;
            this.IsIncludeHeader.Checked = t.IsExportHeader;

            this.IsStartTrigger.Checked = t.IsTrigger;

            if (t.TriggerType == ((int)cGlobalParas.TriggerType.GatheredRun).ToString ())
                this.raGatheredRun.Checked = true;
            else if (t.TriggerType == ((int)cGlobalParas.TriggerType.PublishedRun).ToString ())
                this.raPublishedRun.Checked = true;

            //������������
            if (this.IsStartTrigger.Checked == true)
            {
                ListViewItem litem;

                for (i = 0; i <t.TriggerTask.Count ; i++)
                {
                    litem = new ListViewItem();
                    litem.Text = cGlobalParas.ConvertName(t.TriggerTask[i].RunTaskType);
                    if (t.TriggerTask[i].RunTaskType == (int)cGlobalParas.RunTaskType.DataTask)
                        litem.SubItems.Add(cGlobalParas.ConvertName(int.Parse(t.TriggerTask[i].RunTaskName)));
                    else
                        litem.SubItems.Add(t.TriggerTask[i].RunTaskName);
                    litem.SubItems.Add(t.TriggerTask[i].RunTaskPara);

                    this.listTask.Items.Add(litem);
                }
            }

            ListViewItem item;

            for (i = 0; i < t.WebpageLink.Count;  i++)
            {
                item=new ListViewItem ();

                if (t.WebpageLink[i].IsNavigation == true)
                {
                    cNavigRules cns = new cNavigRules();
                    cns.Url = t.WebpageLink[i].Weblink.ToString();
                    cns.NavigRule = t.WebpageLink[i].NavigRules;

                    //for (int m=0;m<t.WebpageLink [i].NavigRules.Count;m++)
                    //{
                    //    cn=new cNavigRule ();
                    //    cn.Url =t.WebpageLink[i].NavigRules[m].Url ;
                    //    cn.Level = t.WebpageLink[i].NavigRules[m].Level;
                    //    cn.IsOppUrl = t.WebpageLink[i].NavigRules[m].IsOppUrl;
                    //    cn.NavigRule = t.WebpageLink[i].NavigRules[m].NavigRule;

                    //    cns.NavigRule.Add(cn);
                    //}

                    m_listNaviRules.Add(cns);
                }

                item.Name =t.WebpageLink[i].id.ToString ();
                item.Text =t.WebpageLink[i].Weblink.ToString ();
                if (t.WebpageLink[i].IsNavigation == true)
                {
                    item.SubItems.Add("Y");
                    item.SubItems.Add(t.WebpageLink[i].NavigRules.Count.ToString ());
                }
                else
                {
                    item.SubItems.Add("N");
                    item.SubItems.Add("0");

                }
                item.SubItems.Add(t.WebpageLink[i].NextPageRule);
                item.SubItems.Add(gUrl.GetUrlCount(t.WebpageLink[i].Weblink.ToString ()).ToString ());

                this.listWeblink.Items.Add (item);
                item=null;
            }

            for (i = 0; i < t.WebpageCutFlag.Count ; i++)
            {
                item=new ListViewItem() ;
                item.Name =t.WebpageCutFlag[i].id.ToString ();
                item.Text =t.WebpageCutFlag[i].Title.ToString ();
                item.SubItems.Add(cGlobalParas.ConvertName (t.WebpageCutFlag[i].DataType) );
                item.SubItems.Add (t.WebpageCutFlag[i].StartPos.ToString ());
                item.SubItems.Add (t.WebpageCutFlag[i].EndPos .ToString ());
                item.SubItems.Add(cGlobalParas.ConvertName (t.WebpageCutFlag[i].LimitSign));

                item.SubItems.Add(t.WebpageCutFlag [i].RegionExpression );
                if ((int)t.WebpageCutFlag[i].ExportLimit == 0)
                    item.SubItems.Add("");
                else
                    item.SubItems.Add(cGlobalParas.ConvertName(t.WebpageCutFlag[i].ExportLimit));

                item.SubItems.Add(t.WebpageCutFlag [i].ExportExpression );

                this.listWebGetFlag.Items.Add(item);
                item=null;
            }

            t=null ;
        }
        private bool SaveTask(string TaskPath)
        {
            Task.cTask t = new Task.cTask();

            //����DZ༭״̬������Ҫɾ��ԭ���ļ�
            if (this.FormState == cGlobalParas.FormState.Edit)
            {
                t.TaskName = this.tTask.Text;

                if (this.comTaskClass.SelectedIndex == 0)
                {
                    try
                    {
                        //ɾ��ԭ���������ҪĿ����Ϊ�˱��ݣ�������������������
                        t.DeleTask("", this.tTask.Text);
                    }
                    catch (System.Exception)
                    {
                    }
                }
                else
                {
                    //��ȡ����������·��
                    Task.cTaskClass tClass = new Task.cTaskClass();
                    string tPath = tClass.GetTaskClassPathByName(this.comTaskClass.SelectedItem.ToString());
                    try
                    {
                        //ɾ��ԭ���������ҪĿ����Ϊ�˱��ݣ�������������������
                        t.DeleTask(tPath, this.tTask.Text);
                    }
                    catch (System.Exception)
                    {

                    }
                }
            }

            int i = 0;
            int UrlCount = 0;

            //��������

            //�½�һ������
            t.New();

            t.TaskName = this.tTask.Text;
            t.TaskDemo = this.txtTaskDemo.Text;

            if (this.comTaskClass.SelectedIndex == 0)
            {
                t.TaskClass = "";
            }
            else
            {
                t.TaskClass = this.comTaskClass.SelectedItem.ToString();
            }

            t.TaskType = cGlobalParas.ConvertID(this.TaskType.SelectedItem.ToString()).ToString();
            t.RunType = cGlobalParas.ConvertID(this.comRunType.SelectedItem.ToString()).ToString();
            if (this.txtSavePath.Text.Trim().ToString() == "")
                t.SavePath = Program.getPrjPath() + "data";
            else
                t.SavePath = this.txtSavePath.Text;
            t.ThreadCount = int.Parse(this.udThread.Value.ToString());
            t.StartPos = this.txtStartPos.Text;
            t.EndPos = this.txtEndPos.Text;
            t.DemoUrl = this.txtWeblinkDemo.Text;
            t.Cookie = this.txtCookie.Text;
            t.WebCode = cGlobalParas.ConvertID(this.comWebCode.SelectedItem.ToString()).ToString();
            t.IsLogin = this.IsLogin.Checked;
            t.LoginUrl = this.txtLoginUrl.Text;
            t.IsUrlEncode = this.IsUrlEncode.Checked;
            if (this.IsUrlEncode.Checked == false)
            {
                t.UrlEncode = "";
            }
            else
            {
                t.UrlEncode = cGlobalParas.ConvertID(this.comUrlEncode.SelectedItem.ToString()).ToString();
            }

            //�ж��Ƿ񵼳��ļ����洢������������Ϣ
            if (this.comRunType.SelectedIndex == 0)
            {

                if (this.raExportTxt.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishTxt).ToString();
                }
                else if (this.raExportExcel.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishExcel).ToString();
                }
                else if (this.raExportAccess.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishAccess).ToString();
                }
                else if (this.raExportMSSQL.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishMSSql).ToString();
                }
                else if (this.raExportMySql.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishMySql).ToString();
                }
                else if (this.raExportWeb.Checked == true)
                {
                    t.ExportType = ((int)cGlobalParas.PublishType.PublishWeb).ToString();
                }

                t.ExportFile = this.txtFileName.Text.ToString();
                t.DataSource = this.txtDataSource.Text.ToString();

                t.DataTableName = this.comTableName.Text.ToString();
                t.InsertSql = this.txtInsertSql.Text;
                t.ExportUrl = this.txtExportUrl.Text;
                t.ExportUrlCode = cGlobalParas.ConvertID(this.comExportUrlCode.SelectedItem.ToString()).ToString();
                t.ExportCookie = this.txtExportCookie.Text;
            }
            else
            {

                t.ExportFile = "";
                t.DataSource = "";

                t.ExportType = ((int)cGlobalParas.PublishType.NoPublish).ToString();
                t.DataSource = "";
                t.DataTableName = "";
            }

            //��ʼ�洢�߼�������Ϣ
            t.GatherAgainNumber = int.Parse(this.udAgainNumber.Value.ToString());
            t.IsIgnore404 = this.IsIgnore404.Checked;
            t.IsExportHeader = this.IsIncludeHeader.Checked;
            t.IsDelRepRow = this.IsDelRepRow.Checked;
            t.IsErrorLog = this.IsSaveErrorLog.Checked;

            t.IsTrigger = this.IsStartTrigger.Checked;

            if (this.raGatheredRun.Checked == true)
                t.TriggerType = ((int)cGlobalParas.TriggerType.GatheredRun).ToString();
            else if (this.raPublishedRun.Checked == true)
                t.TriggerType = ((int)cGlobalParas.TriggerType.PublishedRun).ToString();

            cTriggerTask tt;

            //��ʼ��Ӵ�����ִ�е�����
            for (i = 0; i < this.listTask.Items.Count; i++)
            {
                tt = new cTriggerTask();
                tt.RunTaskType = cGlobalParas.ConvertID(this.listTask.Items[i].Text);

                if (cGlobalParas.ConvertID(this.listTask.Items[i].Text) == (int)cGlobalParas.RunTaskType.DataTask)
                    tt.RunTaskName = cGlobalParas.ConvertID(this.listTask.Items[i].SubItems[1].Text.ToString()).ToString();
                else
                    tt.RunTaskName = this.listTask.Items[i].SubItems[1].Text.ToString();

                tt.RunTaskPara = this.listTask.Items[i].SubItems[2].Text.ToString();

                t.TriggerTask.Add(tt);
            }

            for (i = 0; i < this.listWeblink.Items.Count; i++)
            {
                UrlCount += int.Parse(this.listWeblink.Items[i].SubItems[4].Text);
            }
            t.UrlCount = UrlCount;

            Task.cWebLink w;
            for (i = 0; i < this.listWeblink.Items.Count; i++)
            {
                w = new Task.cWebLink();
                w.id = i;
                w.Weblink = this.listWeblink.Items[i].Text;
                if (this.listWeblink.Items[i].SubItems[1].Text == "N")
                {
                    w.IsNavigation = false;
                }
                else
                {
                    w.IsNavigation = true;

                    //��ӵ�������
                    for (int m = 0; m < m_listNaviRules.Count; m++)
                    {
                        if (m_listNaviRules[m].Url == this.listWeblink.Items[i].Text)
                        {
                            w.NavigRules = m_listNaviRules[m].NavigRule;
                            break;
                        }
                    }

                }

                if (this.listWeblink.Items[i].SubItems[3].Text == "" || this.listWeblink.Items[i].SubItems[3].Text == null)
                {
                    w.IsNextpage = false;
                }
                else
                {
                    w.IsNextpage = true;
                    w.NextPageRule = this.listWeblink.Items[i].SubItems[3].Text;
                }

                t.WebpageLink.Add(w);
                w = null;
            }

            Task.cWebpageCutFlag c;
            for (i = 0; i < this.listWebGetFlag.Items.Count; i++)
            {
                c = new Task.cWebpageCutFlag();
                c.id = i;
                c.Title = this.listWebGetFlag.Items[i].Text;
                c.DataType = cGlobalParas.ConvertID(this.listWebGetFlag.Items[i].SubItems[1].Text);
                c.StartPos = this.listWebGetFlag.Items[i].SubItems[2].Text;
                c.EndPos = this.listWebGetFlag.Items[i].SubItems[3].Text;
                c.LimitSign = cGlobalParas.ConvertID(this.listWebGetFlag.Items[i].SubItems[4].Text);

                try
                {
                    c.RegionExpression = this.listWebGetFlag.Items[i].SubItems[5].Text;
                    c.ExportLimit = cGlobalParas.ConvertID(this.listWebGetFlag.Items[i].SubItems[6].Text);
                    c.ExportExpression = this.listWebGetFlag.Items[i].SubItems[7].Text;
                }
                catch (System.Exception)
                {
                    //������󲻴��������1.0�汾
                }

                t.WebpageCutFlag.Add(c);
                c = null;

            }

            t.Save(TaskPath);
            t = null;

            return true;
        }
        public void AutoAddTask()
        {
            //��ȡ���з��࣬Ȼ����ݷ����������
            cTaskClass xmlTClass = new cTaskClass();
            cTaskIndex xmlTasks;

            //��ȡ���ж��ٸ��������
            int TClassCount = xmlTClass.GetTaskClassCount();

            for (int i = 0; i < TClassCount; i++)
            {
                xmlTasks = new cTaskIndex();

                //��ȡ�˷����¹��й��ٸ�����
                xmlTasks.GetTaskDataByClass(xmlTClass.GetTaskClassName(i));

                int count = xmlTasks.GetTaskClassCount();

                cTask t;

                ListViewItem Litem;

                for (int j = 0; j < count; j++)
                {
                    t = new cTask();
                    try
                    {
                        t.LoadTask(xmlTClass.GetTaskClassPathByName(xmlTClass.GetTaskClassName(i)) + "\\" + xmlTasks.GetTaskName(j) + ".xml");
                        t = null;
                    }
                    catch (cSoukeyException)
                    {
                        Litem = new ListViewItem();

                        Litem.ImageIndex = 0;
                        Litem.Text = "�ȴ�����";
                        Litem.SubItems.Add(xmlTasks.GetTaskName(j));
                        Litem.SubItems.Add(t.TaskVersion.ToString());
                        Litem.SubItems.Add(xmlTClass.GetTaskClassName(i));
                        Litem.SubItems.Add(xmlTClass.GetTaskClassPathByName(xmlTClass.GetTaskClassName(i)));
                        Litem.SubItems.Add("");
                        //���½�������Ϣ
                        m_sender.BeginInvoke(m_senderDelegate, new object[] { TClassCount + count, j + i, Litem, false });

                        Application.DoEvents();
                    }
                    catch (System.Exception ex)
                    {

                    }

                }

                //���½�������Ϣ
                m_sender.BeginInvoke(m_senderDelegate, new object[] { TClassCount, i, null, false });
            }

            m_sender.BeginInvoke(m_senderDelegate, new object[] { TClassCount, TClassCount,null, true  });

            xmlTClass = null;
        }
        private void AddUpgradeTask(string FileName)
        {
            cTask t = new cTask();

            ListViewItem Litem;

            try
            {
                t.LoadTask(FileName);
                t = null;
                MessageBox.Show(rm.GetString("Info106"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            catch (cSoukeyException)
            {
                Litem = new ListViewItem();
                Litem.ImageIndex = 0;
                Litem.Text = "�ȴ�����";
                Litem.SubItems.Add(t.TaskName);
                Litem.SubItems.Add(t.TaskVersion.ToString());
                Litem.SubItems.Add("");
                Litem.SubItems.Add(Path.GetDirectoryName (FileName ));
                Litem.SubItems.Add("");
                this.listTask.Items.Add(Litem);

                Application.DoEvents();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(rm.GetString("Info107") + ex.Message, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Ejemplo n.º 5
0
        private void treeMenu_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(DataGridViewRow)))
            {
                Point p = this.treeMenu.PointToClient(new Point(e.X, e.Y));
                TreeViewHitTestInfo index = this.treeMenu.HitTest(p);

                if (index.Node != null)
                {
                    if (index.Node.Name.Substring(0, 1) == "C" || index.Node.Name == "nodTaskClass")
                    {
                        DataGridViewRow drv = (DataGridViewRow)e.Data.GetData(typeof(DataGridViewRow));

                        string TaskName = drv.Cells[4].Value.ToString();

                        string oldName="";

                        if (Old_SelectedNode.Name == "nodTaskClass")
                            OldName = "";
                        else
                            oldName = Old_SelectedNode.Text;

                        string NewName="";
                        if (index.Node.Name == "nodTaskClass")
                            NewName = "";
                        else
                            NewName = index.Node.Text;

                        if (oldName == NewName)
                        {
                            this.treeMenu.SelectedNode = Old_SelectedNode;
                            return;
                        }

                        cTask t = new cTask();

                        try
                        {
                            t.ChangeTaskClass(TaskName, oldName, NewName);
                        }
                        catch (System.Exception ex)
                        {
                            MessageBox.Show(rm.GetString("Info49") + ex.Message, rm.GetString("MessageboxError"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            t = null;
                            this.treeMenu.SelectedNode = Old_SelectedNode;
                            return;
                        }

                        t = null;

                        this.dataTask.Rows.Remove(drv);
                    }
                    else
                    {
                        MessageBox.Show(rm.GetString ("Info50") + index.Node.Text, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                this.treeMenu.SelectedNode = Old_SelectedNode;
            }
        }
        //ָ�����������������
        /// <summary>
        /// �����������
        /// </summary>
        /// <param name="FileName">�������������ļ�</param>
        /// <param name="IsBackup">�Ƿ񱸷�</param>
        /// <param name="IsTask">�Ƿ�Ϊϵͳ���������ϵͳ��������Ҫά��������Ϣ��������Ǿ�ֻ�����ļ�</param>
        public void UpdradeTask(string FileName ,bool IsBackup,bool IsSystemTask)
        {
            //�ж��Ƿ���б���
            if (IsBackup == true)
            {
                if (File.Exists(FileName + ".bak"))
                    File.Delete(FileName + ".bak");

                File.Copy(FileName, FileName + ".bak");
            }

            //���������ļ�
            cXmlIO Old_Task = new cXmlIO(FileName);
            Single TaskVersion =Single.Parse ("0");

            cTask t = new cTask();

            //�ж�����汾��
            try
            {
                TaskVersion = Single.Parse(Old_Task.GetNodeValue("Task/BaseInfo/Version"));
            }
            catch (System.Exception)
            {
                TaskVersion = Single.Parse("1.0");
            }

            if (TaskVersion >= this.SupportTaskVersion)
            {
                Old_Task = null;
                return;
            }

            //��ʼ�½�һ������
            t.New();

            #region �˲����������κΰ汾�����ڵ�
            t.TaskID = Int64.Parse(Old_Task.GetNodeValue("Task/BaseInfo/ID"));
            t.TaskName = Old_Task.GetNodeValue("Task/BaseInfo/Name");
            t.TaskVersion = this.SupportTaskVersion;

            t.TaskDemo = Old_Task.GetNodeValue("Task/BaseInfo/TaskDemo");
            t.TaskClass = Old_Task.GetNodeValue("Task/BaseInfo/Class");
            t.TaskType = Old_Task.GetNodeValue("Task/BaseInfo/Type");
            t.RunType = Old_Task.GetNodeValue("Task/BaseInfo/RunType");

            //���������·��������Ҫ����ϵͳ·��
            t.SavePath = Program.getPrjPath() + Old_Task.GetNodeValue("Task/BaseInfo/SavePath");
            t.UrlCount = int.Parse(Old_Task.GetNodeValue("Task/BaseInfo/UrlCount").ToString());
            t.ThreadCount = int.Parse(Old_Task.GetNodeValue("Task/BaseInfo/ThreadCount"));
            t.Cookie = Old_Task.GetNodeValue("Task/BaseInfo/Cookie");
            t.DemoUrl = Old_Task.GetNodeValue("Task/BaseInfo/DemoUrl");
            t.StartPos = Old_Task.GetNodeValue("Task/BaseInfo/StartPos");
            t.EndPos = Old_Task.GetNodeValue("Task/BaseInfo/EndPos");
            t.WebCode = Old_Task.GetNodeValue("Task/BaseInfo/WebCode");
            t.IsLogin = (Old_Task.GetNodeValue("Task/BaseInfo/IsLogin") == "True" ? true : false);
            t.LoginUrl = Old_Task.GetNodeValue("Task/BaseInfo/LoginUrl");
            t.IsUrlEncode = (Old_Task.GetNodeValue("Task/BaseInfo/IsUrlEncode") == "True" ? true : false);
            t.UrlEncode = Old_Task.GetNodeValue("Task/BaseInfo/UrlEncode");
            #endregion

            //����������ݿ�ʼ�п��ܾͳ���������ش���
            //����������1.2�汾�����ӵģ��߼����á���㵼������������1.3�汾�г��ֵ�
            //
            if (Old_Task.GetNodeValue("Task/Result/ExportType") == "")
                t.ExportType = ((int)cGlobalParas.PublishType.PublishTxt).ToString();
            else
                t.ExportType = Old_Task.GetNodeValue("Task/Result/ExportType");

            if (Old_Task.GetNodeValue("Task/Result/ExportFileName") == "")
                t.ExportFile = Program.getPrjPath() + "data\\" + t.TaskName + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".txt";
            else
                t.ExportFile = Old_Task.GetNodeValue("Task/Result/ExportFileName");

            if (Old_Task.GetNodeValue("Task/Result/DataSource") == "")
                t.DataSource = "";
            else
                t.DataSource = Old_Task.GetNodeValue("Task/Result/DataSource");

            if (Old_Task.GetNodeValue("Task/Result/DataTableName") == "")
                t.DataTableName = "";
            else
                t.DataTableName = Old_Task.GetNodeValue("Task/Result/DataTableName");

            if (Old_Task.GetNodeValue("Task/Result/InsertSql") == "")
                t.InsertSql = "";
            else
                t.InsertSql = Old_Task.GetNodeValue("Task/Result/InsertSql");

            if (Old_Task.GetNodeValue("Task/Result/ExportUrl") == "")
                t.ExportUrl = "";
            else
                t.ExportUrl = Old_Task.GetNodeValue("Task/Result/ExportUrl");

            if (Old_Task.GetNodeValue("Task/Result/ExportUrlCode") == "")
                t.ExportUrlCode = "";
            else
                t.ExportUrlCode = Old_Task.GetNodeValue("Task/Result/ExportUrlCode");

            if (Old_Task.GetNodeValue("Task/Result/ExportCookie") == "")
                t.ExportCookie = "";
            else
                t.ExportCookie = Old_Task.GetNodeValue("Task/Result/ExportCookie");

            //�˲�����1.3�汾�д��ڵģ���Ҫ����
            //���ظ߼�������Ϣ
            if (Old_Task.GetNodeValue("Task/Advance/GatherAgainNumber") == "")
                t.GatherAgainNumber = 3;
            else
                t.GatherAgainNumber = int.Parse(Old_Task.GetNodeValue("Task/Advance/GatherAgainNumber"));

            if (Old_Task.GetNodeValue("Task/Advance/IsIgnore404") == "")
                t.IsIgnore404 = true;
            else
                t.IsIgnore404 = (Old_Task.GetNodeValue("Task/Advance/IsIgnore404") == "True" ? true : false);

            if (Old_Task.GetNodeValue("Task/Advance/IsErrorLog") == "")
                t.IsErrorLog = false;
            else
                t.IsErrorLog = (Old_Task.GetNodeValue("Task/Advance/IsErrorLog") == "True" ? true : false);

            if (Old_Task.GetNodeValue("Task/Advance/IsDelRepeatRow") == "")
                t.IsDelRepRow = false;
            else
                t.IsDelRepRow = (Old_Task.GetNodeValue("Task/Advance/IsDelRepeatRow") == "True" ? true : false);

            if (Old_Task.GetNodeValue("Task/Advance/IsExportHeader") == "")
                t.IsExportHeader = true;
            else
                t.IsExportHeader = (Old_Task.GetNodeValue("Task/Advance/IsExportHeader") == "True" ? true : false);

            if (Old_Task.GetNodeValue("Task/Advance/IsTrigger") == "")
                t.IsTrigger = false;
            else
                t.IsTrigger = (Old_Task.GetNodeValue("Task/Advance/IsTrigger") == "True" ? true : false);

            if (Old_Task.GetNodeValue("Task/Advance/TriggerType")=="")
                t.TriggerType = ((int)cGlobalParas.TriggerType.GatheredRun).ToString();
            else
                t.TriggerType = Old_Task.GetNodeValue("Task/Advance/TriggerType");

            DataView dw = new DataView();
            int i;

            //�˴������У�����Ҫ����Trigger��Ϣ����ǰ����汾�в����ڣ����������п��Բ�����
            //dw = Old_Task.GetData("descendant::Trigger");
            //cTriggerTask tt;

            //if (dw != null)
            //{
            //    for (i = 0; i < dw.Count; i++)
            //    {
            //        tt = new cTriggerTask();
            //        tt.RunTaskType = int.Parse(dw[i].Row["RunTaskType"].ToString());
            //        tt.RunTaskName = dw[i].Row["RunTaskName"].ToString();
            //        tt.RunTaskPara = dw[i].Row["RunTaskPara"].ToString();

            //        t.TriggerTask.Add(tt);
            //    }
            //}

            ////dw = null;
            ////dw = new DataView();

            dw = Old_Task.GetData("descendant::WebLinks");
            cWebLink w;

            DataView dn;

            if (dw != null)
            {
                for (i = 0; i < dw.Count; i++)
                {
                    w = new cWebLink();
                    w.id = i;
                    w.Weblink = dw[i].Row["Url"].ToString();
                    if (dw[i].Row["IsNag"].ToString() == "True")
                        w.IsNavigation = true;
                    else
                        w.IsNavigation = false;

                    if (dw[i].Row["IsNextPage"].ToString() == "True")
                        w.IsNextpage = true;
                    else
                        w.IsNextpage = false;

                    w.NextPageRule = dw[i].Row["NextPageRule"].ToString();
                    w.IsGathered = int.Parse((dw[i].Row["IsGathered"].ToString() == null || dw[i].Row["IsGathered"].ToString() == "") ? "2031" : dw[i].Row["IsGathered"].ToString());

                    if (dw[i].Row["IsNag"].ToString() == "True")
                    {
                        //�ڴ˴�����������������������ǰ�汾�д��ڵ���������ֻ��һ�㵼��
                        cNavigRule nRule = new cNavigRule();
                        nRule.Url = dw[i].Row["Url"].ToString();
                        nRule.Level =1;
                        nRule.NavigRule = dw[i].Row["NagRule"].ToString();

                        w.NavigRules.Add(nRule);
                    }
                    else
                    {
                    }

                    t.WebpageLink.Add(w);
                    w = null;
                }
            }

            dw = null;
            dw = new DataView();
            dw = Old_Task.GetData("descendant::GatherRule");
            Task.cWebpageCutFlag c;
            if (dw != null)
            {
                for (i = 0; i < dw.Count; i++)
                {
                    c = new Task.cWebpageCutFlag();
                    c.Title = dw[i].Row["Title"].ToString();
                    c.DataType = int.Parse((dw[i].Row["DataType"].ToString() == null || dw[i].Row["DataType"].ToString() == "") ? "0" : dw[i].Row["DataType"].ToString());
                    c.StartPos = dw[i].Row["StartFlag"].ToString();
                    c.EndPos = dw[i].Row["EndFlag"].ToString();
                    c.LimitSign = int.Parse((dw[i].Row["LimitSign"].ToString() == null || dw[i].Row["LimitSign"].ToString() == "") ? "0" : dw[i].Row["LimitSign"].ToString());

                    //����汾��ͬʱ��ɵĴ��󣬲��񲻴���
                    try
                    {
                        c.RegionExpression = dw[i].Row["RegionExpression"].ToString();
                        c.ExportLimit = int.Parse((dw[i].Row["ExportLimit"].ToString() == null || dw[i].Row["ExportLimit"].ToString() == "") ? "0" : dw[i].Row["ExportLimit"].ToString());
                        c.ExportExpression = dw[i].Row["ExportExpression"].ToString();
                    }
                    catch (System.Exception)
                    {
                    }

                    t.WebpageCutFlag.Add(c);
                    c = null;
                }
            }
            dw = null;

            Old_Task = null;

            //��ȡ���ļ���Ŀ¼����
            string FilePath = Path.GetDirectoryName(FileName);

            if (IsSystemTask == true)
            {
                t.DeleTask(FilePath, t.TaskName);

                t.Save(FilePath + "\\");
            }
            else
            {
                t.SaveTaskFile(FilePath);
            }
            t = null;
        }
Ejemplo n.º 7
0
        private bool RenameTaskName(string TaskClass,string OldName, string NewName)
        {
            cTask t = new cTask();

            try
            {
                t.RenameTask(TaskClass, OldName, NewName);
            }
            catch (System.Exception ex)
            {
                t = null;
                MessageBox.Show(rm.GetString("Info64") + ex.Message, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            t = null;

            return true;
        }
Ejemplo n.º 8
0
        private void PasteTask()
        {
            IDataObject cdata;
            cdata = Clipboard.GetDataObject();

            string TaskClass;
            string TaskName;

            //�ж������Ƿ�Ϊ�ı�
            if (IsClipboardSoukeyData())
            {
                string tInfo = cdata.GetData(DataFormats.Text).ToString();
                tInfo = tInfo.Substring(17, tInfo.Length - 17);

                //���Էֽ��ȡ���ı����п��ܼ������е���Ϣ����Soukey��ժ����Ϣ
                if (tInfo.IndexOf("/") >= 0)
                {
                    try
                    {
                        bool IsTaskClass = false;
                        bool IsTaskName = false;

                        TaskClass = tInfo.Substring(0, tInfo.IndexOf("/") );
                        TaskName = tInfo.Substring(tInfo.IndexOf("/") + 1, tInfo.Length - tInfo.IndexOf("/") - 1);

                        if (TaskClass == "" && TaskName == "")
                            return;

                        //��Ϣ�ֽ���ٴ���ָ֤������������Ƿ����
                        cTaskClass tc = new cTaskClass();
                        int TClassCount = tc.GetTaskClassCount();

                        for (int i = 0; i < TClassCount; i++)
                        {
                            //taskclassΪ�ձ�ʾ���ڷ���ĸ��ڵ���
                            if (tc.GetTaskClassName(i) == TaskClass || TaskClass=="")
                            {
                                IsTaskClass = true;
                                break;
                            }
                        }

                        if (IsTaskClass == false)
                        {
                            throw new cSoukeyException(rm.GetString("Error17"));
                            return;
                        }

                        string tClassPath = tc.GetTaskClassPathByName(TaskClass);

                        tc = null;

                        //ճ���������
                        string NewTClass="";

                        if (this.treeMenu.SelectedNode.Name == "nodTaskClass")
                            NewTClass = "";
                        else
                            NewTClass = this.treeMenu.SelectedNode.Text;

                        cTask t = new cTask();

                        t.CopyTask(TaskName, TaskClass, NewTClass);

                        //����datagridview���У���ʾ�����ɹ�

                        this.dataTask.Rows.Add(imageList1.Images["task"], t.TaskID, cGlobalParas.TaskState.UnStart, this.treeMenu.SelectedNode.Name, t.TaskName,
                            cGlobalParas.ConvertName(int.Parse(t.TaskType)), (t.IsLogin == true ? rm.GetString("Logon") : rm.GetString("NoLogon")),
                           t.WebpageLink.Count.ToString(), cGlobalParas.ConvertName(int.Parse(t.RunType)),
                           cGlobalParas.ConvertName(int.Parse ( t.ExportType)));

                        t = null;
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(rm.GetString("Info68") + ex.Message, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void ImportTask()
        {
            //֧��ͬʱ����������

            this.openFileDialog1.Title = rm.GetString ("Info44");

            openFileDialog1.InitialDirectory = Program.getPrjPath() + "tasks";
            openFileDialog1.Filter = "Soukey Task Files(*.xml)|*.xml";

            if (this.openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string FileName = this.openFileDialog1.FileName;
            string TaskClass = "";
            string NewFileName = "";

            //��֤�����ʽ�Ƿ���ȷ
            try
            {
                Task.cTask t = new Task.cTask();
                t.LoadTask(FileName);

                if (t.TaskName != "")
                {
                    NewFileName = t.TaskName + ".xml";
                }

                if (t.TaskClass != "")
                {
                    TaskClass = t.TaskClass.ToString();
                }

                //��������ķ��ർ��ָ����Ŀ¼
                string TaskPath = Program.getPrjPath() + "tasks\\";
                if (TaskClass != "")
                {
                    TaskPath += TaskClass ;
                }

                if (NewFileName == "")
                {
                    NewFileName = "task" + DateTime.Now.ToFileTime().ToString() + ".xml";
                }

                if (FileName == TaskPath + NewFileName)
                {
                    MessageBox.Show(rm.GetString("Info45"), rm.GetString ("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                Task.cTaskClass cTClass = new Task.cTaskClass();

                if (!cTClass.IsExist(TaskClass) && TaskClass != "")
                {
                    //��ʾ��һ�����������
                    int TaskClassID = cTClass.AddTaskClass(TaskClass, TaskPath);
                    cTClass = null;

                    //�������νṹ���������ڵ�
                    TreeNode newNode = new TreeNode();
                    newNode.Tag = TaskPath;
                    newNode.Name = "C" + TaskClassID;
                    newNode.Text = TaskClass;
                    newNode.ImageIndex = 0;
                    newNode.SelectedImageIndex = 0;
                    this.treeMenu.Nodes["nodTaskClass"].Nodes.Add(newNode);
                    newNode = null;

                }

                try
                {
                    System.IO.File.Copy(FileName, TaskPath + "\\" + NewFileName);
                }
                catch (System.IO.IOException)
                {
                    t = null;
                    MessageBox.Show(rm.GetString("Info46"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //�������������ļ�
                t.InsertTaskIndex(TaskPath);

                t = null;

                MessageBox.Show(rm.GetString ("Info47") + TaskClass, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            catch (cSoukeyException )
            {
                if (MessageBox.Show(rm.GetString("Quaere17"),  rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    frmUpgradeTask fu = new frmUpgradeTask(FileName);
                    fu.ShowDialog();
                    fu.Dispose();
                    fu = null;
                }

                return;
            }

            catch (System.Exception ex)
            {
                MessageBox.Show(rm.GetString("Info48") + ex.Message, rm.GetString ("MessageboxError"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Ejemplo n.º 10
0
        private bool DelTask()
        {
            if (this.dataTask.SelectedRows.Count ==0)
            {
                return false;
            }

            if (this.dataTask.SelectedRows.Count ==1)
            {
                if (MessageBox.Show(rm.GetString ("Info28") + this.dataTask.SelectedCells[4].Value + "\r\n"
                    + rm.GetString("Quaere5"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return false;
                }
            }
            else
            {
                if (MessageBox.Show(rm.GetString("Quaere6"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return false;
                }
            }

            //��ʾѡ���������ڵ�
            try
            {
                for (int index=0; index < this.dataTask.SelectedRows.Count; index++)
                {
                    Task.cTask t = new Task.cTask();
                    t.DeleTask(this.treeMenu.SelectedNode.Tag.ToString(), this.dataTask.SelectedRows[index].Cells[4].Value.ToString());
                    t = null;

                }
                    return true;

            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, rm.GetString("MessageboxError"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return false ;
            }
        }
Ejemplo n.º 11
0
        //指定任务进行升级操作
        /// <summary>
        /// 升级任务操作
        /// </summary>
        /// <param name="FileName">待升级的任务文件</param>
        /// <param name="IsBackup">是否备份</param>
        /// <param name="IsTask">是否为系统任务,如果是系统任务则需要维护分类信息,如果不是就只保存文件</param>
        public void UpdradeTask(string FileName, bool IsBackup, bool IsSystemTask)
        {
            //判断是否进行备份
            if (IsBackup == true)
            {
                if (File.Exists(FileName + ".bak"))
                {
                    File.Delete(FileName + ".bak");
                }

                File.Copy(FileName, FileName + ".bak");
            }


            //加载任务文件
            cXmlIO Old_Task    = new cXmlIO(FileName);
            Single TaskVersion = Single.Parse("0");

            cTask t = new cTask();

            //判断任务版本号
            try
            {
                TaskVersion = Single.Parse(Old_Task.GetNodeValue("Task/BaseInfo/Version"));
            }
            catch (System.Exception)
            {
                TaskVersion = Single.Parse("1.0");
            }

            if (TaskVersion >= this.SupportTaskVersion)
            {
                Old_Task = null;
                return;
            }

            //开始新建一个任务
            t.New();

            #region 此部分内容是任何版本都存在的
            t.TaskID      = Int64.Parse(Old_Task.GetNodeValue("Task/BaseInfo/ID"));
            t.TaskName    = Old_Task.GetNodeValue("Task/BaseInfo/Name");
            t.TaskVersion = this.SupportTaskVersion;



            t.TaskDemo  = Old_Task.GetNodeValue("Task/BaseInfo/TaskDemo");
            t.TaskClass = Old_Task.GetNodeValue("Task/BaseInfo/Class");
            t.TaskType  = Old_Task.GetNodeValue("Task/BaseInfo/Type");
            t.RunType   = Old_Task.GetNodeValue("Task/BaseInfo/RunType");

            //因存的是相对路径,所以要加上系统路径
            t.SavePath    = Program.getPrjPath() + Old_Task.GetNodeValue("Task/BaseInfo/SavePath");
            t.UrlCount    = int.Parse(Old_Task.GetNodeValue("Task/BaseInfo/UrlCount").ToString());
            t.ThreadCount = int.Parse(Old_Task.GetNodeValue("Task/BaseInfo/ThreadCount"));
            t.Cookie      = Old_Task.GetNodeValue("Task/BaseInfo/Cookie");
            t.DemoUrl     = Old_Task.GetNodeValue("Task/BaseInfo/DemoUrl");
            t.StartPos    = Old_Task.GetNodeValue("Task/BaseInfo/StartPos");
            t.EndPos      = Old_Task.GetNodeValue("Task/BaseInfo/EndPos");
            t.WebCode     = Old_Task.GetNodeValue("Task/BaseInfo/WebCode");
            t.IsLogin     = (Old_Task.GetNodeValue("Task/BaseInfo/IsLogin") == "True" ? true : false);
            t.LoginUrl    = Old_Task.GetNodeValue("Task/BaseInfo/LoginUrl");
            t.IsUrlEncode = (Old_Task.GetNodeValue("Task/BaseInfo/IsUrlEncode") == "True" ? true : false);
            t.UrlEncode   = Old_Task.GetNodeValue("Task/BaseInfo/UrlEncode");
            #endregion



            //从下面的内容开始有可能就出现任务加载错误,
            //导出部分是1.2版本中增加的,高级设置、多层导航及触发器是1.3版本中出现的
            //
            if (Old_Task.GetNodeValue("Task/Result/ExportType") == "")
            {
                t.ExportType = ((int)cGlobalParas.PublishType.PublishTxt).ToString();
            }
            else
            {
                t.ExportType = Old_Task.GetNodeValue("Task/Result/ExportType");
            }

            if (Old_Task.GetNodeValue("Task/Result/ExportFileName") == "")
            {
                t.ExportFile = Program.getPrjPath() + "data\\" + t.TaskName + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".txt";
            }
            else
            {
                t.ExportFile = Old_Task.GetNodeValue("Task/Result/ExportFileName");
            }

            if (Old_Task.GetNodeValue("Task/Result/DataSource") == "")
            {
                t.DataSource = "";
            }
            else
            {
                t.DataSource = Old_Task.GetNodeValue("Task/Result/DataSource");
            }

            if (Old_Task.GetNodeValue("Task/Result/DataTableName") == "")
            {
                t.DataTableName = "";
            }
            else
            {
                t.DataTableName = Old_Task.GetNodeValue("Task/Result/DataTableName");
            }

            if (Old_Task.GetNodeValue("Task/Result/InsertSql") == "")
            {
                t.InsertSql = "";
            }
            else
            {
                t.InsertSql = Old_Task.GetNodeValue("Task/Result/InsertSql");
            }

            if (Old_Task.GetNodeValue("Task/Result/ExportUrl") == "")
            {
                t.ExportUrl = "";
            }
            else
            {
                t.ExportUrl = Old_Task.GetNodeValue("Task/Result/ExportUrl");
            }

            if (Old_Task.GetNodeValue("Task/Result/ExportUrlCode") == "")
            {
                t.ExportUrlCode = "";
            }
            else
            {
                t.ExportUrlCode = Old_Task.GetNodeValue("Task/Result/ExportUrlCode");
            }

            if (Old_Task.GetNodeValue("Task/Result/ExportCookie") == "")
            {
                t.ExportCookie = "";
            }
            else
            {
                t.ExportCookie = Old_Task.GetNodeValue("Task/Result/ExportCookie");
            }

            //此部分是1.3版本中存在的,需要升级
            //加载高级配置信息
            if (Old_Task.GetNodeValue("Task/Advance/GatherAgainNumber") == "")
            {
                t.GatherAgainNumber = 3;
            }
            else
            {
                t.GatherAgainNumber = int.Parse(Old_Task.GetNodeValue("Task/Advance/GatherAgainNumber"));
            }

            if (Old_Task.GetNodeValue("Task/Advance/IsIgnore404") == "")
            {
                t.IsIgnore404 = true;
            }
            else
            {
                t.IsIgnore404 = (Old_Task.GetNodeValue("Task/Advance/IsIgnore404") == "True" ? true : false);
            }

            if (Old_Task.GetNodeValue("Task/Advance/IsErrorLog") == "")
            {
                t.IsErrorLog = false;
            }
            else
            {
                t.IsErrorLog = (Old_Task.GetNodeValue("Task/Advance/IsErrorLog") == "True" ? true : false);
            }

            if (Old_Task.GetNodeValue("Task/Advance/IsDelRepeatRow") == "")
            {
                t.IsDelRepRow = false;
            }
            else
            {
                t.IsDelRepRow = (Old_Task.GetNodeValue("Task/Advance/IsDelRepeatRow") == "True" ? true : false);
            }

            if (Old_Task.GetNodeValue("Task/Advance/IsExportHeader") == "")
            {
                t.IsExportHeader = true;
            }
            else
            {
                t.IsExportHeader = (Old_Task.GetNodeValue("Task/Advance/IsExportHeader") == "True" ? true : false);
            }

            if (Old_Task.GetNodeValue("Task/Advance/IsTrigger") == "")
            {
                t.IsTrigger = false;
            }
            else
            {
                t.IsTrigger = (Old_Task.GetNodeValue("Task/Advance/IsTrigger") == "True" ? true : false);
            }

            if (Old_Task.GetNodeValue("Task/Advance/TriggerType") == "")
            {
                t.TriggerType = ((int)cGlobalParas.TriggerType.GatheredRun).ToString();
            }
            else
            {
                t.TriggerType = Old_Task.GetNodeValue("Task/Advance/TriggerType");
            }

            DataView dw = new DataView();
            int      i;

            //此次升级中,不需要加载Trigger信息,以前任务版本中不存在,升级过程中可以不考虑
            //dw = Old_Task.GetData("descendant::Trigger");
            //cTriggerTask tt;

            //if (dw != null)
            //{
            //    for (i = 0; i < dw.Count; i++)
            //    {
            //        tt = new cTriggerTask();
            //        tt.RunTaskType = int.Parse(dw[i].Row["RunTaskType"].ToString());
            //        tt.RunTaskName = dw[i].Row["RunTaskName"].ToString();
            //        tt.RunTaskPara = dw[i].Row["RunTaskPara"].ToString();

            //        t.TriggerTask.Add(tt);
            //    }
            //}

            ////dw = null;
            ////dw = new DataView();

            dw = Old_Task.GetData("descendant::WebLinks");
            cWebLink w;

            DataView dn;

            if (dw != null)
            {
                for (i = 0; i < dw.Count; i++)
                {
                    w         = new cWebLink();
                    w.id      = i;
                    w.Weblink = dw[i].Row["Url"].ToString();
                    if (dw[i].Row["IsNag"].ToString() == "True")
                    {
                        w.IsNavigation = true;
                    }
                    else
                    {
                        w.IsNavigation = false;
                    }

                    if (dw[i].Row["IsNextPage"].ToString() == "True")
                    {
                        w.IsNextpage = true;
                    }
                    else
                    {
                        w.IsNextpage = false;
                    }

                    w.NextPageRule = dw[i].Row["NextPageRule"].ToString();
                    w.IsGathered   = int.Parse((dw[i].Row["IsGathered"].ToString() == null || dw[i].Row["IsGathered"].ToString() == "") ? "2031" : dw[i].Row["IsGathered"].ToString());

                    if (dw[i].Row["IsNag"].ToString() == "True")
                    {
                        //在此处理导航的升级操作,如果以前版本中存在导航规则,则只是一层导航
                        cNavigRule nRule = new cNavigRule();
                        nRule.Url       = dw[i].Row["Url"].ToString();
                        nRule.Level     = 1;
                        nRule.NavigRule = dw[i].Row["NagRule"].ToString();

                        w.NavigRules.Add(nRule);
                    }
                    else
                    {
                    }

                    t.WebpageLink.Add(w);
                    w = null;
                }
            }

            dw = null;
            dw = new DataView();
            dw = Old_Task.GetData("descendant::GatherRule");
            Task.cWebpageCutFlag c;
            if (dw != null)
            {
                for (i = 0; i < dw.Count; i++)
                {
                    c           = new Task.cWebpageCutFlag();
                    c.Title     = dw[i].Row["Title"].ToString();
                    c.DataType  = int.Parse((dw[i].Row["DataType"].ToString() == null || dw[i].Row["DataType"].ToString() == "") ? "0" : dw[i].Row["DataType"].ToString());
                    c.StartPos  = dw[i].Row["StartFlag"].ToString();
                    c.EndPos    = dw[i].Row["EndFlag"].ToString();
                    c.LimitSign = int.Parse((dw[i].Row["LimitSign"].ToString() == null || dw[i].Row["LimitSign"].ToString() == "") ? "0" : dw[i].Row["LimitSign"].ToString());

                    //处理版本不同时造成的错误,捕获不处理
                    try
                    {
                        c.RegionExpression = dw[i].Row["RegionExpression"].ToString();
                        c.ExportLimit      = int.Parse((dw[i].Row["ExportLimit"].ToString() == null || dw[i].Row["ExportLimit"].ToString() == "") ? "0" : dw[i].Row["ExportLimit"].ToString());
                        c.ExportExpression = dw[i].Row["ExportExpression"].ToString();
                    }
                    catch (System.Exception)
                    {
                    }

                    t.WebpageCutFlag.Add(c);
                    c = null;
                }
            }
            dw = null;

            Old_Task = null;


            //获取此文件的目录传入
            string FilePath = Path.GetDirectoryName(FileName);

            if (IsSystemTask == true)
            {
                t.DeleTask(FilePath, t.TaskName);

                t.Save(FilePath + "\\");
            }
            else
            {
                t.SaveTaskFile(FilePath);
            }
            t = null;
        }