diff options
Diffstat (limited to 'OpenSim/Tools/OpenSim.GUI/ProcessManager.cs')
-rw-r--r-- | OpenSim/Tools/OpenSim.GUI/ProcessManager.cs | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs deleted file mode 100644 index de693a7..0000000 --- a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Diagnostics; | ||
32 | |||
33 | namespace OpenSim.GUI | ||
34 | { | ||
35 | public class ProcessManager : Process | ||
36 | { | ||
37 | private string m_FileName; | ||
38 | private string m_Arguments; | ||
39 | public ProcessManager(string FileName,string Arguments) | ||
40 | { | ||
41 | m_FileName = FileName; | ||
42 | m_Arguments = Arguments; | ||
43 | |||
44 | // MyProc = new Process(); | ||
45 | StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; | ||
46 | Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); | ||
47 | StartInfo.FileName = m_FileName; | ||
48 | |||
49 | //p.StartInfo.Arguments = ""; | ||
50 | StartInfo.UseShellExecute = false; | ||
51 | StartInfo.RedirectStandardError = true; | ||
52 | StartInfo.RedirectStandardInput = true; | ||
53 | StartInfo.RedirectStandardOutput = true; | ||
54 | StartInfo.CreateNoWindow = true; | ||
55 | |||
56 | |||
57 | |||
58 | } | ||
59 | |||
60 | public void StartProcess() | ||
61 | { | ||
62 | try | ||
63 | { | ||
64 | Start(); | ||
65 | BeginOutputReadLine(); | ||
66 | BeginErrorReadLine(); | ||
67 | } | ||
68 | catch (Exception ex) | ||
69 | { | ||
70 | Console.WriteLine("Exception Occurred :{0},{1}", | ||
71 | ex.Message, ex.StackTrace.ToString()); | ||
72 | } | ||
73 | } | ||
74 | public void StopProcess() | ||
75 | { | ||
76 | try | ||
77 | { | ||
78 | CancelErrorRead(); | ||
79 | CancelErrorRead(); | ||
80 | if (!HasExited) | ||
81 | { | ||
82 | StandardInput.WriteLine("quit"); | ||
83 | StandardInput.WriteLine("shutdown"); | ||
84 | System.Threading.Thread.Sleep(500); | ||
85 | if (!HasExited) | ||
86 | { | ||
87 | Kill(); | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | catch (Exception ex) | ||
92 | { | ||
93 | Console.WriteLine("Exception Occurred :{0},{1}", | ||
94 | ex.Message, ex.StackTrace.ToString()); | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | } | ||