예제 #1
0
        //计划的index文件是固定的,用户不允许进行修改
        //默认位置为:系统根路径\\tasks\\plan

        public void NewIndexFile()
        {
            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<PlanIndex>" +
                            "</PlanIndex>";

            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\plan\\index.xml", strXml);
        }
예제 #2
0
        public void NewIndexFile(string Path)
        {
            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<TaskIndex>" +
                            "</TaskIndex>";

            xmlConfig.NewXmlFile(Path + "\\index.xml", strXml);
        }
예제 #3
0
        public void NewTaskCompleteFile()
        {
            xmlConfig = new cXmlIO();
            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<Tasks>" +
                            "</Tasks>";

            xmlConfig.NewXmlFile(Program.getPrjPath() + "data\\index.xml", strXml);
        }
예제 #4
0
        public void NewTaskRunFile()
        {
            xmlConfig = new cXmlIO();
            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<Tasks>" +
                            "</Tasks>";

            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\taskrun.xml", strXml);
        }
예제 #5
0
파일: cPlans.cs 프로젝트: zhouweiaccp/code
        public void NewIndexFile()
        {
            cXmlIO xmlConfig = new cXmlIO();

            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<Plans>" +
                            "</Plans>";

            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\plan\\plan.xml", strXml);

            xmlConfig = null;
        }
예제 #6
0
        private void NewLogFile()
        {
            cXmlIO xmlConfig = new cXmlIO();

            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                            "<Logs>" +
                            "</Logs>";

            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\plan\\RunLog.xml", strXml);

            xmlConfig = null;
        }
예제 #7
0
        public void NewIndexFile()
        {
            cXmlIO xmlConfig = new cXmlIO();

            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                       "<Plans>" +
                       "</Plans>";
            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\plan\\plan.xml", strXml);

            xmlConfig = null;
        }
예제 #8
0
파일: cTask.cs 프로젝트: zhouweiaccp/code
        //仅根据任务信息保存任务文件,不做其他数据的问题,此方法
        //主要用于支持任务升级使用
        public void SaveTaskFile(string TaskPath)
        {
            //获取需要保存任务的路径
            string tPath = "";

            if (TaskPath == "" || TaskPath == null)
            {
                tPath = GetTaskClassPath() + "\\";
            }
            else
            {
                tPath = TaskPath;
            }
            int i = 0;

            //判断此路径下是否已经存在了此任务,如果存在则返回错误信息
            if (IsExistTaskFile(tPath + this.TaskName))
            {
                throw new cSoukeyException("任务已经存在,不能建立");
            }

            //开始增加Task任务
            //构造Task任务的XML文档格式
            //当前构造xml文件全部采用的拼写字符串的形式,并没有采用xml构造函数
            string tXml;

            tXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                   "<Task>" +
                   "<State></State>" +        ///此状态值当前无效,用于将来扩充使用
                   "<BaseInfo>" +
                   "<Version>1.3</Version>" + //默认当前的任务版本号为:1.2
                   "<ID>" + TaskID + "</ID>" +
                   "<Name>" + this.TaskName + "</Name>" +
                   "<TaskDemo>" + this.TaskDemo + "</TaskDemo>" +
                   "<Class>" + this.TaskClass + "</Class>" +
                   "<Type>" + this.TaskType + "</Type>" +
                   "<RunType>" + this.RunType + "</RunType>" +

                   //选哟转换成相对路径
                   "<SavePath>" + cTool.GetRelativePath(this.SavePath) + "</SavePath>" +
                   "<ThreadCount>" + this.ThreadCount + "</ThreadCount>" +
                   "<UrlCount>" + this.UrlCount + "</UrlCount>" +
                   "<StartPos>" + cTool.ReplaceTrans(this.StartPos) + "</StartPos>" +
                   "<EndPos>" + cTool.ReplaceTrans(this.EndPos) + "</EndPos>" +
                   "<DemoUrl>" + cTool.ReplaceTrans(this.DemoUrl) + "</DemoUrl>" +
                   "<Cookie>" + cTool.ReplaceTrans(this.Cookie) + "</Cookie>" +
                   "<WebCode>" + this.WebCode + "</WebCode>" +
                   "<IsLogin>" + this.IsLogin + "</IsLogin>" +
                   "<LoginUrl>" + this.LoginUrl + "</LoginUrl>" +
                   "<IsUrlEncode>" + this.IsUrlEncode + "</IsUrlEncode>" +
                   "<UrlEncode>" + this.UrlEncode + "</UrlEncode>" +
                   "</BaseInfo>" +
                   "<Result>" +
                   "<ExportType>" + this.ExportType + "</ExportType>" +
                   "<ExportFileName>" + this.ExportFile + "</ExportFileName>" +
                   "<DataSource>" + this.DataSource + "</DataSource>" +
                   "<DataTableName>" + this.DataTableName + "</DataTableName>" +


                   "<InsertSql>" + this.InsertSql + "</InsertSql>" +
                   "<ExportUrl>" + cTool.ReplaceTrans(this.ExportUrl) + "</ExportUrl>" +
                   "<ExportUrlCode>" + this.ExportUrlCode + "</ExportUrlCode>" +
                   "<ExportCookie>" + cTool.ReplaceTrans(this.ExportCookie) + "</ExportCookie>" +
                   "</Result>";

            tXml += "<Advance>" +
                    "<GatherAgainNumber>" + this.GatherAgainNumber + "</GatherAgainNumber>" +
                    "<IsIgnore404>" + this.IsIgnore404 + "</IsIgnore404>" +
                    "<IsErrorLog>" + this.IsErrorLog + "</IsErrorLog>" +
                    "<IsExportHeader>" + this.IsExportHeader + "</IsExportHeader>" +
                    "<IsDelRepeatRow>" + this.IsDelRepRow + "</IsDelRepeatRow>" +
                    "<IsTrigger>" + this.IsTrigger + "</IsTrigger>" +
                    "<TriggerType>" + this.TriggerType + "</TriggerType>" +
                    "</Advance>";

            tXml += "<Trigger>";
            for (i = 0; i < this.m_TriggerTask.Count; i++)
            {
                tXml += "<Task>";
                tXml += "<RunTaskType>" + this.m_TriggerTask[i].RunTaskType + "</RunTaskType>";
                tXml += "<RunTaskName>" + this.m_TriggerTask[i].RunTaskName + "</RunTaskName>";
                tXml += "<RunTaskPara>" + this.m_TriggerTask[i].RunTaskPara + "</RunTaskPara>";
                tXml += "</Task>";
            }
            tXml += "</Trigger>";

            tXml += "<WebLinks>";

            if (this.WebpageLink != null)
            {
                for (i = 0; i < this.WebpageLink.Count; i++)
                {
                    tXml += "<WebLink>";
                    tXml += "<Url>" + cTool.ReplaceTrans(this.WebpageLink[i].Weblink.ToString()) + "</Url>";
                    tXml += "<IsNag>" + this.WebpageLink[i].IsNavigation + "</IsNag>";
                    tXml += "<IsNextPage>" + this.WebpageLink[i].IsNextpage + "</IsNextPage>";
                    tXml += "<NextPageRule>" + cTool.ReplaceTrans(this.WebpageLink[i].NextPageRule) + "</NextPageRule>";

                    //默认插入一个节点,表示此链接地址还未进行采集,因为是系统添加任务,所以默认为UnGather
                    tXml += "<IsGathered>" + (int)cGlobalParas.UrlGatherResult.UnGather + "</IsGathered>";

                    //插入此网址的导航规则
                    if (this.WebpageLink[i].IsNavigation == true)
                    {
                        tXml += "<NavigationRules>";
                        for (int j = 0; j < this.WebpageLink[i].NavigRules.Count; j++)
                        {
                            tXml += "<Rule>";
                            tXml += "<Url>" + cTool.ReplaceTrans(this.WebpageLink[i].NavigRules[j].Url) + "</Url>";
                            tXml += "<Level>" + this.WebpageLink[i].NavigRules[j].Level + "</Level>";
                            tXml += "<NagRule>" + cTool.ReplaceTrans(this.WebpageLink[i].NavigRules[j].NavigRule) + "</NagRule>";
                            tXml += "</Rule>";
                        }
                        tXml += "</NavigationRules>";
                    }
                    tXml += "</WebLink>";
                }
            }

            tXml += "</WebLinks>" +
                    "<GatherRule>";
            if (this.WebpageCutFlag != null)
            {
                for (i = 0; i < this.WebpageCutFlag.Count; i++)
                {
                    tXml += "<Rule>";
                    tXml += "<Title>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].Title) + "</Title>";
                    tXml += "<DataType>" + this.WebpageCutFlag[i].DataType + "</DataType>";
                    tXml += "<StartFlag>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].StartPos) + "</StartFlag>";
                    tXml += "<EndFlag>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].EndPos) + "</EndFlag>";
                    tXml += "<LimitSign>" + this.WebpageCutFlag[i].LimitSign + "</LimitSign>";
                    tXml += "<RegionExpression>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].RegionExpression) + "</RegionExpression>";
                    tXml += "<ExportLimit>" + this.WebpageCutFlag[i].ExportLimit + "</ExportLimit>";
                    tXml += "<ExportExpression>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].ExportExpression) + "</ExportExpression>";
                    tXml += "</Rule>";
                }
            }
            tXml += "</GatherRule>" +
                    "</Task>";

            xmlConfig = new cXmlIO();
            xmlConfig.NewXmlFile(tPath + this.TaskName + ".xml", tXml);
            xmlConfig = null;
        }
예제 #9
0
 public void NewTaskRunFile()
 {
     xmlConfig = new cXmlIO();
     string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
               "<Tasks>" +
               "</Tasks>";
     xmlConfig.NewXmlFile(Program.getPrjPath()  + "tasks\\taskrun.xml", strXml);
 }
예제 #10
0
        //������������Ϣ���������ļ��������������ݵ����⣬�˷���
        //��Ҫ����֧����������ʹ��
        public void SaveTaskFile(string TaskPath)
        {
            //��ȡ��Ҫ���������·��
            string tPath = "";

            if (TaskPath == "" || TaskPath == null)
            {
                tPath = GetTaskClassPath() + "\\";
            }
            else
            {
                tPath = TaskPath;
            }
            int i = 0;

            //�жϴ�·�����Ƿ��Ѿ������˴�������������򷵻ش�����Ϣ
            if (IsExistTaskFile(tPath + this.TaskName))
            {
                throw new cSoukeyException("�����Ѿ����ڣ����ܽ���");
            }

            //��ʼ����Task����
            //����Task�����XML�ĵ���ʽ
            //��ǰ����xml�ļ�ȫ�����õ�ƴд�ַ�������ʽ,��û�в���xml���캯��
            string tXml;
            tXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                "<Task>" +
                "<State></State>" +       ///��״ֵ̬��ǰ��Ч,���ڽ�������ʹ��
                "<BaseInfo>" +
                "<Version>1.3</Version>" +   //Ĭ�ϵ�ǰ������汾��Ϊ��1.2
                "<ID>" + TaskID + "</ID>" +
                "<Name>" + this.TaskName + "</Name>" +
                "<TaskDemo>" + this.TaskDemo + "</TaskDemo>" +
                "<Class>" + this.TaskClass + "</Class>" +
                "<Type>" + this.TaskType + "</Type>" +
                "<RunType>" + this.RunType + "</RunType>" +

                //ѡӴת�������·��
                "<SavePath>" + cTool.GetRelativePath(this.SavePath) + "</SavePath>" +
                "<ThreadCount>" + this.ThreadCount + "</ThreadCount>" +
                "<UrlCount>" + this.UrlCount + "</UrlCount>" +
                "<StartPos>" + cTool.ReplaceTrans(this.StartPos) + "</StartPos>" +
                "<EndPos>" + cTool.ReplaceTrans(this.EndPos) + "</EndPos>" +
                "<DemoUrl>" + cTool.ReplaceTrans(this.DemoUrl) + "</DemoUrl>" +
                "<Cookie>" + cTool.ReplaceTrans(this.Cookie) + "</Cookie>" +
                "<WebCode>" + this.WebCode + "</WebCode>" +
                "<IsLogin>" + this.IsLogin + "</IsLogin>" +
                "<LoginUrl>" + this.LoginUrl + "</LoginUrl>" +
                "<IsUrlEncode>" + this.IsUrlEncode + "</IsUrlEncode>" +
                "<UrlEncode>" + this.UrlEncode + "</UrlEncode>" +
                "</BaseInfo>" +
                "<Result>" +
                "<ExportType>" + this.ExportType + "</ExportType>" +
                "<ExportFileName>" + this.ExportFile + "</ExportFileName>" +
                "<DataSource>" + this.DataSource + "</DataSource>" +
                "<DataTableName>" + this.DataTableName + "</DataTableName>" +

                "<InsertSql>" + this.InsertSql + "</InsertSql>" +
                "<ExportUrl>" + cTool.ReplaceTrans(this.ExportUrl) + "</ExportUrl>" +
                "<ExportUrlCode>" + this.ExportUrlCode + "</ExportUrlCode>" +
                "<ExportCookie>" + cTool.ReplaceTrans(this.ExportCookie) + "</ExportCookie>" +
                "</Result>";

            tXml += "<Advance>" +
                "<GatherAgainNumber>" + this.GatherAgainNumber + "</GatherAgainNumber>" +
                "<IsIgnore404>" + this.IsIgnore404 + "</IsIgnore404>" +
                "<IsErrorLog>" + this.IsErrorLog + "</IsErrorLog>" +
                "<IsExportHeader>" + this.IsExportHeader + "</IsExportHeader>" +
                "<IsDelRepeatRow>" + this.IsDelRepRow + "</IsDelRepeatRow>" +
                "<IsTrigger>" + this.IsTrigger + "</IsTrigger>" +
                "<TriggerType>" + this.TriggerType + "</TriggerType>" +
                "</Advance>";

            tXml += "<Trigger>";
            for (i = 0; i < this.m_TriggerTask.Count; i++)
            {
                tXml += "<Task>";
                tXml += "<RunTaskType>" + this.m_TriggerTask[i].RunTaskType + "</RunTaskType>";
                tXml += "<RunTaskName>" + this.m_TriggerTask[i].RunTaskName + "</RunTaskName>";
                tXml += "<RunTaskPara>" + this.m_TriggerTask[i].RunTaskPara + "</RunTaskPara>";
                tXml += "</Task>";
            }
            tXml += "</Trigger>";

            tXml += "<WebLinks>";

            if (this.WebpageLink != null)
            {
                for (i = 0; i < this.WebpageLink.Count; i++)
                {
                    tXml += "<WebLink>";
                    tXml += "<Url>" + cTool.ReplaceTrans(this.WebpageLink[i].Weblink.ToString()) + "</Url>";
                    tXml += "<IsNag>" + this.WebpageLink[i].IsNavigation + "</IsNag>";
                    tXml += "<IsNextPage>" + this.WebpageLink[i].IsNextpage + "</IsNextPage>";
                    tXml += "<NextPageRule>" + cTool.ReplaceTrans(this.WebpageLink[i].NextPageRule) + "</NextPageRule>";

                    //Ĭ�ϲ���һ���ڵ㣬��ʾ�����ӵ�ַ��δ���вɼ�����Ϊ��ϵͳ�����������Ĭ��ΪUnGather
                    tXml += "<IsGathered>" + (int)cGlobalParas.UrlGatherResult.UnGather + "</IsGathered>";

                    //�������ַ�ĵ�������
                    if (this.WebpageLink[i].IsNavigation == true)
                    {
                        tXml += "<NavigationRules>";
                        for (int j = 0; j < this.WebpageLink[i].NavigRules.Count; j++)
                        {
                            tXml += "<Rule>";
                            tXml += "<Url>" + cTool.ReplaceTrans(this.WebpageLink[i].NavigRules[j].Url) + "</Url>";
                            tXml += "<Level>" + this.WebpageLink[i].NavigRules[j].Level + "</Level>";
                            tXml += "<NagRule>" + cTool.ReplaceTrans(this.WebpageLink[i].NavigRules[j].NavigRule) + "</NagRule>";
                            tXml += "</Rule>";
                        }
                        tXml += "</NavigationRules>";
                    }
                    tXml += "</WebLink>";
                }
            }

            tXml += "</WebLinks>" +
                "<GatherRule>";
            if (this.WebpageCutFlag != null)
            {
                for (i = 0; i < this.WebpageCutFlag.Count; i++)
                {
                    tXml += "<Rule>";
                    tXml += "<Title>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].Title) + "</Title>";
                    tXml += "<DataType>" + this.WebpageCutFlag[i].DataType + "</DataType>";
                    tXml += "<StartFlag>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].StartPos) + "</StartFlag>";
                    tXml += "<EndFlag>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].EndPos) + "</EndFlag>";
                    tXml += "<LimitSign>" + this.WebpageCutFlag[i].LimitSign + "</LimitSign>";
                    tXml += "<RegionExpression>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].RegionExpression) + "</RegionExpression>";
                    tXml += "<ExportLimit>" + this.WebpageCutFlag[i].ExportLimit + "</ExportLimit>";
                    tXml += "<ExportExpression>" + cTool.ReplaceTrans(this.WebpageCutFlag[i].ExportExpression) + "</ExportExpression>";
                    tXml += "</Rule>";
                }
            }
            tXml += "</GatherRule>" +
               "</Task>";

            xmlConfig = new cXmlIO();
            xmlConfig.NewXmlFile(tPath + this.TaskName + ".xml", tXml);
            xmlConfig = null;
        }
 public void NewTaskCompleteFile()
 {
     xmlConfig = new cXmlIO();
     string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
               "<Tasks>" +
               "</Tasks>";
     xmlConfig.NewXmlFile(Program.getPrjPath()  + "data\\index.xml", strXml);
 }
예제 #12
0
        private void NewLogFile()
        {
            cXmlIO xmlConfig = new cXmlIO();

            string strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                       "<Logs>" +
                       "</Logs>";
            xmlConfig.NewXmlFile(Program.getPrjPath() + "tasks\\plan\\RunLog.xml", strXml);

            xmlConfig = null;
        }