コード例 #1
0
ファイル: JFormat.cs プロジェクト: piaolingzxh/Justin
        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
ファイル: CodeComplier.cs プロジェクト: piaolingzxh/Justin
        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
ファイル: CodeComplier.cs プロジェクト: piaolingzxh/Justin
 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
ファイル: CodeComplier.cs プロジェクト: piaolingzxh/Justin
        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;
        }