示例#1
0
 public void StartBatch(string path, string searchOption)
 {
     _argMode = InputArg.ParseXml(path);
     if (_argMode == null)
     {
         Console.WriteLine("请提供参数文件");
         return;
     }
     else
     {
         //判断InputFilename参数值是否为文件列表
         string[] fileList = _argMode.InputFilename.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         if (fileList.Length > 1)
         {
             foreach (string file in fileList)
             {
                 if (!File.Exists(file))
                 {
                     Console.WriteLine("文件" + file + "不存在!");
                     return;
                 }
             }
             _isFileList = true;
             _fileList   = fileList;
         }
         else
         {
             Match match = InputFileRex.Match(_argMode.InputFilename);
             if (match.Groups["dir"].Success)
             {
                 _path = match.Groups["dir"].Value;
             }
             if (match.Groups["filter"].Success)
             {
                 _searchOption = match.Groups["filter"].Value;
             }
             if (string.IsNullOrWhiteSpace(_path) || !Directory.Exists(_path))
             {
                 Console.WriteLine("要扫描的文件路径为空,或者该路径不存在" + _path);
                 return;
             }
             PrintInfo("启动扫描路径" + _path);
             if (!string.IsNullOrWhiteSpace(_searchOption))
             {
                 PrintInfo(" 文件过滤为" + _searchOption);
             }
         }
     }
     _timer          = new Timer(5 * 1000);
     _timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
     _timer.Start();
     _processTimer          = new Timer(5 * 1000);
     _processTimer.Elapsed += new ElapsedEventHandler(StartProcess);
     _processTimer.Start();
 }
示例#2
0
        void frmArgumentSetting_Load(object sender, EventArgs e)
        {
            _envList = new List <PrjEnvelopeItem>();
            InputArg arg = InputArg.ParseXml(_path);

            if (arg != null)
            {
                InitSetting(arg);
            }
            cmbProjectID.SelectedIndex = 0;
        }