Exemplo n.º 1
0
 /// <summary>
 ///  加载文件
 /// </summary>
 /// Author  : Napoleon
 /// Created : 2015-07-24 15:56:47
 private void LoadImportFiles(string folderPath)
 {
     if (!Directory.Exists(folderPath))
     {
         RchImport.Text = "指定路径不存在!";
         return;
     }
     _beforeFiles.Clear();
     RchImport.Clear();
     String[] filePaths;
     if ((CobFileType.SelectedIndex == 0) || (CobFileType.SelectedIndex == 1))
     {
         filePaths = Directory.GetFiles(folderPath, "*.js", SearchOption.AllDirectories);
         _beforeFiles.AddRange(filePaths);
     }
     if ((CobFileType.SelectedIndex == 0) || (CobFileType.SelectedIndex == 2))
     {
         filePaths = Directory.GetFiles(folderPath, "*.css", SearchOption.AllDirectories);
         _beforeFiles.AddRange(filePaths);
     }
     if (_beforeFiles.Count <= 0)
     {
         RchImport.Text = "指定路径下没有需要处理的文件!";
         return;
     }
     RchExport.Clear();
     foreach (var beforeFile in _beforeFiles)
     {
         RchImport.Text += beforeFile + Environment.NewLine;
     }
     FileTotal.Text = "文件总数:" + _beforeFiles.Count;
 }
Exemplo n.º 2
0
        /// <summary>
        ///  压缩打包
        /// </summary>
        /// Author  : Napoleon
        /// Created : 2015-07-24 16:43:26
        private void BtnCompress_Click(object sender, EventArgs e)
        {
            string yuiPath = Application.StartupPath + @"\yuicompressor.jar";

            if (_beforeFiles.Count <= 0)
            {
                MessageBox.Show("没有文件需要压缩打包!");
                return;
            }
            if (!File.Exists(yuiPath))
            {
                MessageBox.Show("请先下载yuicompressor.jar!");
                return;
            }
            if (!Directory.Exists(TxtExport.Text.Trim()) && !ChkRetain.Checked)
            {
                MessageBox.Show("请选择导出路径!");
                return;
            }
            loading.ShowWaitForm();
            loading.SetWaitFormCaption("正在拼命压缩打包中...");
            RchExport.Clear();
            RchExport.Focus();
            _thread = new Thread(CrossThread);
            _thread.IsBackground = true;
            _thread.Start();
        }
Exemplo n.º 3
0
 /// <summary>
 ///  更新控件内容
 /// </summary>
 /// Author  : Napoleon
 /// Created : 2015-07-25 08:53:48
 private void ThreadFunction(string content)
 {
     if (RchExport.InvokeRequired)
     {
         ThreadWork work = ThreadFunction;
         Invoke(work, new object[] { content });
     }
     else
     {
         RchExport.AppendText(content);
         RchExport.Refresh();
     }
 }