Beispiel #1
0
        private void btn_parse_Click(object sender, EventArgs e)
        {
            btn_parse.Enabled = false;
            ClearLog();
            if (true == cbx_parseXml.Checked)
            {
                try
                {
                    Process proc = new Process
                    {
                        StartInfo = new ProcessStartInfo
                        {
                            FileName               = tbx_parseFile.Text,
                            Arguments              = "",
                            UseShellExecute        = false,
                            RedirectStandardOutput = true,
                            RedirectStandardError  = true,
                            CreateNoWindow         = true
                        }
                    };
                    proc.OutputDataReceived += new DataReceivedEventHandler(MyLogger.WriteOutput);
                    proc.ErrorDataReceived  += new DataReceivedEventHandler(MyLogger.WriteError);
                    proc.Start();
                    proc.BeginErrorReadLine();
                    proc.BeginOutputReadLine();
                    proc.WaitForExit();
                }
                catch (Exception ex)
                {
                    MyLogger.Alert(ex.Message + Environment.NewLine);
                }
            }
            string rootdir   = Directory.GetCurrentDirectory();
            string fileWrite = "";

            try
            {
                DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
                foreach (DirectoryInfo D1 in DI)
                {
                    //rtb_information.Text += "Directory:" + D1.Name + Environment.NewLine;
                    DescriptionBuilder builder = new DescriptionBuilder(D1, cbx_doBackup.Checked);
                    fileWrite = builder.ParseScriptFiles();
                    //rtb_information.Text += builder.GetText();
                }
            }
            catch (DirectoryNotFoundException dEX)
            {
                MyLogger.Alert("Directory Not Found " + dEX.Message + Environment.NewLine);
            }
            catch (Exception ex)
            {
                MyLogger.Alert(ex.Message + Environment.NewLine);
            }
            if (true == cbx_doBackup.Checked)
            {
                btn_clear.Enabled = FileExistsRecursive(Directory.GetCurrentDirectory(), "*.old");
            }
            else
            {
                DirectoryInfo[] DI        = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
                Delete          delObject = new Delete(DI);
                delObject.ClearFiles();
            }
            btn_parse.Enabled = true;
        }
Beispiel #2
0
 private void btn_parse_Click(object sender, EventArgs e)
 {
     btn_parse.Enabled = false;
     ClearLog();
     if (true == cbx_parseXml.Checked)
     {
         try
         {
             Process proc = new Process
             {
                 StartInfo = new ProcessStartInfo
                 {
                     FileName = tbx_parseFile.Text,
                     Arguments = "",
                     UseShellExecute = false,
                     RedirectStandardOutput = true,
                     RedirectStandardError = true,
                     CreateNoWindow = true
                 }
             };
             proc.OutputDataReceived += new DataReceivedEventHandler(MyLogger.WriteOutput);
             proc.ErrorDataReceived += new DataReceivedEventHandler(MyLogger.WriteError);
             proc.Start();
             proc.BeginErrorReadLine();
             proc.BeginOutputReadLine();
             proc.WaitForExit();
         }
         catch (Exception ex)
         {
             MyLogger.Alert(ex.Message + Environment.NewLine);
         }
     }
     string rootdir = Directory.GetCurrentDirectory();
     string fileWrite = "";
     try
     {
         DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
         foreach (DirectoryInfo D1 in DI)
         {
             //rtb_information.Text += "Directory:" + D1.Name + Environment.NewLine;
             DescriptionBuilder builder = new DescriptionBuilder(D1, cbx_doBackup.Checked);
             fileWrite = builder.ParseScriptFiles();
             //rtb_information.Text += builder.GetText();
         }
     }
     catch (DirectoryNotFoundException dEX)
     {
         MyLogger.Alert("Directory Not Found " + dEX.Message + Environment.NewLine);
     }
     catch (Exception ex)
     {
         MyLogger.Alert(ex.Message + Environment.NewLine);
     }
     if (true == cbx_doBackup.Checked)
     {
         btn_clear.Enabled = FileExistsRecursive(Directory.GetCurrentDirectory(), "*.old");
     }
     else
     {
         DirectoryInfo[] DI = new DirectoryInfo(rootdir).GetDirectories("*.*", SearchOption.AllDirectories);
         Delete delObject = new Delete(DI);
         delObject.ClearFiles();
     }
     btn_parse.Enabled = true;
 }