当前位置: 首页>>代码示例>>C#>>正文


C# Process.Dispose方法代码示例

本文整理汇总了C#中Process.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Process.Dispose方法的具体用法?C# Process.Dispose怎么用?C# Process.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Process的用法示例。


在下文中一共展示了Process.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyShader

    static bool ApplyShader(string test_name, string shader, string input, string result, string extra)
    {
        Process applyShader = new Process ();
        applyShader.StartInfo.FileName = "mono";
        applyShader.StartInfo.UseShellExecute = false;
        applyShader.StartInfo.Arguments = string.Format ("../src/shader.exe {0} {1} {2} {3}", extra, shader, input, result);
        applyShader.StartInfo.RedirectStandardError = true;
        applyShader.StartInfo.RedirectStandardOutput = true;

        var stdout = new StringBuilder ();
        var stderr = new StringBuilder ();
        applyShader.OutputDataReceived += (s, e) => { if (e.Data.Trim ().Length > 0) stdout.Append("\t").Append (e.Data).Append ("\n"); };
        applyShader.ErrorDataReceived += (s, e) => { if (e.Data.Trim ().Length > 0) stderr.Append("\t").Append (e.Data).Append ("\n"); };

        applyShader.Start ();
        applyShader.BeginOutputReadLine ();
        applyShader.BeginErrorReadLine ();

        applyShader.WaitForExit ();
        var exitCode = applyShader.ExitCode;
        applyShader.Dispose ();
        if (exitCode != 0)
            errorList.Add (String.Format ("Test {0} failed with:\n{1}{2}", test_name, stdout, stderr));
        return exitCode == 0;
    }
开发者ID:kumpera,项目名称:PixelMagic,代码行数:25,代码来源:TestRunner.cs

示例2: Main

 public static void Main( string[] args ){
     string arg = "";
     foreach( string s in args ){
         arg += "\"" + s + "\" ";
     }
     string exe = Environment.GetCommandLineArgs()[0];
     string exe_name = Path.GetFileNameWithoutExtension( exe );
     string path = Application.StartupPath;
     if( exe_name == "resampler" && args.Length >= 12 ){
         string outpath = args[1];
         string out_name = Path.GetFileNameWithoutExtension( outpath );
         string out_dir = Path.GetDirectoryName( outpath );
         string logname = Path.Combine( out_dir, out_name + ".log" );
         using( StreamWriter sw = new StreamWriter( logname ) ){
             const int PBTYPE = 5;
             int indx_q = args[11].IndexOf( "Q" );
             int count = 0;
             if( indx_q > 0 ){
                 string pit = args[11].Substring( 0, indx_q );
                 if( args[11].Length >= indx_q + 1 ){
                     string tempo = args[11].Substring( indx_q + 1 );
                     sw.WriteLine( "# " + tempo );
                 }
                 sw.WriteLine( (count * PBTYPE) + "\t" + pit );
                 count++;
             }
             for( int i = 12; i < args.Length; i++ ){
                 sw.WriteLine( (count * PBTYPE) + "\t" + args[i] );
                 count++;
             }
         }
     }
     using( StreamWriter sw = new StreamWriter( Path.Combine( path, exe_name + ".log" ), true ) ){
         sw.WriteLine( arg );
         Process p = null;
         try{
             p = new Process();
             ProcessStartInfo psi = new ProcessStartInfo();
             psi.FileName = Path.Combine( path, "_" + exe_name + ".exe" );
             psi.Arguments = arg;
             psi.CreateNoWindow = true;
             psi.UseShellExecute = false;
             psi.UseShellExecute = false;
             p.StartInfo = psi;
             p.Start();
             p.WaitForExit();
         }catch( Exception ex ){
             sw.WriteLine( "Resampler.Main(string[]); ex=" + ex );
         }finally{
             if( p != null ){
                 try{
                     p.Dispose();
                 }catch{
                 }
             }
         }
     }
 }
开发者ID:kixtarte,项目名称:cadencii,代码行数:58,代码来源:resampler.cs

示例3: RunProcess

    public Task<int> RunProcess(string fileName, string arguments, Action<string> outputAction, Action<string> errorAction)
    {
        LogTo.Information(string.Format("Executing process: {0} {1}", fileName, arguments));
        var tcs = new TaskCompletionSource<int>();

        var process = new Process
        {
            StartInfo =
            {
                FileName = fileName,
                Arguments = arguments,
                CreateNoWindow = true,
                UseShellExecute = false,
                WindowStyle = ProcessWindowStyle.Hidden,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
            },
            EnableRaisingEvents = true,
        };
        process.OutputDataReceived += (sender, args) =>
        {
            if (args.Data != null)
            {
                LogTo.Information(args.Data);
                outputAction(args.Data);
            }
        };
        process.ErrorDataReceived += (sender, args) =>
        {
            if (args.Data != null)
            {
                LogTo.Error(args.Data);
                errorAction(args.Data);
            }
        };
        process.Exited += (sender, args) =>
        {
            tcs.SetResult(process.ExitCode);
            //TODO: result
            process.Dispose();
        };

        process.Start();
        process.BeginErrorReadLine();
        process.BeginOutputReadLine();

        return tcs.Task;
    }
开发者ID:nagyist,项目名称:PlatformInstaller,代码行数:48,代码来源:ProcessRunner.cs

示例4: ScanFile

    /*
     * the true ClamAV link
     * this will load clamdscan and wait for the result
     */
    private void ScanFile()
    {
        string output = null;
        try
        {
            Working = true;
            Process ClamScan = new Process();
            ClamScan.StartInfo.FileName = virtualPath + "clamscan.exe";
            //ClamScan.StartInfo.Arguments = "--no-summary --move=" + (char)(34) + virtualPath + "quarantene" + (char)(34) + " " + (char)(34) + FileScan + (char)(34);
            ClamScan.StartInfo.Arguments = " -r " + FileScan + " -d " +database;
            ClamScan.StartInfo.CreateNoWindow = true;
            ClamScan.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            ClamScan.StartInfo.RedirectStandardOutput = true;
            ClamScan.StartInfo.UseShellExecute = false;
            ClamScan.EnableRaisingEvents = true;
            ClamScan.Start();
            ClamScan.WaitForExit();
            output = ClamScan.StandardOutput.ReadLine();
            //output = ClamScan.StandardOutput.ReadToEnd();
            //Console.WriteLine(" -r "+FileScan+" -d "+database+"hi"+output.ToString());
            Console.WriteLine("output:"+output);
            new insertIntoDatabase("output:" + output);
            while (!ClamScan.HasExited)
            {
                Console.WriteLine("Waiting for thread close");
            }
            ClamScan.Close();
            ClamScan.Dispose();
        }
        catch (Exception ex)
        {
            Console.WriteLine("ERROR: " + ex.Message);
        }
        Working = false;
        if (output != null && output.Length > 0 && !output.EndsWith(": OK") && !output.EndsWith("ERROR") && output.Contains("FOUND"))
        {
            Console.WriteLine(output.EndsWith(":OK").ToString());
            //ThreadHub.VirusFound(output);
        }

        //ThreadHub.EndScanThread(FileScan);
    }
开发者ID:raynaya,项目名称:cloudarchitecture,代码行数:46,代码来源:ScanThread.cs

示例5: Ejecutar

 public string Ejecutar(bool Redireccionar)
 {
     string Res;
     Process Pro;
     Res = "";
     Pro = new Process ();
     Pro.StartInfo.FileName = FNombre;
     Pro.StartInfo.Arguments = FParametros;
     if (Redireccionar) {
         Pro.StartInfo.RedirectStandardInput = true;
         Pro.StartInfo.RedirectStandardOutput = true;
         Pro.StartInfo.UseShellExecute = false;
         Pro.StartInfo.CreateNoWindow = true;
     }
     Pro.Start ();
     if (Redireccionar) {
         Pro.WaitForExit ();
         Res = Pro.StandardOutput.ReadToEnd ();
     }
     Pro.Close ();
     Pro.Dispose ();
     return Res;
 }
开发者ID:ivajo26,项目名称:EjerciciosCSharp,代码行数:23,代码来源:TProceso.cs

示例6: Update

    void Update()
    {
        Repaint();

        if (!string.IsNullOrEmpty(m_nextScene))
        {
            EditorApplication.OpenScene(m_nextScene);
            m_nextScene = string.Empty;
            return;
        }

        var scenes = EditorBuildSettings.scenes;
        var sceneList = new List<string>();

        foreach (var scene in scenes)
        {
            if (scene.enabled)
                sceneList.Add(scene.path);
        }

        var sceneArray = sceneList.ToArray();

        if (m_toggleSyncBundleID)
        {
            m_toggleSyncBundleID = false;

            SyncBundleID();

            AssetDatabase.Refresh();
        }

        if (m_toggleCompileNDK)
        {
            m_toggleCompileNDK = false;

            CompileNDK();

            AssetDatabase.Refresh();
        }

        if (m_toggleCompilePlugin)
        {
            m_toggleCompilePlugin = false;

            OuyaMenuAdmin.MenuGeneratePluginJar();

            AssetDatabase.Refresh();
        }

        if (m_toggleCompileJava)
        {
            m_toggleCompileJava = false;

            if (CompileApplicationJava())
            {
                AssetDatabase.Refresh();
            }
        }

        if (m_toggleRunApplication)
        {
            m_toggleRunApplication = false;

            string appPath = string.Format("{0}/{1}", pathUnityProject, apkName);
            if (File.Exists(appPath))
            {
                //Debug.Log(appPath);
                //Debug.Log(pathADB);
                string args = string.Format("shell am start -n {0}/.{1}", PlayerSettings.bundleIdentifier, javaAppName);
                //Debug.Log(args);
                ProcessStartInfo ps = new ProcessStartInfo(pathADB, args);
                Process p = new Process();
                p.StartInfo = ps;
                p.Exited += (object sender, EventArgs e) =>
                                {
                                    p.Dispose();
                                };
                p.Start();
            }
        }

        if (m_toggleBuildApplication)
        {
            m_toggleBuildApplication = false;

            if (GenerateRJava())
            {
                if (CompileApplicationClasses())
                {
                    if (BuildApplicationJar())
                    {
                        AssetDatabase.Refresh();

                        BuildPipeline.BuildPlayer(sceneArray, string.Format("{0}/{1}", pathUnityProject, apkName),
                                                  BuildTarget.Android, BuildOptions.None);
                    }
                }
            }
        }

//.........这里部分代码省略.........
开发者ID:newfaceryo,项目名称:ouya-unity-plugin,代码行数:101,代码来源:OuyaPanel.cs

示例7: SetLanguage

    private void SetLanguage()
    {
        if (File.Exists(pathADB))
        {
            //Debug.Log(appPath);
            //Debug.Log(pathADB);
            string args = "shell";
            //Debug.Log(args);
            ProcessStartInfo ps = new ProcessStartInfo(pathADB, args);
            Process p = new Process();
            ps.RedirectStandardOutput = false;
            ps.RedirectStandardInput = true;
            ps.UseShellExecute = false;
            ps.CreateNoWindow = false;
            ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
            p.StartInfo = ps;
            p.Exited += (object sender, EventArgs e) =>
            {
                p.Dispose();
            };
            p.Start();

            p.StandardInput.AutoFlush = true;
            p.StandardInput.WriteLine("su");
            p.StandardInput.WriteLine("setprop persist.sys.language {0}; setprop persist.sys.country {1}; stop; sleep 1; start;",
                GetPropertySystemLanguage(),
                GetPropertySystemCountry());
            p.StandardInput.WriteLine("exit");
            p.StandardInput.WriteLine("exit");
            p.WaitForExit(1);
            p.Close();

            Thread.Sleep(1000);
        }
    }
开发者ID:newfaceryo,项目名称:ouya-unity-plugin,代码行数:35,代码来源:OuyaPanel.cs

示例8: Reboot

 private void Reboot()
 {
     if (File.Exists(pathADB))
     {
         //Debug.Log(appPath);
         //Debug.Log(pathADB);
         string args = string.Format(@"reboot");
         //Debug.Log(args);
         ProcessStartInfo ps = new ProcessStartInfo(pathADB, args);
         Process p = new Process();
         ps.RedirectStandardOutput = false;
         ps.UseShellExecute = true;
         ps.CreateNoWindow = false;
         ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
         p.StartInfo = ps;
         p.Exited += (object sender, EventArgs e) =>
         {
             p.Dispose();
         };
         p.Start();
         //p.WaitForExit();
     }
 }
开发者ID:newfaceryo,项目名称:ouya-unity-plugin,代码行数:23,代码来源:OuyaPanel.cs

示例9: OnGUI


//.........这里部分代码省略.........
                {
                    ResetAndroidSDKPaths();
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button("Download Android SDK"))
                {
                    Application.OpenURL("http://developer.android.com/sdk/index.html");
                }

                if (GUILayout.Button("Open Android SDK"))
                {
                    m_toggleOpenAndroidSDK = true;
                }

                if (GUILayout.Button("Open Shell"))
                {
                    string shellPath = @"c:\windows\system32\cmd.exe";
                    if (File.Exists(shellPath))
                    {
                        //Debug.Log(appPath);
                        //Debug.Log(pathADB);
                        string args = string.Format(@"/k");
                        //Debug.Log(args);
                        ProcessStartInfo ps = new ProcessStartInfo(shellPath, args);
                        Process p = new Process();
                        ps.RedirectStandardOutput = false;
                        ps.UseShellExecute = true;
                        ps.CreateNoWindow = false;
                        ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
                        p.StartInfo = ps;
                        p.Exited += (object sender, EventArgs e) =>
                                        {
                                            p.Dispose();
                                        };
                        p.Start();
                    }
                    EditorGUIUtility.ExitGUI();
                }

                if (GUILayout.Button("Advanced Settings"))
                {
                    ThreadStart ts = new ThreadStart(() =>
                    {
                        if (File.Exists(pathADB))
                        {
                            //Debug.Log(appPath);
                            //Debug.Log(pathADB);
                            string args =
                                string.Format(
                                    @"shell su -c am start com.android.settings");
                            //Debug.Log(args);
                            ProcessStartInfo ps = new ProcessStartInfo(pathADB,
                                                                       args);
                            Process p = new Process();
                            ps.RedirectStandardOutput = false;
                            ps.UseShellExecute = true;
                            ps.CreateNoWindow = false;
                            ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
                            p.StartInfo = ps;
                            p.Exited += (object sender, EventArgs e) =>
                            {
                                p.Dispose();
                            };
                            p.Start();
开发者ID:newfaceryo,项目名称:ouya-unity-plugin,代码行数:66,代码来源:OuyaPanel.cs

示例10: iDetector

	public void iDetector()
	{
		SaveToDisk("s-irecovery.exe", "s-irecovery.exe");
		//Were going to detect the iDevice now! :)
		try {
			idetect.Text = string.Empty;
			Process p = new Process();
			p.StartInfo.FileName = "s-irecovery.exe";
			p.StartInfo.Arguments = "-detect";
			p.StartInfo.UseShellExecute = false;
			p.StartInfo.CreateNoWindow = true;
			p.StartInfo.RedirectStandardOutput = true;
			p.StartInfo.RedirectStandardInput = true;
			p.StartInfo.RedirectStandardError = true;
			p.OutputDataReceived += update_1;
			p.Start();
			System.IO.StreamWriter SW = p.StandardInput;
			p.BeginOutputReadLine();
			p.Dispose();
			Delay(2);
			if (atv2mode == true & idetect.Text.Contains("k66ap") == true) {
			//No Problem :)
			} else if (atv2mode == false & idetect.Text.Contains("k66ap") == true) {
				Interaction.MsgBox("Apple TV 2 was detected! " + Strings.Chr(13) + Strings.Chr(13) + " Next time, Select Apple TV 2! ABORTING...", MsgBoxStyle.Critical);
				Application.Exit();
			} else if (atv2mode == false) {
			// Do Nothing.
			} else {
				Interaction.MsgBox("A DEVICE OTHER THAN THE Apple TV 2 WAS DETECTED!" + Strings.Chr(13) + Strings.Chr(13) + "ABORTING...", MsgBoxStyle.Critical);
				Application.Exit();
			}
			if (idetect.Text.Contains("n88ap") == true) {
				iDevice = "iPhone 3GS";
				board = "n88ap";
			} else if (idetect.Text.Contains("n72ap") == true) {
				iDevice = "iPod Touch 2G";
				board = "n72ap";
			} else if (idetect.Text.Contains("n18ap") == true) {
				iDevice = "iPod Touch 3G";
				board = "n18ap";
			} else if (idetect.Text.Contains("n81ap") == true) {
				iDevice = "iPod Touch 4";
				board = "n81ap";
			} else if (idetect.Text.Contains("n90ap") == true) {
				iDevice = "iPhone 4";
				board = "n90ap";
			} else if (idetect.Text.Contains("n92ap") == true) {
				iDevice = "iPhone 4";
				board = "n92ap";
			} else if (idetect.Text.Contains("k48ap") == true) {
				iDevice = "iPad 1";
				board = "k48ap";
			} else if (idetect.Text.Contains("k66ap") == true) {
				iDevice = "Apple TV 2";
				board = "k66ap";
			} else {
				Interaction.MsgBox("UNSUPPORTED DEVICE!" + Strings.Chr(13) + Strings.Chr(13) + "ABORTING...", MsgBoxStyle.Critical);
				Application.Exit();
			}
		} catch (ManagementException err) {
		}
	}
开发者ID:bobbytdotcom,项目名称:iFaith,代码行数:62,代码来源:DFU.cs

示例11: OnGUI


//.........这里部分代码省略.........
                {
                    ResetAndroidSDKPaths();
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button("Download Android SDK"))
                {
                    Application.OpenURL("http://developer.android.com/sdk/index.html");
                }

                if (GUILayout.Button("Open Android SDK"))
                {
                    m_toggleOpenAndroidSDK = true;
                }

                if (GUILayout.Button("Open Shell"))
                {
                    string shellPath = @"c:\windows\system32\cmd.exe";
                    if (File.Exists(shellPath))
                    {
                        //Debug.Log(appPath);
                        //Debug.Log(pathADB);
                        string args = string.Format(@"/k");
                        //Debug.Log(args);
                        ProcessStartInfo ps = new ProcessStartInfo(shellPath, args);
                        Process p = new Process();
                        ps.RedirectStandardOutput = false;
                        ps.UseShellExecute = true;
                        ps.CreateNoWindow = false;
                        ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
                        p.StartInfo = ps;
                        p.Exited += (object sender, EventArgs e) =>
                                        {
                                            p.Dispose();
                                        };
                        p.Start();
                    }
                    EditorGUIUtility.ExitGUI();
                }

                if (GUILayout.Button("Take Screenshot"))
                {
                    ThreadStart ts = new ThreadStart(() =>
                                                         {
                                                             if (File.Exists(pathADB))
                                                             {
                                                                 //Debug.Log(appPath);
                                                                 //Debug.Log(pathADB);
                                                                 string args =
                                                                     string.Format(
                                                                         @"shell /system/bin/screencap -p /sdcard/screenshot.png");
                                                                 //Debug.Log(args);
                                                                 ProcessStartInfo ps = new ProcessStartInfo(pathADB,
                                                                                                            args);
                                                                 Process p = new Process();
                                                                 ps.RedirectStandardOutput = false;
                                                                 ps.UseShellExecute = true;
                                                                 ps.CreateNoWindow = false;
                                                                 ps.WorkingDirectory = Path.GetDirectoryName(pathADB);
                                                                 p.StartInfo = ps;
                                                                 p.Exited += (object sender, EventArgs e) =>
                                                                                 {
                                                                                     p.Dispose();
                                                                                 };
                                                                 p.Start();
开发者ID:rendermat,项目名称:ouya-unity-plugin,代码行数:66,代码来源:OuyaPanel.cs

示例12: GetVideoDuration

		//获取视频长度
		public static TimeSpan GetVideoDuration(string filePath, string ffmpegExePath)
		{
			try
			{
				string output = "";
				if (File.Exists(ffmpegExePath))
				{
					//视频长度
					Process p = new Process();//建立外部调用线程
					p.StartInfo.FileName = ffmpegExePath;
					p.StartInfo.Arguments = string.Format(@"-i ""{0}""", filePath);
					p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动线程
					p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中
					p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
					p.StartInfo.CreateNoWindow = true;//不创建进程窗口
					p.Start();//启动线程
					p.WaitForExit(2500);//等待完成
					output = p.StandardError.ReadToEnd();//开始同步读取
					p.Close();//关闭进程
					p.Dispose();//释放资源
				}
				var reg = new Regex(@"Duration: (?<h>\d+):(?<m>\d+):(?<s>\d+)\.(?<ms>\d+)");
				var match = reg.Match(output);

				if (!match.Success)
				{
					var info = Read(filePath);
					return info.Time;
				}
				else
				{
					return new TimeSpan(0, int.Parse(match.Groups["h"].Value),
						int.Parse(match.Groups["m"].Value),
						int.Parse(match.Groups["s"].Value),
						int.Parse(match.Groups["ms"].Value));
				}
			}
			catch
			{
				return new TimeSpan(0, 0, 1);
			}
		}
开发者ID:kwedr,项目名称:acdown,代码行数:43,代码来源:FlvHelper.cs

示例13: Update

    void Update()
    {
        Repaint();

        if (!string.IsNullOrEmpty(m_nextScene))
        {
            EditorApplication.OpenScene(m_nextScene);
            m_nextScene = string.Empty;
            return;
        }

        var scenes = EditorBuildSettings.scenes;
        var sceneList = new List<string>();

        foreach (var scene in scenes)
        {
            if (scene.enabled)
                sceneList.Add(scene.path);
        }

        var sceneArray = sceneList.ToArray();

        if (m_toggleCompileNDK)
        {
            m_toggleCompileNDK = false;

            CompileNDK();

            AssetDatabase.Refresh();
        }

        if (m_toggleCompilePlugin)
        {
            m_toggleCompilePlugin = false;

            if (GenerateRJava())
            {
                OuyaMenuAdmin.MenuGeneratePluginJar();
            }

            // Remove folder
            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo("Assets/Plugins/Android/Classes");
                if (directoryInfo.Exists)
                {
                    directoryInfo.Delete(true);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }

            // Remove folder
            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo("Assets/Plugins/Android/OuyaUnityPlugin");
                if (directoryInfo.Exists)
                {
                    directoryInfo.Delete(true);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }

            AssetDatabase.Refresh();
        }

        if (m_toggleRunApplication)
        {
            m_toggleRunApplication = false;

            string appPath = string.Format("{0}/{1}", pathUnityProject, apkName);
            if (File.Exists(appPath))
            {
                //Debug.Log(appPath);
                //Debug.Log(pathADB);
                string args = string.Format("shell am start -n {0}/tv.ouya.sdk.MainActivity", PlayerSettings.bundleIdentifier);
                //Debug.Log(args);
                ProcessStartInfo ps = new ProcessStartInfo(pathADB, args);
                Process p = new Process();
                p.StartInfo = ps;
                p.Exited += (object sender, EventArgs e) =>
                                {
                                    p.Dispose();
                                };
                p.Start();
            }
        }

        if (m_toggleStopApplication)
        {
            m_toggleStopApplication = false;

            string appPath = string.Format("{0}/{1}", pathUnityProject, apkName);
            if (File.Exists(appPath))
            {
//.........这里部分代码省略.........
开发者ID:thoniorf,项目名称:ouya-sdk-examples,代码行数:101,代码来源:OuyaPanel.cs

示例14: getPathDialog

    /// <summary>
    /// getPathDialogメソッド (コルーチン実行)
    /// </summary>
    /// <param name="script">スクリプト(AppleScript)</param>
    /// <param name="argv">スクリプト引数</param>
    /// <param name="onClosed">終了通知</param>
    public IEnumerator getPathDialog(string script, System.Action<string, string> onClosed)
    {
        Process fileDialog = new Process ();				// fileDialogプロセス
        StringBuilder path = new StringBuilder ();			// 取得したファイルパス
        StringBuilder errorMessage = new StringBuilder ();	// エラーメッセージ
        // プロセスの初期設定
        fileDialog.StartInfo = new ProcessStartInfo ()
        {
            FileName = "osascript",			// 実行app (osascript : Applescriptを実行するmac標準app)
            Arguments = script,				// 実行appへの引数 (スクリプト自体)
            CreateNoWindow = true,			// terminalは非表示にする
            UseShellExecute = false,		// シェル機能を使用しない
            RedirectStandardOutput = true,	// スクリプトからの戻り値を受信する
            RedirectStandardError = true,	// スクリプトのエラーメッセージを受信する
        };
        // スクリプト戻り値イベント設定
        fileDialog.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>  {
            // 戻り値がないときも呼び出される場合があるので,戻り値があるか判定
            if(string.IsNullOrEmpty(e.Data) == false) {
                // 戻り値はURLエンコードされているのでデコード
                path.Append(WWW.UnEscapeURL(e.Data));
                UnityEngine.Debug.Log(WWW.UnEscapeURL(e.Data));
            }
        };
        // スクリプトエラーメッセージ受信イベント設定
        fileDialog.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
            // エラーがないときも呼び出される場合があるので,エラーメッセージがあるか判定
            if(string.IsNullOrEmpty(e.Data) == false) {
                errorMessage.Append(e.Data);
                UnityEngine.Debug.Log(e.Data);
            }
        };
        // プロセススタート.
        fileDialog.Start ();
        fileDialog.BeginOutputReadLine ();
        fileDialog.BeginErrorReadLine ();

        // 1フレーム待機し,その後applescriptのACTIVATE命令を実行
        yield return null;
        Process.Start (new ProcessStartInfo () { FileName = "osascript", Arguments = FORCE_ACTIVATE });
        // fileDialogが終了するまで待機
        while (fileDialog.HasExited == false) {
            yield return null;
        }
        // プロセスを終了・破棄
        fileDialog.Close ();
        fileDialog.Dispose ();
        // 終了通知
        onClosed.Invoke (path.ToString (), errorMessage.ToString());
    }
开发者ID:gtacenterprise,项目名称:plen__motion_editor_for_Unity,代码行数:56,代码来源:FileChooser.cs

示例15: gogogo

	public void gogogo()
	{
		//
		Status.Text = "Detecting ECID...";
		Status.Invoke((MethodInvoker)Center_status);

		Console.Text = string.Empty;
		Process p = new Process();
		p.StartInfo.FileName = "s-irecovery.exe";
		p.StartInfo.Arguments = "-ecid";
		p.StartInfo.UseShellExecute = false;
		p.StartInfo.CreateNoWindow = true;
		p.StartInfo.RedirectStandardOutput = true;
		p.StartInfo.RedirectStandardInput = true;
		p.StartInfo.RedirectStandardError = true;
		p.OutputDataReceived += dfu.update_1;
		p.Start();
		System.IO.StreamWriter SW = p.StandardInput;
		p.BeginOutputReadLine();
		p.Dispose();
		Delay(2);
		ECID = dfu.idetect.Text.Substring(5, 16);

		//Change pic to limera1n...
		if (iDevice == "iPod Touch 2G") {
			Status.Text = "Exploiting with steaks4uce...";
			PictureBox1.Image = My.Resources.steaks4uce;
		} else {
			Status.Text = "Exploiting with limera1n...";
			PictureBox1.Image = My.Resources.Ra1ndrop;
		}
		Status.Invoke((MethodInvoker)Center_status);
		//Pwn it...
		iRecovery_exploit();
		Status.Text = "Waiting for " + iDevice + "...";
		Status.Invoke((MethodInvoker)Center_status);
		//Change pic to dove...
		PictureBox1.Image = My.Resources.Dove;
		//USB Reset...
		Delay(3);
		//
		Status.Text = "Uploading iBSS...";
		Status.Invoke((MethodInvoker)Center_status);
		//Upload iBSS...
		Delay(1);
		iRecovery_file("iBSS." + board + ".RELEASE.dfu");

		File_Delete("iBSS." + board + ".RELEASE.dfu");

		Status.Text = "Scanning for iBSS...";
		Status.Invoke((MethodInvoker)Center_status);

		//Go Scan for iBSS...
		Stage = 1;
		Scan_iBoot.RunWorkerAsync();
	}
开发者ID:bobbytdotcom,项目名称:iFaith,代码行数:56,代码来源:Run.cs


注:本文中的Process.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。