diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.Framework.Console/ConsoleBase.cs | 144 | ||||
-rw-r--r-- | OpenSim.Framework.Console/ConsoleCallbacksBase.cs | 12 | ||||
-rw-r--r-- | OpenSim.Framework.Console/OpenSim.Framework.Console.csproj | 5 | ||||
-rw-r--r-- | OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build | 83 | ||||
-rw-r--r-- | OpenSim.Framework/OpenSim.Framework.csproj | 2 | ||||
-rw-r--r-- | OpenSim.Framework/OpenSim.Framework.dll.build | 126 |
6 files changed, 247 insertions, 125 deletions
diff --git a/OpenSim.Framework.Console/ConsoleBase.cs b/OpenSim.Framework.Console/ConsoleBase.cs index 5343e71..e2e4457 100644 --- a/OpenSim.Framework.Console/ConsoleBase.cs +++ b/OpenSim.Framework.Console/ConsoleBase.cs | |||
@@ -1,45 +1,151 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | ||
2 | 3 | ||
3 | namespace OpenSim.Framework.Console | 4 | namespace OpenSim.Framework.Console |
4 | { | 5 | { |
5 | public abstract class ConsoleBase | 6 | public class ConsoleBase |
6 | { | 7 | { |
8 | StreamWriter Log; | ||
9 | public conscmd_callback cmdparser; | ||
10 | public string componentname; | ||
7 | 11 | ||
8 | public enum ConsoleType | 12 | // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! |
13 | // constype - the type of console to use (see enum ConsoleType) | ||
14 | // sparam - depending on the console type: | ||
15 | // TCP - the IP to bind to (127.0.0.1 if blank) | ||
16 | // Local - param ignored | ||
17 | // and for the iparam: | ||
18 | // TCP - the port to bind to | ||
19 | // Local - param ignored | ||
20 | // LogFile - duh | ||
21 | // componentname - which component of the OGS system? (user, asset etc) | ||
22 | // cmdparser - a reference to a conscmd_callback object | ||
23 | |||
24 | public ConsoleBase(string LogFile, string componentname, conscmd_callback cmdparser) | ||
9 | { | 25 | { |
10 | Local, // Use stdio | 26 | this.componentname = componentname; |
11 | TCP, // Use TCP/telnet | 27 | this.cmdparser = cmdparser; |
12 | SimChat // Use in-world chat (for gods) | 28 | |
29 | System.Console.WriteLine("ServerConsole.cs - creating new local console"); | ||
30 | System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); | ||
31 | Log = File.AppendText(LogFile); | ||
32 | Log.WriteLine("========================================================================"); | ||
33 | Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString()); | ||
13 | } | 34 | } |
14 | 35 | ||
15 | public abstract void Close(); | 36 | public void Close() |
37 | { | ||
38 | Log.WriteLine("Shutdown at " + DateTime.Now.ToString()); | ||
39 | Log.Close(); | ||
40 | } | ||
41 | |||
42 | public void Write(string format, params object[] args) | ||
43 | { | ||
44 | Log.Write(format, args); | ||
45 | System.Console.Write(format, args); | ||
46 | return; | ||
47 | } | ||
16 | 48 | ||
17 | public abstract void Write(string format, params object[] args); | 49 | public void WriteLine(string format, params object[] args) |
50 | { | ||
51 | Log.WriteLine(format, args); | ||
52 | System.Console.WriteLine(format, args); | ||
53 | return; | ||
54 | } | ||
18 | 55 | ||
19 | public abstract void WriteLine(string format, params object[] args); | 56 | public string ReadLine() |
57 | { | ||
58 | string TempStr = System.Console.ReadLine(); | ||
59 | Log.WriteLine(TempStr); | ||
60 | return TempStr; | ||
61 | } | ||
20 | 62 | ||
21 | public abstract string ReadLine(); | 63 | public int Read() |
64 | { | ||
65 | int TempInt = System.Console.Read(); | ||
66 | Log.Write((char)TempInt); | ||
67 | return TempInt; | ||
68 | } | ||
22 | 69 | ||
23 | public abstract int Read(); | 70 | // Displays a prompt and waits for the user to enter a string, then returns that string |
71 | // Done with no echo and suitable for passwords | ||
72 | public string PasswdPrompt(string prompt) | ||
73 | { | ||
74 | // FIXME: Needs to be better abstracted | ||
75 | Log.WriteLine(prompt); | ||
76 | this.Write(prompt); | ||
77 | ConsoleColor oldfg = System.Console.ForegroundColor; | ||
78 | System.Console.ForegroundColor = System.Console.BackgroundColor; | ||
79 | string temp = System.Console.ReadLine(); | ||
80 | System.Console.ForegroundColor = oldfg; | ||
81 | return temp; | ||
82 | } | ||
24 | 83 | ||
25 | // Displays a command prompt and waits for the user to enter a string, then returns that string | 84 | // Displays a command prompt and waits for the user to enter a string, then returns that string |
26 | public abstract string CmdPrompt(string prompt); | 85 | public string CmdPrompt(string prompt) |
86 | { | ||
87 | this.Write(prompt); | ||
88 | return this.ReadLine(); | ||
89 | } | ||
27 | 90 | ||
28 | // Displays a command prompt and returns a default value if the user simply presses enter | 91 | // Displays a command prompt and returns a default value if the user simply presses enter |
29 | public abstract string CmdPrompt(string prompt, string defaultresponse); | 92 | public string CmdPrompt(string prompt, string defaultresponse) |
93 | { | ||
94 | string temp = CmdPrompt(prompt); | ||
95 | if (temp == "") | ||
96 | { | ||
97 | return defaultresponse; | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | return temp; | ||
102 | } | ||
103 | } | ||
30 | 104 | ||
31 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | 105 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options |
32 | public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB); | 106 | public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) |
107 | { | ||
108 | bool itisdone = false; | ||
109 | string temp = CmdPrompt(prompt, defaultresponse); | ||
110 | while (itisdone == false) | ||
111 | { | ||
112 | if ((temp == OptionA) || (temp == OptionB)) | ||
113 | { | ||
114 | itisdone = true; | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | this.WriteLine("Valid options are " + OptionA + " or " + OptionB); | ||
119 | temp = CmdPrompt(prompt, defaultresponse); | ||
120 | } | ||
121 | } | ||
122 | return temp; | ||
123 | } | ||
33 | 124 | ||
34 | // Runs a command with a number of parameters | 125 | // Runs a command with a number of parameters |
35 | public abstract Object RunCmd(string Cmd, string[] cmdparams); | 126 | public Object RunCmd(string Cmd, string[] cmdparams) |
127 | { | ||
128 | cmdparser.RunCmd(Cmd, cmdparams); | ||
129 | return null; | ||
130 | } | ||
36 | 131 | ||
37 | // Shows data about something | 132 | // Shows data about something |
38 | public abstract void ShowCommands(string ShowWhat); | 133 | public void ShowCommands(string ShowWhat) |
39 | 134 | { | |
40 | // Displays a prompt to the user and then runs the command they entered | 135 | cmdparser.Show(ShowWhat); |
41 | public abstract void MainConsolePrompt(); | 136 | } |
42 | 137 | ||
43 | public abstract void SetStatus(string status); | 138 | public void MainConsolePrompt() |
139 | { | ||
140 | string[] tempstrarray; | ||
141 | string tempstr = this.CmdPrompt(this.componentname + "# "); | ||
142 | tempstrarray = tempstr.Split(' '); | ||
143 | string cmd = tempstrarray[0]; | ||
144 | Array.Reverse(tempstrarray); | ||
145 | Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); | ||
146 | Array.Reverse(tempstrarray); | ||
147 | string[] cmdparams = (string[])tempstrarray; | ||
148 | RunCmd(cmd, cmdparams); | ||
149 | } | ||
44 | } | 150 | } |
45 | } | 151 | } |
diff --git a/OpenSim.Framework.Console/ConsoleCallbacksBase.cs b/OpenSim.Framework.Console/ConsoleCallbacksBase.cs new file mode 100644 index 0000000..bb589d2 --- /dev/null +++ b/OpenSim.Framework.Console/ConsoleCallbacksBase.cs | |||
@@ -0,0 +1,12 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Console | ||
6 | { | ||
7 | public interface conscmd_callback | ||
8 | { | ||
9 | void RunCmd(string cmd, string[] cmdparams); | ||
10 | void Show(string ShowWhat); | ||
11 | } | ||
12 | } | ||
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj index a2718a5..bd10ce2 100644 --- a/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj +++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj | |||
@@ -3,7 +3,7 @@ | |||
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
5 | <SchemaVersion>2.0</SchemaVersion> | 5 | <SchemaVersion>2.0</SchemaVersion> |
6 | <ProjectGuid>{F5AD51E9-CF59-4C70-A586-CBD161EBB85F}</ProjectGuid> | 6 | <ProjectGuid>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon></ApplicationIcon> |
@@ -72,6 +72,9 @@ | |||
72 | <Compile Include="ConsoleBase.cs"> | 72 | <Compile Include="ConsoleBase.cs"> |
73 | <SubType>Code</SubType> | 73 | <SubType>Code</SubType> |
74 | </Compile> | 74 | </Compile> |
75 | <Compile Include="ConsoleCallbacksBase.cs"> | ||
76 | <SubType>Code</SubType> | ||
77 | </Compile> | ||
75 | <Compile Include="MainConsole.cs"> | 78 | <Compile Include="MainConsole.cs"> |
76 | <SubType>Code</SubType> | 79 | <SubType>Code</SubType> |
77 | </Compile> | 80 | </Compile> |
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build index 2dfc9b0..fa90bb6 100644 --- a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build +++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build | |||
@@ -1,41 +1,42 @@ | |||
1 | <?xml version="1.0" ?> | 1 | <?xml version="1.0" ?> |
2 | <project name="OpenSim.Framework.Console" default="build"> | 2 | <project name="OpenSim.Framework.Console" default="build"> |
3 | <target name="build"> | 3 | <target name="build"> |
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | 4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> |
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | 5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> |
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | 6 | <copy todir="${project::get-base-directory()}/${build.dir}"> |
7 | <fileset basedir="${project::get-base-directory()}"> | 7 | <fileset basedir="${project::get-base-directory()}"> |
8 | </fileset> | 8 | </fileset> |
9 | </copy> | 9 | </copy> |
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | 10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> |
11 | <resources prefix="OpenSim.Framework.Console" dynamicprefix="true" > | 11 | <resources prefix="OpenSim.Framework.Console" dynamicprefix="true" > |
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="AssemblyInfo.cs" /> | 14 | <include name="AssemblyInfo.cs" /> |
15 | <include name="ConsoleBase.cs" /> | 15 | <include name="ConsoleBase.cs" /> |
16 | <include name="MainConsole.cs" /> | 16 | <include name="ConsoleCallbacksBase.cs" /> |
17 | </sources> | 17 | <include name="MainConsole.cs" /> |
18 | <references basedir="${project::get-base-directory()}"> | 18 | </sources> |
19 | <lib> | 19 | <references basedir="${project::get-base-directory()}"> |
20 | <include name="${project::get-base-directory()}" /> | 20 | <lib> |
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | 21 | <include name="${project::get-base-directory()}" /> |
22 | </lib> | 22 | <include name="${project::get-base-directory()}/${build.dir}" /> |
23 | <include name="System.dll" /> | 23 | </lib> |
24 | </references> | 24 | <include name="System.dll" /> |
25 | </csc> | 25 | </references> |
26 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | 26 | </csc> |
27 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | 27 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> |
28 | <copy todir="${project::get-base-directory()}/../bin/"> | 28 | <mkdir dir="${project::get-base-directory()}/../bin/"/> |
29 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | 29 | <copy todir="${project::get-base-directory()}/../bin/"> |
30 | <include name="*.dll"/> | 30 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > |
31 | <include name="*.exe"/> | 31 | <include name="*.dll"/> |
32 | </fileset> | 32 | <include name="*.exe"/> |
33 | </copy> | 33 | </fileset> |
34 | </target> | 34 | </copy> |
35 | <target name="clean"> | 35 | </target> |
36 | <delete dir="${bin.dir}" failonerror="false" /> | 36 | <target name="clean"> |
37 | <delete dir="${obj.dir}" failonerror="false" /> | 37 | <delete dir="${bin.dir}" failonerror="false" /> |
38 | </target> | 38 | <delete dir="${obj.dir}" failonerror="false" /> |
39 | <target name="doc" description="Creates documentation."> | 39 | </target> |
40 | </target> | 40 | <target name="doc" description="Creates documentation."> |
41 | </project> | 41 | </target> |
42 | </project> | ||
diff --git a/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj index 79c15ae..b81afb5 100644 --- a/OpenSim.Framework/OpenSim.Framework.csproj +++ b/OpenSim.Framework/OpenSim.Framework.csproj | |||
@@ -3,7 +3,7 @@ | |||
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
5 | <SchemaVersion>2.0</SchemaVersion> | 5 | <SchemaVersion>2.0</SchemaVersion> |
6 | <ProjectGuid>{26E437F6-BA50-44CD-BB44-E911E25CA88C}</ProjectGuid> | 6 | <ProjectGuid>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon></ApplicationIcon> |
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build index a5ec58c..79bbf05 100644 --- a/OpenSim.Framework/OpenSim.Framework.dll.build +++ b/OpenSim.Framework/OpenSim.Framework.dll.build | |||
@@ -1,63 +1,63 @@ | |||
1 | <?xml version="1.0" ?> | 1 | <?xml version="1.0" ?> |
2 | <project name="OpenSim.Framework" default="build"> | 2 | <project name="OpenSim.Framework" default="build"> |
3 | <target name="build"> | 3 | <target name="build"> |
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | 4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> |
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | 5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> |
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | 6 | <copy todir="${project::get-base-directory()}/${build.dir}"> |
7 | <fileset basedir="${project::get-base-directory()}"> | 7 | <fileset basedir="${project::get-base-directory()}"> |
8 | </fileset> | 8 | </fileset> |
9 | </copy> | 9 | </copy> |
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | 10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> |
11 | <resources prefix="OpenSim.Framework" dynamicprefix="true" > | 11 | <resources prefix="OpenSim.Framework" dynamicprefix="true" > |
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="AgentCiruitData.cs" /> | 14 | <include name="AgentCiruitData.cs" /> |
15 | <include name="AgentInventory.cs" /> | 15 | <include name="AgentInventory.cs" /> |
16 | <include name="AssetBase.cs" /> | 16 | <include name="AssetBase.cs" /> |
17 | <include name="BlockingQueue.cs" /> | 17 | <include name="BlockingQueue.cs" /> |
18 | <include name="HeightMapGenHills.cs" /> | 18 | <include name="HeightMapGenHills.cs" /> |
19 | <include name="IAssetServer.cs" /> | 19 | <include name="IAssetServer.cs" /> |
20 | <include name="IConfig.cs" /> | 20 | <include name="IConfig.cs" /> |
21 | <include name="IGridServer.cs" /> | 21 | <include name="IGridServer.cs" /> |
22 | <include name="ILocalStorage.cs" /> | 22 | <include name="ILocalStorage.cs" /> |
23 | <include name="IUserServer.cs" /> | 23 | <include name="IUserServer.cs" /> |
24 | <include name="LocalGridBase.cs" /> | 24 | <include name="LocalGridBase.cs" /> |
25 | <include name="Login.cs" /> | 25 | <include name="Login.cs" /> |
26 | <include name="LoginService.cs" /> | 26 | <include name="LoginService.cs" /> |
27 | <include name="NeighbourInfo.cs" /> | 27 | <include name="NeighbourInfo.cs" /> |
28 | <include name="PrimData.cs" /> | 28 | <include name="PrimData.cs" /> |
29 | <include name="RemoteGridBase.cs" /> | 29 | <include name="RemoteGridBase.cs" /> |
30 | <include name="SimProfile.cs" /> | 30 | <include name="SimProfile.cs" /> |
31 | <include name="SimProfileBase.cs" /> | 31 | <include name="SimProfileBase.cs" /> |
32 | <include name="UserProfile.cs" /> | 32 | <include name="UserProfile.cs" /> |
33 | <include name="UserProfileManager.cs" /> | 33 | <include name="UserProfileManager.cs" /> |
34 | <include name="UserProfileManagerBase.cs" /> | 34 | <include name="UserProfileManagerBase.cs" /> |
35 | <include name="Util.cs" /> | 35 | <include name="Util.cs" /> |
36 | <include name="Properties/AssemblyInfo.cs" /> | 36 | <include name="Properties/AssemblyInfo.cs" /> |
37 | </sources> | 37 | </sources> |
38 | <references basedir="${project::get-base-directory()}"> | 38 | <references basedir="${project::get-base-directory()}"> |
39 | <lib> | 39 | <lib> |
40 | <include name="${project::get-base-directory()}" /> | 40 | <include name="${project::get-base-directory()}" /> |
41 | <include name="${project::get-base-directory()}/${build.dir}" /> | 41 | <include name="${project::get-base-directory()}/${build.dir}" /> |
42 | </lib> | 42 | </lib> |
43 | <include name="System.dll" /> | 43 | <include name="System.dll" /> |
44 | <include name="System.Xml.dll" /> | 44 | <include name="System.Xml.dll" /> |
45 | <include name="../bin/libsecondlife.dll" /> | 45 | <include name="../bin/libsecondlife.dll" /> |
46 | </references> | 46 | </references> |
47 | </csc> | 47 | </csc> |
48 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | 48 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> |
49 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | 49 | <mkdir dir="${project::get-base-directory()}/../bin/"/> |
50 | <copy todir="${project::get-base-directory()}/../bin/"> | 50 | <copy todir="${project::get-base-directory()}/../bin/"> |
51 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | 51 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > |
52 | <include name="*.dll"/> | 52 | <include name="*.dll"/> |
53 | <include name="*.exe"/> | 53 | <include name="*.exe"/> |
54 | </fileset> | 54 | </fileset> |
55 | </copy> | 55 | </copy> |
56 | </target> | 56 | </target> |
57 | <target name="clean"> | 57 | <target name="clean"> |
58 | <delete dir="${bin.dir}" failonerror="false" /> | 58 | <delete dir="${bin.dir}" failonerror="false" /> |
59 | <delete dir="${obj.dir}" failonerror="false" /> | 59 | <delete dir="${obj.dir}" failonerror="false" /> |
60 | </target> | 60 | </target> |
61 | <target name="doc" description="Creates documentation."> | 61 | <target name="doc" description="Creates documentation."> |
62 | </target> | 62 | </target> |
63 | </project> | 63 | </project> |