예제 #1
0
        public static void FormatFile(string fileName)
        {
            if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
                return;

            string extension = Path.GetExtension(fileName);
            if (extension == ".xml")
            {
                FormatFile(fileName);
            }
            else
            {
                ProcessBackground pbg = new SyncProcessBackground(Path.Combine(Application.StartupPath, @"Addins\AStyle.exe"));
                string args = string.Format("--style=allman -N -Y {0}", fileName);
                pbg.ExecuteCommand(args);
            }
        }
예제 #2
0
        public void Run()
        {
            try
            {
                Complier();

                if (File.Exists(this.ComplierResultFileName))
                {
                    ShowMessage("运行中......");
                    string exeToolPath = string.IsNullOrEmpty(this.ExecuteToolPath) ? this.ComplierResultFileName : this.ExecuteToolPath;
                    string args = this.GetRunArguments();
                    ShowMessage(string.Format(processInfoFormat, exeToolPath, args));

                    ProcessBackground pbg = null;
                    if (this.Async)
                    {
                        pbg = new AsyncProcessBackground(exeToolPath);
                    }
                    else
                    {
                        pbg = new SyncProcessBackground(exeToolPath);
                    }
                    pbg.MsgReceivedEvent = this.ShowMessage;
                    //pbg.ShowOutputData = true;
                    //pbg.ShowErrorData = true;

                    pbg.ExecuteCommand(args);
                    ShowMessage("运行结束。");
                    if (this.Async)
                        Thread.Sleep(2000);
                }

            }
            catch (Exception ex)
            {
                ShowMessage(ex.ToString());
            }
        }
예제 #3
0
 public string IL()
 {
     try
     {
         Complier();
         if (File.Exists(this.ComplierResultFileName))
         {
             ShowMessage("中间语言生成中......");
             string args = this.GetILArguments();
             ShowMessage(string.Format(processInfoFormat, this.ILDeComplieToolPath, args));
             //ProcessBackground pbg = new ProcessBackground(@"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\ildasm.exe");
             //ProcessBackground pbg = new ProcessBackground(@"d:\test\ildasm.exe");
             ProcessBackground pbg = null;
             if (this.Async)
             {
                 pbg = new AsyncProcessBackground(this.ILDeComplieToolPath);
             }
             else
             {
                 pbg = new SyncProcessBackground(this.ILDeComplieToolPath);
             }
             pbg.MsgReceivedEvent = this.ShowMessage;
             //pbg.ShowOutputData = true;
             pbg.ExecuteCommand(args);
             if (this.Async)
                 Thread.Sleep(2000);
             ShowMessage("中间语言生成结束。");
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.ToString());
     }
     return ILFileName;
 }
예제 #4
0
        public string Complier()
        {
            try
            {
                ShowMessage("编译中......");
                string args = this.GetComplieArguments();
                ShowMessage(string.Format(processInfoFormat, ComplieToolPath, args));
                if (File.Exists(this.ComplierResultFileName))
                {
                    File.Delete(this.ComplierResultFileName);
                }
                ProcessBackground pbg = null;
                if (this.Async)
                {
                    pbg = new AsyncProcessBackground(ComplieToolPath);
                }
                else
                {
                    pbg = new SyncProcessBackground(ComplieToolPath);
                }
                pbg.MsgReceivedEvent = this.ShowMessage;
                //pbg.ShowErrorData = true;
                //pbg.ShowOutputData = true;
                pbg.ExecuteCommand(args);
                ShowMessage("编译结束。");

                if (this.Async)
                    Thread.Sleep(2000);
            }
            catch (Exception ex)
            {
                ShowMessage(ex.ToString());
            }
            return ComplierResultFileName;
        }