Browse Source

Start of rewrite 5279!

MW 17 years ago
commit
3436961bb5
100 changed files with 8467 additions and 0 deletions
  1. 31 0
      Common/OpenSim.Framework.Console/AssemblyInfo.cs
  2. 166 0
      Common/OpenSim.Framework.Console/ConsoleBase.cs
  3. 12 0
      Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs
  4. 48 0
      Common/OpenSim.Framework.Console/MainConsole.cs
  5. 89 0
      Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj
  6. 12 0
      Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj.user
  7. 42 0
      Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build
  8. 251 0
      Common/OpenSim.Framework/AgentInventory.cs
  9. 33 0
      Common/OpenSim.Framework/BlockingQueue.cs
  10. 149 0
      Common/OpenSim.Framework/HeightMapGenHills.cs
  11. 68 0
      Common/OpenSim.Framework/Interfaces/IAssetServer.cs
  12. 35 0
      Common/OpenSim.Framework/Interfaces/IClientAPI.cs
  13. 76 0
      Common/OpenSim.Framework/Interfaces/IConfig.cs
  14. 15 0
      Common/OpenSim.Framework/Interfaces/IGenericConfig.cs
  15. 64 0
      Common/OpenSim.Framework/Interfaces/IGridConfig.cs
  16. 81 0
      Common/OpenSim.Framework/Interfaces/IGridServer.cs
  17. 54 0
      Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
  18. 14 0
      Common/OpenSim.Framework/Interfaces/IScriptAPI.cs
  19. 14 0
      Common/OpenSim.Framework/Interfaces/IScriptEngine.cs
  20. 58 0
      Common/OpenSim.Framework/Interfaces/IUserConfig.cs
  21. 15 0
      Common/OpenSim.Framework/Interfaces/IUserServer.cs
  22. 24 0
      Common/OpenSim.Framework/Interfaces/LocalGridBase.cs
  23. 37 0
      Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs
  24. 14 0
      Common/OpenSim.Framework/LoginService.cs
  25. 194 0
      Common/OpenSim.Framework/OpenSim.Framework.csproj
  26. 12 0
      Common/OpenSim.Framework/OpenSim.Framework.csproj.user
  27. 75 0
      Common/OpenSim.Framework/OpenSim.Framework.dll.build
  28. 33 0
      Common/OpenSim.Framework/Properties/AssemblyInfo.cs
  29. 109 0
      Common/OpenSim.Framework/Remoting.cs
  30. 83 0
      Common/OpenSim.Framework/SimProfile.cs
  31. 27 0
      Common/OpenSim.Framework/SimProfileBase.cs
  32. 22 0
      Common/OpenSim.Framework/Types/AgentCiruitData.cs
  33. 22 0
      Common/OpenSim.Framework/Types/AssetBase.cs
  34. 34 0
      Common/OpenSim.Framework/Types/AssetLandmark.cs
  35. 23 0
      Common/OpenSim.Framework/Types/AssetStorage.cs
  36. 24 0
      Common/OpenSim.Framework/Types/Login.cs
  37. 19 0
      Common/OpenSim.Framework/Types/NeighbourInfo.cs
  38. 18 0
      Common/OpenSim.Framework/Types/OSVector3.cs
  39. 173 0
      Common/OpenSim.Framework/Types/PrimData.cs
  40. 62 0
      Common/OpenSim.Framework/UserProfile.cs
  41. 272 0
      Common/OpenSim.Framework/UserProfileManager.cs
  42. 124 0
      Common/OpenSim.Framework/UserProfileManagerBase.cs
  43. 151 0
      Common/OpenSim.Framework/Util.cs
  44. 93 0
      Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj
  45. 12 0
      Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj.user
  46. 42 0
      Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build
  47. 35 0
      Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs
  48. 109 0
      Common/OpenSim.GenericConfig/Xml/XmlConfig.cs
  49. 256 0
      Common/OpenSim.Servers/BaseHttpServer.cs
  50. 10 0
      Common/OpenSim.Servers/BaseServer.cs
  51. 113 0
      Common/OpenSim.Servers/CheckSumServer.cs
  52. 8 0
      Common/OpenSim.Servers/IRestHandler.cs
  53. 123 0
      Common/OpenSim.Servers/LocalUserProfileManager.cs
  54. 670 0
      Common/OpenSim.Servers/LoginResponse.cs
  55. 284 0
      Common/OpenSim.Servers/LoginServer.cs
  56. 130 0
      Common/OpenSim.Servers/OpenSim.Servers.csproj
  57. 12 0
      Common/OpenSim.Servers/OpenSim.Servers.csproj.user
  58. 52 0
      Common/OpenSim.Servers/OpenSim.Servers.dll.build
  59. 68 0
      Common/OpenSim.Servers/UDPServerBase.cs
  60. 7 0
      Common/OpenSim.Servers/XmlRpcMethod.cs
  61. 46 0
      Common/XmlRpcCS/Logger.cs
  62. 204 0
      Common/XmlRpcCS/SimpleHttpRequest.cs
  63. 138 0
      Common/XmlRpcCS/XMLRPC.csproj
  64. 12 0
      Common/XmlRpcCS/XMLRPC.csproj.user
  65. 58 0
      Common/XmlRpcCS/XMLRPC.dll.build
  66. 51 0
      Common/XmlRpcCS/XmlRpcBoxcarRequest.cs
  67. 61 0
      Common/XmlRpcCS/XmlRpcClientProxy.cs
  68. 195 0
      Common/XmlRpcCS/XmlRpcDeserializer.cs
  69. 51 0
      Common/XmlRpcCS/XmlRpcErrorCodes.cs
  70. 39 0
      Common/XmlRpcCS/XmlRpcException.cs
  71. 60 0
      Common/XmlRpcCS/XmlRpcExposedAttribute.cs
  72. 150 0
      Common/XmlRpcCS/XmlRpcRequest.cs
  73. 64 0
      Common/XmlRpcCS/XmlRpcRequestDeserializer.cs
  74. 51 0
      Common/XmlRpcCS/XmlRpcRequestSerializer.cs
  75. 98 0
      Common/XmlRpcCS/XmlRpcResponder.cs
  76. 85 0
      Common/XmlRpcCS/XmlRpcResponse.cs
  77. 65 0
      Common/XmlRpcCS/XmlRpcResponseDeserializer.cs
  78. 57 0
      Common/XmlRpcCS/XmlRpcResponseSerializer.cs
  79. 109 0
      Common/XmlRpcCS/XmlRpcSerializer.cs
  80. 239 0
      Common/XmlRpcCS/XmlRpcServer.cs
  81. 252 0
      Common/XmlRpcCS/XmlRpcSystemObject.cs
  82. 76 0
      Common/XmlRpcCS/XmlRpcXmlTokens.cs
  83. 100 0
      OpenGridServices.build
  84. 85 0
      OpenGridServices.sln
  85. BIN
      OpenGridServices.suo
  86. 31 0
      OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs
  87. 112 0
      OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
  88. 107 0
      OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
  89. 12 0
      OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user
  90. 46 0
      OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
  91. 83 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
  92. 111 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
  93. 100 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs
  94. 111 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj
  95. 12 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user
  96. 47 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build
  97. 35 0
      OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs
  98. 136 0
      OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
  99. 171 0
      OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
  100. 104 0
      OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj

+ 31 - 0
Common/OpenSim.Framework.Console/AssemblyInfo.cs

@@ -0,0 +1,31 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("ServerConsole")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ServerConsole")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]

+ 166 - 0
Common/OpenSim.Framework.Console/ConsoleBase.cs

@@ -0,0 +1,166 @@
+using System;
+using System.IO;
+
+namespace OpenSim.Framework.Console
+{
+    public enum LogPriority : int
+    {
+        CRITICAL,
+        HIGH,
+        MEDIUM,
+        NORMAL,
+        LOW,
+        VERBOSE,
+        EXTRAVERBOSE
+    }
+
+    public class ConsoleBase
+    {
+        StreamWriter Log;
+        public conscmd_callback cmdparser;
+        public string componentname;
+        private bool m_silent;
+
+        public ConsoleBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent )
+        {
+            this.componentname = componentname;
+            this.cmdparser = cmdparser;
+            this.m_silent = silent;
+            System.Console.WriteLine("ServerConsole.cs - creating new local console");
+            System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
+            Log = File.AppendText(LogFile);
+            Log.WriteLine("========================================================================");
+            Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString());
+        }
+
+        public void Close()
+        {
+            Log.WriteLine("Shutdown at " + DateTime.Now.ToString());
+            Log.Close();
+        }
+
+        public void Write(string format, params object[] args)
+        {
+            WriteLine(LogPriority.NORMAL,format,args);
+            return;
+        }
+
+        [Obsolete("WriteLine(msg,args) has been depreciated, use WriteLine(priority,msg,args) instead.")]
+        public void WriteLine(string format, params object[] args)
+        {
+            Log.WriteLine(format, args);
+            Log.Flush();
+	    if(!m_silent)
+            {
+            System.Console.WriteLine(format, args);
+            }
+            return;
+        }
+
+        public void WriteLine(LogPriority importance, string format, params object[] args)
+        {
+            Log.WriteLine(format, args);
+            Log.Flush();
+            if (!m_silent)
+            {
+                System.Console.WriteLine(format, args);
+            }
+            return;
+        }
+
+        public string ReadLine()
+        {
+            string TempStr = System.Console.ReadLine();
+            Log.WriteLine(TempStr);
+            return TempStr;
+        }
+
+        public int Read()
+        {
+            int TempInt = System.Console.Read();
+            Log.Write((char)TempInt);
+            return TempInt;
+        }
+
+        // Displays a prompt and waits for the user to enter a string, then returns that string
+        // Done with no echo and suitable for passwords
+        public string PasswdPrompt(string prompt)
+        {
+            // FIXME: Needs to be better abstracted
+            Log.WriteLine(prompt);
+            this.Write(prompt);
+            ConsoleColor oldfg = System.Console.ForegroundColor;
+            System.Console.ForegroundColor = System.Console.BackgroundColor;
+            string temp = System.Console.ReadLine();
+            System.Console.ForegroundColor = oldfg;
+            return temp;
+        }
+
+        // Displays a command prompt and waits for the user to enter a string, then returns that string
+        public string CmdPrompt(string prompt)
+        {
+            this.Write(String.Format("{0}: ", prompt));
+            return this.ReadLine();
+        }
+
+        // Displays a command prompt and returns a default value if the user simply presses enter
+        public string CmdPrompt(string prompt, string defaultresponse)
+        {
+            string temp = CmdPrompt(String.Format( "{0} [{1}]", prompt, defaultresponse ));
+            if (temp == "")
+            {
+                return defaultresponse;
+            }
+            else
+            {
+                return temp;
+            }
+        }
+
+        // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
+        public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB)
+        {
+            bool itisdone = false;
+            string temp = CmdPrompt(prompt, defaultresponse);
+            while (itisdone == false)
+            {
+                if ((temp == OptionA) || (temp == OptionB))
+                {
+                    itisdone = true;
+                }
+                else
+                {
+                    this.WriteLine(LogPriority.MEDIUM,"Valid options are " + OptionA + " or " + OptionB);
+                    temp = CmdPrompt(prompt, defaultresponse);
+                }
+            }
+            return temp;
+        }
+
+        // Runs a command with a number of parameters
+        public Object RunCmd(string Cmd, string[] cmdparams)
+        {
+            cmdparser.RunCmd(Cmd, cmdparams);
+            return null;
+        }
+
+        // Shows data about something
+        public void ShowCommands(string ShowWhat)
+        {
+            cmdparser.Show(ShowWhat);
+        }
+
+        public void MainConsolePrompt()
+        {
+            string[] tempstrarray;
+            string tempstr = this.CmdPrompt(this.componentname + "# ");
+            tempstrarray = tempstr.Split(' ');
+            string cmd = tempstrarray[0];
+            Array.Reverse(tempstrarray);
+            Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
+            Array.Reverse(tempstrarray);
+            string[] cmdparams = (string[])tempstrarray;
+            RunCmd(cmd, cmdparams);
+        }
+    }
+}

+ 12 - 0
Common/OpenSim.Framework.Console/ConsoleCallbacksBase.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Console
+{    
+    public interface conscmd_callback
+    {
+        void RunCmd(string cmd, string[] cmdparams);
+        void Show(string ShowWhat);
+    }
+}

+ 48 - 0
Common/OpenSim.Framework.Console/MainConsole.cs

@@ -0,0 +1,48 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+using System;
+
+namespace OpenSim.Framework.Console
+{
+	public class MainConsole {
+		
+		private static ConsoleBase instance;
+		
+		public static ConsoleBase Instance 
+		{
+			get 
+			{
+				return instance;
+			}
+			set
+			{
+				instance = value;
+			}
+		}
+    }
+
+}

+ 89 - 0
Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj

@@ -0,0 +1,89 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{A7CD0630-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenSim.Framework.Console</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenSim.Framework.Console</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConsoleBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConsoleCallbacksBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MainConsole.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
Common/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 42 - 0
Common/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build

@@ -0,0 +1,42 @@
+<?xml version="1.0" ?>
+<project name="OpenSim.Framework.Console" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenSim.Framework.Console" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="AssemblyInfo.cs" />
+                <include name="ConsoleBase.cs" />
+                <include name="ConsoleCallbacksBase.cs" />
+                <include name="MainConsole.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 251 - 0
Common/OpenSim.Framework/AgentInventory.cs

@@ -0,0 +1,251 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using libsecondlife.Packets;
+using OpenSim.Framework.Types;
+using OpenSim.Framework.Utilities;
+
+namespace OpenSim.Framework.Inventory
+{
+    public class AgentInventory
+    {
+        //Holds the local copy of Inventory info for a agent
+        public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
+        public Dictionary<LLUUID, InventoryItem> InventoryItems;
+        public InventoryFolder InventoryRoot;
+        public int LastCached;  //maybe used by opensim app, time this was last stored/compared to user server
+        public LLUUID AgentID;
+        public AvatarWearable[] Wearables;
+
+        public AgentInventory()
+        {
+            InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
+            InventoryItems = new Dictionary<LLUUID, InventoryItem>();
+            this.Initialise();
+        }
+
+        public virtual void Initialise()
+        {
+            Wearables = new AvatarWearable[13]; //should be 12 of these
+            for (int i = 0; i < 13; i++)
+            {
+                Wearables[i] = new AvatarWearable();
+            }
+      
+        }
+
+        public bool CreateNewFolder(LLUUID folderID, ushort type)
+        {
+            InventoryFolder Folder = new InventoryFolder();
+            Folder.FolderID = folderID;
+            Folder.OwnerID = this.AgentID;
+            Folder.DefaultType = type;
+            this.InventoryFolders.Add(Folder.FolderID, Folder);
+            return (true);
+        }
+
+        public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
+        {
+            this.AgentID = newAgentID;
+            InventoryRoot = new InventoryFolder();
+            InventoryRoot.FolderID = LLUUID.Random();
+            InventoryRoot.ParentID = new LLUUID();
+            InventoryRoot.Version = 1;
+            InventoryRoot.DefaultType = 8;
+            InventoryRoot.OwnerID = this.AgentID;
+            InventoryRoot.FolderName = "My Inventory";
+            InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
+            InventoryRoot.OwnerID = this.AgentID;
+            if (createTextures)
+            {
+                this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
+            }
+        }
+
+        public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
+        {
+            InventoryFolder Folder = new InventoryFolder();
+            Folder.FolderID = folderID;
+            Folder.OwnerID = this.AgentID;
+            Folder.DefaultType = type;
+            Folder.FolderName = folderName;
+            this.InventoryFolders.Add(Folder.FolderID, Folder);
+
+            return (true);
+        }
+
+        public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
+        {
+            if (!this.InventoryFolders.ContainsKey(folderID))
+            {
+                Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
+                InventoryFolder Folder = new InventoryFolder();
+                Folder.FolderID = folderID;
+                Folder.OwnerID = this.AgentID;
+                Folder.DefaultType = type;
+                Folder.FolderName = folderName;
+                Folder.ParentID = parent;
+                this.InventoryFolders.Add(Folder.FolderID, Folder);
+            }
+
+            return (true);
+        }
+
+        public bool HasFolder(LLUUID folderID)
+        {
+            if (this.InventoryFolders.ContainsKey(folderID))
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public LLUUID GetFolderID(string folderName)
+        {
+            foreach (InventoryFolder inv in this.InventoryFolders.Values)
+            {
+                if (inv.FolderName == folderName)
+                {
+                    return inv.FolderID;
+                }
+            }
+
+            return LLUUID.Zero;
+        }
+
+        public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
+        {
+            if(this.InventoryItems.ContainsKey(itemID))
+            {
+                InventoryItem Item = this.InventoryItems[itemID];
+                Item.AssetID = asset.FullID;
+                Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
+                //TODO need to update the rest of the info
+            }
+            return true;
+        }
+
+        public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
+        {
+            Console.WriteLine("updating inventory item details");
+            if (this.InventoryItems.ContainsKey(itemID))
+            {
+                Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
+                InventoryItem Item = this.InventoryItems[itemID];
+                Item.Name = Util.FieldToString(packet.Name);
+                Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
+                //TODO need to update the rest of the info
+            }
+            return true;
+        }
+
+        public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
+        {
+            if (this.InventoryFolders.ContainsKey(folderID))
+            {
+                LLUUID NewItemID = LLUUID.Random();
+
+                InventoryItem Item = new InventoryItem();
+                Item.FolderID = folderID;
+                Item.OwnerID = AgentID;
+                Item.AssetID = asset.FullID;
+                Item.ItemID = NewItemID;
+                Item.Type = asset.Type;
+                Item.Name = asset.Name;
+                Item.Description = asset.Description;
+                Item.InvType = asset.InvType;
+                this.InventoryItems.Add(Item.ItemID, Item);
+                InventoryFolder Folder = InventoryFolders[Item.FolderID];
+                Folder.Items.Add(Item);
+                return (Item.ItemID);
+            }
+            else
+            {
+                return (null);
+            }
+        }
+
+        public bool DeleteFromInventory(LLUUID itemID)
+        {
+            bool res = false;
+            if (this.InventoryItems.ContainsKey(itemID))
+            {
+                InventoryItem item = this.InventoryItems[itemID];
+                this.InventoryItems.Remove(itemID);
+                foreach (InventoryFolder fold in InventoryFolders.Values)
+                {
+                    if (fold.Items.Contains(item))
+                    {
+                        fold.Items.Remove(item);
+                        break;
+                    }
+                }
+                res = true;
+                
+            }
+            return res;
+        }
+    }
+
+    public class InventoryFolder
+    {
+        public List<InventoryItem> Items;
+        //public List<InventoryFolder> Subfolders;
+        public LLUUID FolderID;
+        public LLUUID OwnerID;
+        public LLUUID ParentID = LLUUID.Zero;
+        public string FolderName;
+        public ushort DefaultType;
+        public ushort Version;
+
+        public InventoryFolder()
+        {
+            Items = new List<InventoryItem>();
+            //Subfolders = new List<InventoryFolder>();
+        }
+
+    }
+
+    public class InventoryItem
+    {
+        public LLUUID FolderID;
+        public LLUUID OwnerID;
+        public LLUUID ItemID;
+        public LLUUID AssetID;
+        public LLUUID CreatorID;
+        public sbyte InvType;
+        public sbyte Type;
+        public string Name ="";
+        public string Description;
+
+        public InventoryItem()
+        {
+            this.CreatorID = LLUUID.Zero;
+        }
+
+        public string ExportString()
+        {
+            string typ = "notecard";
+            string result = "";
+            result += "\tinv_object\t0\n\t{\n";
+            result += "\t\tobj_id\t%s\n";
+            result +=  "\t\tparent_id\t"+ ItemID.ToString() +"\n";
+            result += "\t\ttype\t"+ typ +"\n";
+            result += "\t\tname\t" + Name+"|\n";
+            result += "\t}\n";
+            return result;
+        }
+    }
+
+    public class AvatarWearable
+    {
+        public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
+        public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
+
+        public AvatarWearable()
+        {
+
+        }
+    }
+}

+ 33 - 0
Common/OpenSim.Framework/BlockingQueue.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Utilities
+{
+    public class BlockingQueue<T>
+    {
+        private Queue<T> _queue = new Queue<T>();
+        private object _queueSync = new object();
+
+        public void Enqueue(T value)
+        {
+            lock (_queueSync)
+            {
+                _queue.Enqueue(value);
+                Monitor.Pulse(_queueSync);
+            }
+        }
+
+        public T Dequeue()
+        {
+            lock (_queueSync)
+            {
+                if (_queue.Count < 1)
+                    Monitor.Wait(_queueSync);
+
+                return _queue.Dequeue();
+            }
+        }
+    }
+}

+ 149 - 0
Common/OpenSim.Framework/HeightMapGenHills.cs

@@ -0,0 +1,149 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+using System;
+
+namespace OpenSim.Framework.Terrain
+{
+    public class HeightmapGenHills
+    {
+        private Random Rand = new Random();
+        private int NumHills;
+        private float HillMin;
+        private float HillMax;
+        private bool Island;
+        private float[] heightmap;
+
+        public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island)
+        {
+            NumHills = numHills;
+            HillMin = hillMin;
+            HillMax = hillMax;
+            Island = island;
+
+            heightmap = new float[256 * 256];
+
+            for (int i = 0; i < numHills; i++)
+            {
+                AddHill();
+            }
+
+            Normalize();
+
+            return heightmap;
+        }
+
+        private void AddHill()
+        {
+            float x, y;
+            float radius = RandomRange(HillMin, HillMax);
+
+            if (Island)
+            {
+                // Which direction from the center of the map the hill is placed
+                float theta = RandomRange(0, 6.28f);
+
+                // How far from the center of the map to place the hill. The radius
+                // is subtracted from the range to prevent any part of the hill from
+                // reaching the edge of the map
+                float distance = RandomRange(radius / 2.0f, 128.0f - radius);
+
+                x = 128.0f + (float)Math.Cos(theta) * distance;
+                y = 128.0f + (float)Math.Sin(theta) * distance;
+            }
+            else
+            {
+                x = RandomRange(-radius, 256.0f + radius);
+                y = RandomRange(-radius, 256.0f + radius);
+            }
+
+            float radiusSq = radius * radius;
+            float distSq;
+            float height;
+
+            int xMin = (int)(x - radius) - 1;
+            int xMax = (int)(x + radius) + 1;
+            if (xMin < 0) xMin = 0;
+            if (xMax > 255) xMax = 255;
+
+            int yMin = (int)(y - radius) - 1;
+            int yMax = (int)(y + radius) + 1;
+            if (yMin < 0) yMin = 0;
+            if (yMax > 255) yMax = 255;
+
+            // Loop through each affected cell and determine the height at that point
+            for (int v = yMin; v <= yMax; ++v)
+            {
+                float fv = (float)v;
+
+                for (int h = xMin; h <= xMax; ++h)
+                {
+                    float fh = (float)h;
+
+                    // Determine how far from the center of this hill this point is
+                    distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv);
+                    height = radiusSq - distSq;
+
+                    // Don't add negative hill values
+                    if (height > 0.0f) heightmap[h + v * 256] += height;
+                }
+            }
+        }
+
+        private void Normalize()
+        {
+            float min = heightmap[0];
+            float max = heightmap[0];
+
+            for (int x = 0; x < 256; x++)
+            {
+                for (int y = 0; y < 256; y++)
+                {
+                    if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256];
+                    if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256];
+                }
+            }
+
+            // Avoid a rare divide by zero
+            if (min != max)
+            {
+                for (int x = 0; x < 256; x++)
+                {
+                    for (int y = 0; y < 256; y++)
+                    {
+                        heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin);
+                    }
+                }
+            }
+        }
+
+        private float RandomRange(float min, float max)
+        {
+            return (float)Rand.NextDouble() * (max - min) + min;
+        }
+    }
+}

+ 68 - 0
Common/OpenSim.Framework/Interfaces/IAssetServer.cs

@@ -0,0 +1,68 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.IO;
+using System.Threading;
+using libsecondlife;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// Description of IAssetServer.
+    /// </summary>
+
+    public interface IAssetServer
+    {
+        void SetReceiver(IAssetReceiver receiver);
+        void RequestAsset(LLUUID assetID, bool isTexture);
+        void UpdateAsset(AssetBase asset);
+        void UploadNewAsset(AssetBase asset);
+        void SetServerInfo(string ServerUrl, string ServerKey);
+        void Close();
+    }
+
+    // could change to delegate?
+    public interface IAssetReceiver
+    {
+        void AssetReceived(AssetBase asset, bool IsTexture);
+        void AssetNotFound(AssetBase asset);
+    }
+
+    public interface IAssetPlugin
+    {
+        IAssetServer GetAssetServer();
+    }
+
+    public struct ARequest
+    {
+        public LLUUID AssetID;
+        public bool IsTexture;
+    }
+}

+ 35 - 0
Common/OpenSim.Framework/Interfaces/IClientAPI.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenSim.Framework.Inventory;
+using libsecondlife;
+using libsecondlife.Packets;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+    public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
+    public delegate void ModifyTerrain(byte action, float north, float west);
+    public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
+    public delegate void StartAnim(LLUUID animID, int seq);
+    public delegate void LinkObjects(uint parent, List<uint> children);
+
+    public interface IClientAPI
+    {
+        event ChatFromViewer OnChatFromViewer;
+        event RezObject OnRezObject;
+        event ModifyTerrain OnModifyTerrain;
+        event SetAppearance OnSetAppearance;
+        event StartAnim OnStartAnim;
+        event LinkObjects OnLinkObjects;
+
+        LLVector3 StartPos
+        {
+            get;
+            set;
+        }
+        void SendAppearance(AvatarWearable[] wearables);
+        void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+    }
+}

+ 76 - 0
Common/OpenSim.Framework/Interfaces/IConfig.cs

@@ -0,0 +1,76 @@
+/*
+Copyright (c) OpenSim project, http://osgrid.org/
+
+* Copyright (c) <year>, <copyright holder>
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using libsecondlife;
+//using OpenSim.world;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// This class handles connection to the underlying database used for configuration of the region.
+    /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
+    /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
+    /// what is hardcoded here and then saved into opensim.yap for future startups.
+    /// </summary>
+
+
+    public abstract class SimConfig
+    {
+        public string RegionName;
+
+        public uint RegionLocX;
+        public uint RegionLocY;
+        public ulong RegionHandle;
+
+        public int IPListenPort;
+        public string IPListenAddr;
+
+        public string AssetURL;
+        public string AssetSendKey;
+
+        public string GridURL;
+        public string GridSendKey;
+        public string GridRecvKey;
+        public string UserURL;
+        public string UserSendKey;
+        public string UserRecvKey;
+
+        public abstract void InitConfig(bool sandboxMode);
+        public abstract void LoadFromGrid(); 
+
+    }
+
+    public interface ISimConfig
+    {
+        SimConfig GetConfigObject();
+    }
+}

+ 15 - 0
Common/OpenSim.Framework/Interfaces/IGenericConfig.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public interface IGenericConfig
+    {
+        void LoadData();
+        string GetAttribute(string attributeName);
+        bool SetAttribute(string attributeName, string attributeValue);
+        void Commit();
+        void Close();
+    }
+}

+ 64 - 0
Common/OpenSim.Framework/Interfaces/IGridConfig.cs

@@ -0,0 +1,64 @@
+/*
+Copyright (c) OpenSim project, http://osgrid.org/
+
+* Copyright (c) <year>, <copyright holder>
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using libsecondlife;
+//using OpenSim.world;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// </summary>
+
+
+    public abstract class GridConfig
+    {
+	public string GridOwner;
+        public string DefaultStartupMsg;
+        public string DefaultAssetServer;
+        public string AssetSendKey;
+        public string AssetRecvKey;
+        public string DefaultUserServer;
+        public string UserSendKey;
+        public string UserRecvKey;
+        public string SimSendKey;
+        public string SimRecvKey;
+
+
+        public abstract void InitConfig();
+
+    }
+
+    public interface IGridConfig
+    {
+        GridConfig GetConfigObject();
+    }
+}

+ 81 - 0
Common/OpenSim.Framework/Interfaces/IGridServer.cs

@@ -0,0 +1,81 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Sockets;
+using System.IO;
+using libsecondlife;
+using OpenSim;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// Handles connection to Grid Servers.
+    /// also Sim to Sim connections?
+    /// </summary>
+
+    public interface IGridServer
+    {
+        UUIDBlock RequestUUIDBlock();
+        NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
+        AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        string GetName();
+        bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
+        void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
+        IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
+        void Close();
+    }
+    
+    public struct UUIDBlock
+    {
+        public LLUUID BlockStart;
+        public LLUUID BlockEnd;
+    }
+
+    public class AuthenticateResponse
+    {
+        public bool Authorised;
+        public Login LoginInfo;
+
+        public AuthenticateResponse()
+        {
+
+        }
+
+    }
+
+    public interface IGridPlugin
+    {
+        IGridServer GetGridServer();
+    }
+}

+ 54 - 0
Common/OpenSim.Framework/Interfaces/ILocalStorage.cs

@@ -0,0 +1,54 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+using System;
+using libsecondlife;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// ILocalStorage. Really hacked together right now needs cleaning up
+    /// </summary>
+    public interface ILocalStorage
+    {
+        void Initialise(string datastore);
+        void StorePrim(PrimData prim);
+        void RemovePrim(LLUUID primID);
+        void LoadPrimitives(ILocalStorageReceiver receiver);
+        float[] LoadWorld();
+        void SaveMap(float[] heightmap);
+        void ShutDown();
+    }
+
+    public interface ILocalStorageReceiver
+    {
+        void PrimFromStorage(PrimData prim);
+    }
+
+}
+

+ 14 - 0
Common/OpenSim.Framework/Interfaces/IScriptAPI.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public interface IScriptAPI
+    {
+        OSVector3 GetEntityPosition(uint localID);
+        void SetEntityPosition(uint localID, float x, float y, float z);
+        uint GetRandomAvatarID();
+    }
+}

+ 14 - 0
Common/OpenSim.Framework/Interfaces/IScriptEngine.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public interface IScriptEngine
+    {
+        bool Init(IScriptAPI api);
+        string GetName();
+        void LoadScript(string script, string scriptName, uint entityID);
+        void OnFrame();
+    }
+}

+ 58 - 0
Common/OpenSim.Framework/Interfaces/IUserConfig.cs

@@ -0,0 +1,58 @@
+/*
+Copyright (c) OpenSim project, http://osgrid.org/
+
+* Copyright (c) <year>, <copyright holder>
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using libsecondlife;
+//using OpenSim.world;
+
+namespace OpenSim.Framework.Interfaces
+{
+    /// <summary>
+    /// </summary>
+
+
+    public abstract class UserConfig
+    {
+        public string DefaultStartupMsg;
+        public string GridServerURL;
+        public string GridSendKey;
+        public string GridRecvKey;
+
+
+        public abstract void InitConfig();
+
+    }
+
+    public interface IUserConfig
+    {
+        UserConfig GetConfigObject();
+    }
+}

+ 15 - 0
Common/OpenSim.Framework/Interfaces/IUserServer.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenSim.Framework.Inventory;
+using libsecondlife;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public interface IUserServer
+    {
+        AgentInventory RequestAgentsInventory(LLUUID agentID);
+        void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
+        bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory);
+    }
+}

+ 24 - 0
Common/OpenSim.Framework/Interfaces/LocalGridBase.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using OpenSim.Framework.Types;
+using System.Collections;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public abstract class LocalGridBase : IGridServer
+    {
+        public abstract UUIDBlock RequestUUIDBlock();
+        public abstract NeighbourInfo[] RequestNeighbours();
+        public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        public abstract string GetName();
+        public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
+        public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
+        public abstract void AddNewSession(Login session);
+        public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
+        public abstract void Close();
+    }
+
+}

+ 37 - 0
Common/OpenSim.Framework/Interfaces/RemoteGridBase.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Framework.Interfaces
+{
+    public abstract class RemoteGridBase : IGridServer
+    {
+        public abstract Dictionary<uint, AgentCircuitData> agentcircuits
+        {
+            get;
+            set;
+        }
+
+        public abstract UUIDBlock RequestUUIDBlock();
+        public abstract NeighbourInfo[] RequestNeighbours();
+        public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
+        public abstract string GetName();
+        public abstract bool RequestConnection(LLUUID SimUUID, string sim_ip, uint sim_port);
+        public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
+        public abstract IList RequestMapBlocks(int minX, int minY, int maxX, int maxY);
+        public abstract void Close();
+	public abstract Hashtable GridData {
+		get;
+		set;
+	}
+
+	public abstract ArrayList neighbours {
+		get;
+		set;
+	}
+    }
+}

+ 14 - 0
Common/OpenSim.Framework/LoginService.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using Nwc.XmlRpc;
+using libsecondlife;
+
+namespace OpenSim.Framework.Grid
+{
+    public abstract class LoginService
+    {
+
+    }
+}

+ 194 - 0
Common/OpenSim.Framework/OpenSim.Framework.csproj

@@ -0,0 +1,194 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{8ACA2445-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenSim.Framework</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenSim.Framework</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="libsecondlife.dll" >
+      <HintPath>..\..\bin\libsecondlife.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Db4objects.Db4o.dll" >
+      <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
+      <Name>XMLRPC</Name>
+      <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AgentInventory.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="BlockingQueue.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="HeightMapGenHills.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="LoginService.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Remoting.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SimProfile.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SimProfileBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="UserProfile.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="UserProfileManager.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="UserProfileManagerBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Util.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IAssetServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IClientAPI.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IGenericConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IGridConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IGridServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\ILocalStorage.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IScriptAPI.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IScriptEngine.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IUserConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\IUserServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\LocalGridBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Interfaces\RemoteGridBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\AgentCiruitData.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\AssetBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\AssetLandmark.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\AssetStorage.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\Login.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\NeighbourInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\OSVector3.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Types\PrimData.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
Common/OpenSim.Framework/OpenSim.Framework.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 75 - 0
Common/OpenSim.Framework/OpenSim.Framework.dll.build

@@ -0,0 +1,75 @@
+<?xml version="1.0" ?>
+<project name="OpenSim.Framework" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenSim.Framework" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="AgentInventory.cs" />
+                <include name="BlockingQueue.cs" />
+                <include name="HeightMapGenHills.cs" />
+                <include name="LoginService.cs" />
+                <include name="Remoting.cs" />
+                <include name="SimProfile.cs" />
+                <include name="SimProfileBase.cs" />
+                <include name="UserProfile.cs" />
+                <include name="UserProfileManager.cs" />
+                <include name="UserProfileManagerBase.cs" />
+                <include name="Util.cs" />
+                <include name="Interfaces/IAssetServer.cs" />
+                <include name="Interfaces/IClientAPI.cs" />
+                <include name="Interfaces/IConfig.cs" />
+                <include name="Interfaces/IGenericConfig.cs" />
+                <include name="Interfaces/IGridConfig.cs" />
+                <include name="Interfaces/IGridServer.cs" />
+                <include name="Interfaces/ILocalStorage.cs" />
+                <include name="Interfaces/IScriptAPI.cs" />
+                <include name="Interfaces/IScriptEngine.cs" />
+                <include name="Interfaces/IUserConfig.cs" />
+                <include name="Interfaces/IUserServer.cs" />
+                <include name="Interfaces/LocalGridBase.cs" />
+                <include name="Interfaces/RemoteGridBase.cs" />
+                <include name="Properties/AssemblyInfo.cs" />
+                <include name="Types/AgentCiruitData.cs" />
+                <include name="Types/AssetBase.cs" />
+                <include name="Types/AssetLandmark.cs" />
+                <include name="Types/AssetStorage.cs" />
+                <include name="Types/Login.cs" />
+                <include name="Types/NeighbourInfo.cs" />
+                <include name="Types/OSVector3.cs" />
+                <include name="Types/PrimData.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Xml.dll" />
+                <include name="../../bin/libsecondlife.dll" />
+                <include name="../../bin/Db4objects.Db4o.dll" />
+                <include name="../../bin/XMLRPC.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 33 - 0
Common/OpenSim.Framework/Properties/AssemblyInfo.cs

@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenSim.FrameWork")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OpenSim.FrameWork")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 109 - 0
Common/OpenSim.Framework/Remoting.cs

@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace OpenSim.Framework
+{
+    /// <summary>
+    /// NEEDS AUDIT.
+    /// </summary>
+    /// <remarks>
+    /// Suggested implementation
+    /// <para>Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.</para>
+    /// <para>When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.</para>
+    /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
+    /// <para>Both hosts should be performing these operations for this to be effective.</para>
+    /// </remarks>
+    class RemoteDigest
+    {
+        private byte[] currentHash;
+        private byte[] secret;
+
+        private SHA512Managed SHA512;
+
+        /// <summary>
+        /// Initialises a new RemoteDigest authentication mechanism
+        /// </summary>
+        /// <remarks>Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting</remarks>
+        /// <param name="sharedSecret">The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)</param>
+        /// <param name="salt">Binary salt - some common value - to be decided what</param>
+        /// <param name="challenge">The challenge key provided by the third party</param>
+        public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
+        {
+            SHA512 = new SHA512Managed();
+            Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt);
+            secret = RFC2898.GetBytes(512);
+            ASCIIEncoding ASCII = new ASCIIEncoding();
+
+            currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
+        }
+
+        /// <summary>
+        /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
+        /// </summary>
+        /// <param name="data">The incoming data</param>
+        /// <param name="digest">The remote digest</param>
+        /// <returns></returns>
+        public bool Authenticate(byte[] data, byte[] digest)
+        {
+            byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
+            if (digest == newHash)
+            {
+                currentHash = newHash;
+                return true;
+            }
+            else
+            {
+                throw new Exception("Hash comparison failed. Key resync required.");
+            }
+        }
+
+        /// <summary>
+        /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
+        /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the 
+        /// hashes will get out of sync and throw an exception when validation is attempted.
+        /// </summary>
+        /// <param name="data">The outgoing data</param>
+        /// <returns>The local digest</returns>
+        public byte[] Sign(byte[] data)
+        {
+            currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
+            return currentHash;
+        }
+
+        /// <summary>
+        /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
+        /// </summary>
+        /// <returns>A 128-character hexadecimal string containing the challenge.</returns>
+        public static string GenerateChallenge()
+        {
+            RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
+            byte[] bytes = new byte[64];
+            RNG.GetBytes(bytes);
+
+            StringBuilder sb = new StringBuilder(bytes.Length * 2);
+            foreach (byte b in bytes)
+            {
+                sb.AppendFormat("{0:x2}", b);
+            }
+            return sb.ToString();
+        }
+
+        /// <summary>
+        /// Helper function, merges two byte arrays
+        /// </summary>
+        /// <remarks>Sourced from MSDN Forum</remarks>
+        /// <param name="a">A</param>
+        /// <param name="b">B</param>
+        /// <returns>C</returns>
+        private byte[] AppendArrays(byte[] a, byte[] b)
+        {
+            byte[] c = new byte[a.Length + b.Length];
+            Buffer.BlockCopy(a, 0, c, 0, a.Length);
+            Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
+            return c;
+        }
+
+    }
+}

+ 83 - 0
Common/OpenSim.Framework/SimProfile.cs

@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Xml;
+using System.Text;
+using libsecondlife;
+using Nwc.XmlRpc;
+
+namespace OpenSim.Framework.Sims
+{
+    public class SimProfile : SimProfileBase
+    {
+        public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
+        {
+            try
+            {
+                Hashtable GridReqParams = new Hashtable();
+                GridReqParams["region_handle"] = region_handle.ToString();
+                GridReqParams["authkey"] = SendKey;
+                ArrayList SendParams = new ArrayList();
+                SendParams.Add(GridReqParams);
+                XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
+
+                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
+
+                Hashtable RespData = (Hashtable)GridResp.Value;
+                this.UUID = new LLUUID((string)RespData["UUID"]);
+                this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
+                this.regionname = (string)RespData["regionname"];
+                this.sim_ip = (string)RespData["sim_ip"];
+                this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
+                this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
+                this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
+                this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
+                this.sendkey = SendKey;
+                this.recvkey = RecvKey;
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+            return this;
+        }
+
+        public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
+        {
+            try
+            {
+                Hashtable GridReqParams = new Hashtable();
+                GridReqParams["UUID"] = UUID.ToString();
+                GridReqParams["authkey"] = SendKey;
+                ArrayList SendParams = new ArrayList();
+                SendParams.Add(GridReqParams);
+                XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
+
+                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
+
+                Hashtable RespData = (Hashtable)GridResp.Value;
+                this.UUID = new LLUUID((string)RespData["UUID"]);
+                this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
+                this.regionname = (string)RespData["regionname"];
+                this.sim_ip = (string)RespData["sim_ip"];
+                this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
+                this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
+                this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
+                this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
+                this.sendkey = SendKey;
+                this.recvkey = RecvKey;
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+            return this;
+        }
+
+
+        public SimProfile()
+        {
+        }
+    }
+
+}

+ 27 - 0
Common/OpenSim.Framework/SimProfileBase.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Sims
+{
+    [System.Obsolete("Depreciated, use SimProfileData instead")]
+    public class SimProfileBase
+    {
+        public LLUUID UUID;
+        public ulong regionhandle;
+        public string regionname;
+        public string sim_ip;
+        public uint sim_port;
+        public string caps_url;
+        public uint RegionLocX;
+        public uint RegionLocY;
+        public string sendkey;
+        public string recvkey;
+	    public bool online;
+
+        public SimProfileBase()
+        {
+        }
+    }
+}

+ 22 - 0
Common/OpenSim.Framework/Types/AgentCiruitData.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+    public class AgentCircuitData
+    {
+        public AgentCircuitData() { }
+        public LLUUID AgentID;
+        public LLUUID SessionID;
+        public LLUUID SecureSessionID;
+        public LLVector3 startpos;
+        public string firstname;
+        public string lastname;
+        public uint circuitcode;
+        public bool child;
+        public LLUUID InventoryFolder;
+        public LLUUID BaseFolder;
+    }
+}

+ 22 - 0
Common/OpenSim.Framework/Types/AssetBase.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+    public class AssetBase
+    {
+        public byte[] Data;
+        public LLUUID FullID;
+        public sbyte Type;
+        public sbyte InvType;
+        public string Name;
+        public string Description;
+
+        public AssetBase()
+        {
+
+        }
+    }
+}

+ 34 - 0
Common/OpenSim.Framework/Types/AssetLandmark.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+    public class AssetLandmark : AssetBase
+    {
+        public int Version;
+        public LLVector3 Position;
+        public LLUUID RegionID;
+
+        public AssetLandmark(AssetBase a)
+        {
+            this.Data = a.Data;
+            this.FullID = a.FullID;
+            this.Type = a.Type;
+            this.InvType = a.InvType;
+            this.Name = a.Name;
+            this.Description = a.Description;
+            InternData();
+        }
+
+        private void InternData()
+        {
+            string temp = System.Text.Encoding.UTF8.GetString(Data).Trim(); 
+            string[] parts = temp.Split('\n');
+            int.TryParse(parts[0].Substring(17, 1), out Version);
+            LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
+            LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
+        }
+    }
+}

+ 23 - 0
Common/OpenSim.Framework/Types/AssetStorage.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+	public class AssetStorage
+	{
+
+		public AssetStorage() {
+		}
+
+		public AssetStorage(LLUUID assetUUID) {
+			UUID=assetUUID;
+		}
+
+		public byte[] Data;
+		public sbyte Type;
+		public string Name;
+		public LLUUID UUID;
+	}
+}

+ 24 - 0
Common/OpenSim.Framework/Types/Login.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+    public class Login
+    {
+        public string First = "Test";
+        public string Last = "User";
+        public LLUUID Agent;
+        public LLUUID Session;
+        public LLUUID SecureSession = LLUUID.Zero;
+        public LLUUID InventoryFolder;
+        public LLUUID BaseFolder;
+        public uint CircuitCode;
+
+        public Login()
+        {
+
+        }
+    }
+}

+ 19 - 0
Common/OpenSim.Framework/Types/NeighbourInfo.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Types
+{
+    public class NeighbourInfo
+    {
+        public NeighbourInfo()
+        {
+        }
+
+        public ulong regionhandle;
+        public uint RegionLocX;
+        public uint RegionLocY;
+        public string sim_ip;
+        public uint sim_port;
+    }
+}

+ 18 - 0
Common/OpenSim.Framework/Types/OSVector3.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework.Types
+{
+    public class OSVector3
+    {
+        public float X;
+        public float Y;
+        public float Z;
+
+        public OSVector3()
+        {
+
+        }
+    }
+}

+ 173 - 0
Common/OpenSim.Framework/Types/PrimData.cs

@@ -0,0 +1,173 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework.Types
+{
+    public class PrimData
+    {
+        private const uint FULL_MASK_PERMISSIONS = 2147483647;
+
+        public LLUUID OwnerID;
+        public byte PCode;
+        public ushort PathBegin;
+        public ushort PathEnd;
+        public byte PathScaleX;
+        public byte PathScaleY;
+        public byte PathShearX;
+        public byte PathShearY;
+        public sbyte PathSkew;
+        public ushort ProfileBegin;
+        public ushort ProfileEnd;
+        public LLVector3 Scale;
+        public byte PathCurve;
+        public byte ProfileCurve;
+        public uint ParentID = 0;
+        public ushort ProfileHollow;
+        public sbyte PathRadiusOffset;
+        public byte PathRevolutions;
+        public sbyte PathTaperX;
+        public sbyte PathTaperY;
+        public sbyte PathTwist;
+        public sbyte PathTwistBegin;
+        public byte[] Texture;
+       
+
+        public Int32 CreationDate;
+        public uint OwnerMask = FULL_MASK_PERMISSIONS;
+        public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
+        public uint GroupMask = FULL_MASK_PERMISSIONS;
+        public uint EveryoneMask = FULL_MASK_PERMISSIONS;
+        public uint BaseMask = FULL_MASK_PERMISSIONS;
+
+        //following only used during prim storage
+        public LLVector3 Position;
+        public LLQuaternion Rotation = new LLQuaternion(0,1,0,0);
+        public uint LocalID;
+        public LLUUID FullID;
+
+        public PrimData()
+        {
+
+        }
+
+        public PrimData(byte[] data)
+        {
+            int i =0;
+
+            this.OwnerID = new LLUUID(data, i); i += 16;
+            this.PCode = data[i++];
+            this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
+            this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
+            this.PathScaleX = data[i++];
+            this.PathScaleY = data[i++];
+            this.PathShearX = data[i++];
+            this.PathShearY = data[i++];
+            this.PathSkew = (sbyte)data[i++];
+            this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
+            this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
+            this.Scale = new LLVector3(data, i); i += 12;
+            this.PathCurve = data[i++];
+            this.ProfileCurve = data[i++];
+            this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
+            this.PathRadiusOffset = (sbyte)data[i++];
+            this.PathRevolutions = data[i++];
+            this.PathTaperX = (sbyte)data[i++];
+            this.PathTaperY =(sbyte) data[i++];
+            this.PathTwist = (sbyte) data[i++];
+            this.PathTwistBegin = (sbyte) data[i++];
+            ushort length = (ushort)(data[i++] + (data[i++] << 8));
+            this.Texture = new byte[length];
+            Array.Copy(data, i, Texture, 0, length); i += length;
+            this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.Position = new LLVector3(data, i); i += 12;
+            this.Rotation = new LLQuaternion(data,i, true); i += 12;
+            this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
+            this.FullID = new LLUUID(data, i); i += 16;
+
+        }
+
+        public byte[] ToBytes()
+        {
+            int i = 0;
+            byte[] bytes = new byte[126 + Texture.Length];
+            Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
+            bytes[i++] = this.PCode;
+            bytes[i++] = (byte)(this.PathBegin % 256);
+            bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
+            bytes[i++] = (byte)(this.PathEnd % 256);
+            bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
+            bytes[i++] = this.PathScaleX;
+            bytes[i++] = this.PathScaleY;
+            bytes[i++] = this.PathShearX;
+            bytes[i++] = this.PathShearY;
+            bytes[i++] = (byte)this.PathSkew;
+            bytes[i++] = (byte)(this.ProfileBegin % 256);
+            bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
+            bytes[i++] = (byte)(this.ProfileEnd % 256);
+            bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
+            Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
+            bytes[i++] = this.PathCurve;
+            bytes[i++] = this.ProfileCurve;
+            bytes[i++] = (byte)(ParentID % 256);
+            bytes[i++] = (byte)((ParentID >> 8) % 256);
+            bytes[i++] = (byte)((ParentID >> 16) % 256);
+            bytes[i++] = (byte)((ParentID >> 24) % 256);
+            bytes[i++] = (byte)(this.ProfileHollow %256);
+            bytes[i++] = (byte)((this.ProfileHollow >> 8)% 256);
+            bytes[i++] = ((byte)this.PathRadiusOffset);
+            bytes[i++] = this.PathRevolutions;
+            bytes[i++] = ((byte) this.PathTaperX);
+            bytes[i++] = ((byte) this.PathTaperY);
+            bytes[i++] = ((byte) this.PathTwist);
+            bytes[i++] = ((byte) this.PathTwistBegin);
+            bytes[i++] = (byte)(Texture.Length % 256);
+            bytes[i++] = (byte)((Texture.Length >> 8) % 256);
+            Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
+            bytes[i++] = (byte)(this.CreationDate % 256);
+            bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
+            bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
+            bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
+            bytes[i++] = (byte)(this.OwnerMask % 256);
+            bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
+            bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
+            bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
+            bytes[i++] = (byte)(this.NextOwnerMask % 256);
+            bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
+            bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
+            bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
+            bytes[i++] = (byte)(this.GroupMask % 256);
+            bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
+            bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
+            bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
+            bytes[i++] = (byte)(this.EveryoneMask % 256);
+            bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
+            bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
+            bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
+            bytes[i++] = (byte)(this.BaseMask % 256);
+            bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
+            bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
+            bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
+            Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
+            if (this.Rotation == new LLQuaternion(0,0,0,0))
+            {
+                this.Rotation = new LLQuaternion(0, 1, 0, 0);
+            }
+            Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
+            bytes[i++] = (byte)(this.LocalID % 256);
+            bytes[i++] = (byte)((this.LocalID >> 8) % 256);
+            bytes[i++] = (byte)((this.LocalID >> 16) % 256);
+            bytes[i++] = (byte)((this.LocalID >> 24) % 256);
+            Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
+
+            return bytes;
+        }
+    }
+}

+ 62 - 0
Common/OpenSim.Framework/UserProfile.cs

@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using OpenSim.Framework.Inventory;
+using System.Security.Cryptography;
+
+namespace OpenSim.Framework.User
+{
+    public class UserProfile
+    {
+
+        public string firstname;
+        public string lastname;
+        public ulong homeregionhandle;
+        public LLVector3 homepos;
+        public LLVector3 homelookat;
+
+        public bool IsGridGod = false;
+        public bool IsLocal = true;	// will be used in future for visitors from foreign grids
+        public string AssetURL;
+        public string MD5passwd;
+
+        public LLUUID CurrentSessionID;
+        public LLUUID CurrentSecureSessionID;
+        public LLUUID UUID;
+        public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>();	// tracks circuit codes
+
+        public AgentInventory Inventory;
+
+        public UserProfile()
+        {
+            Circuits = new Dictionary<LLUUID, uint>();
+            Inventory = new AgentInventory();
+            homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
+            homepos = new LLVector3();
+	    homelookat = new LLVector3();
+        }
+
+        public void InitSessionData()
+        {
+            RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
+
+            byte[] randDataS = new byte[16];
+            byte[] randDataSS = new byte[16];
+
+            rand.GetBytes(randDataS);
+            rand.GetBytes(randDataSS);
+
+            CurrentSecureSessionID = new LLUUID(randDataSS,0);
+            CurrentSessionID = new LLUUID(randDataS,0);
+            
+        }
+
+        public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
+        {
+            if (this.Circuits.ContainsKey(regionUUID) == false)
+                this.Circuits.Add(regionUUID, circuitCode);
+        }
+
+    }
+}

+ 272 - 0
Common/OpenSim.Framework/UserProfileManager.cs

@@ -0,0 +1,272 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using libsecondlife;
+using Nwc.XmlRpc;
+using OpenSim.Framework.Sims;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Utilities;
+
+namespace OpenSim.Framework.User
+{
+    public class UserProfileManager : UserProfileManagerBase
+    {
+        public string GridURL;
+        public string GridSendKey;
+        public string GridRecvKey;
+        public string DefaultStartupMsg;
+
+        public UserProfileManager()
+        {
+
+        }
+
+        public void SetKeys(string sendKey, string recvKey, string url, string message)
+        {
+            GridRecvKey = recvKey;
+            GridSendKey = sendKey;
+            GridURL = url;
+            DefaultStartupMsg = message;
+        }
+
+        public virtual string ParseXMLRPC(string requestBody)
+        {
+
+            XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
+
+            switch (request.MethodName)
+            {
+                case "login_to_simulator":
+                    XmlRpcResponse response = XmlRpcLoginMethod(request);
+
+                    return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(response), "utf-16", "utf-8"));
+            }
+
+            return "";
+        }
+
+        public string RestDeleteUserSessionMethod( string request, string path, string param )
+        {
+            LLUUID sessionid = new LLUUID(param);	// get usersessions/sessionid
+            foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
+            {
+                if ( UserProfiles[UUID].CurrentSessionID == sessionid)
+                {
+                     UserProfiles[UUID].CurrentSessionID = null;
+                     UserProfiles[UUID].CurrentSecureSessionID = null;
+                     UserProfiles[UUID].Circuits.Clear();
+                }
+            }
+
+            return "OK";
+        }
+
+        public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
+        {
+            XmlRpcResponse response = new XmlRpcResponse();
+            Hashtable requestData = (Hashtable)request.Params[0];
+
+            bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
+            bool GoodLogin = false;
+            string firstname = "";
+            string lastname = "";
+            string passwd = "";
+
+            if (GoodXML)
+            {
+                firstname = (string)requestData["first"];
+                lastname = (string)requestData["last"];
+                passwd = (string)requestData["passwd"];
+                GoodLogin = AuthenticateUser(firstname, lastname, passwd);
+            }
+
+
+            if (!(GoodXML && GoodLogin))
+            {
+                response = CreateErrorConnectingToGridResponse();
+            }
+            else
+            {
+                UserProfile TheUser = GetProfileByName(firstname, lastname);
+                //we need to sort out how sessions are logged out , currently the sim tells the gridserver
+                //but if as this suggests the userserver handles it then please have the sim telling the userserver instead
+                //as it really makes things messy for sandbox mode
+                //if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
+                // {
+                //   response = CreateAlreadyLoggedInResponse();
+                // }
+                //else
+                //{
+                try
+                {
+                    Hashtable responseData = new Hashtable();
+
+                    LLUUID AgentID = TheUser.UUID;
+                    TheUser.InitSessionData();
+
+                    //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method)
+                   //SimProfile SimInfo = new SimProfile();
+                    //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
+
+
+                    Hashtable GlobalT = new Hashtable();
+                    GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
+                    GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
+                    GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
+                    ArrayList GlobalTextures = new ArrayList();
+                    GlobalTextures.Add(GlobalT);
+
+                    Hashtable LoginFlagsHash = new Hashtable();
+                    LoginFlagsHash["daylight_savings"] = "N";
+                    LoginFlagsHash["stipend_since_login"] = "N";
+                    LoginFlagsHash["gendered"] = "Y";
+                    LoginFlagsHash["ever_logged_in"] = "Y";
+                    ArrayList LoginFlags = new ArrayList();
+                    LoginFlags.Add(LoginFlagsHash);
+
+                    Hashtable uiconfig = new Hashtable();
+                    uiconfig["allow_first_life"] = "Y";
+                    ArrayList ui_config = new ArrayList();
+                    ui_config.Add(uiconfig);
+
+                    Hashtable ClassifiedCategoriesHash = new Hashtable();
+                    ClassifiedCategoriesHash["category_name"] = "bla bla";
+                    ClassifiedCategoriesHash["category_id"] = (Int32)1;
+                    ArrayList ClassifiedCategories = new ArrayList();
+                    ClassifiedCategories.Add(ClassifiedCategoriesHash);
+
+		    ArrayList AgentInventory = new ArrayList();
+                    Console.WriteLine("adding inventory to response");
+		    Hashtable TempHash;
+                    foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
+                    {
+                        TempHash = new Hashtable();
+                        Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); 
+                        TempHash["name"] = InvFolder.FolderName;
+                        TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
+                        TempHash["version"] = (Int32)InvFolder.Version;
+                        TempHash["type_default"] = (Int32)InvFolder.DefaultType;
+                        TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
+                        AgentInventory.Add(TempHash);
+                    }
+
+                    Hashtable InventoryRootHash = new Hashtable();
+                    InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
+                    ArrayList InventoryRoot = new ArrayList();
+                    InventoryRoot.Add(InventoryRootHash);
+
+                    Hashtable InitialOutfitHash = new Hashtable();
+                    InitialOutfitHash["folder_name"] = "Nightclub Female";
+                    InitialOutfitHash["gender"] = "female";
+                    ArrayList InitialOutfit = new ArrayList();
+                    InitialOutfit.Add(InitialOutfitHash);
+
+                    uint circode = (uint)(Util.RandomClass.Next());
+                    //TheUser.AddSimCircuit(circode, SimInfo.UUID);
+
+                    responseData["last_name"] = TheUser.lastname;
+                    responseData["ui-config"] = ui_config;
+                    responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
+                    responseData["login-flags"] = LoginFlags;
+                    responseData["global-textures"] = GlobalTextures;
+                    responseData["classified_categories"] = ClassifiedCategories;
+                    responseData["event_categories"] = new ArrayList();
+                    responseData["inventory-skeleton"] = AgentInventory;
+                    responseData["inventory-skel-lib"] = new ArrayList();
+                    responseData["inventory-root"] = InventoryRoot;
+                    responseData["event_notifications"] = new ArrayList();
+                    responseData["gestures"] = new ArrayList();
+                    responseData["inventory-lib-owner"] = new ArrayList();
+                    responseData["initial-outfit"] = InitialOutfit;
+                    responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
+                    responseData["start_location"] = "last";
+                    responseData["home"] = "{'region_handle':[r" + (0 * 256).ToString() + ",r" + (0 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
+                    responseData["message"] = DefaultStartupMsg;
+                    responseData["first_name"] = TheUser.firstname;
+                    responseData["circuit_code"] = (Int32)circode;
+                    responseData["sim_port"] = 0; //(Int32)SimInfo.sim_port;
+                    responseData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
+                    responseData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
+                    responseData["agent_id"] = AgentID.ToStringHyphenated();
+                    responseData["region_y"] = (Int32)0 * 256; // (Int32)SimInfo.RegionLocY * 256;
+                    responseData["region_x"] = (Int32)0 * 256;  //SimInfo.RegionLocX * 256;
+                    responseData["seed_capability"] = "";
+                    responseData["agent_access"] = "M";
+                    responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
+                    responseData["login"] = "true";
+
+                    this.CustomiseResponse(ref responseData, TheUser);
+                    response.Value = responseData;
+ //                   TheUser.SendDataToSim(SimInfo);
+		    return response;
+
+                }
+                catch (Exception E)
+                {
+                    Console.WriteLine(E.ToString());
+                }
+                //}
+            }
+            return response;
+
+        }
+
+        private static XmlRpcResponse CreateErrorConnectingToGridResponse()
+        {
+            XmlRpcResponse response = new XmlRpcResponse();
+            Hashtable ErrorRespData = new Hashtable();
+            ErrorRespData["reason"] = "key";
+            ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
+            ErrorRespData["login"] = "false";
+            response.Value = ErrorRespData;
+            return response;
+        }
+
+        private static XmlRpcResponse CreateAlreadyLoggedInResponse()
+        {
+            XmlRpcResponse response = new XmlRpcResponse();
+            Hashtable PresenceErrorRespData = new Hashtable();
+            PresenceErrorRespData["reason"] = "presence";
+            PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
+            PresenceErrorRespData["login"] = "false";
+            response.Value = PresenceErrorRespData;
+            return response;
+        }
+
+        public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
+        {
+            //default method set up to act as ogs user server
+            SimProfile SimInfo= new SimProfile();
+            //get siminfo from grid server
+            SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
+            Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]);
+            theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
+            response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
+            response["sim_ip"] = SimInfo.sim_ip;
+            response["sim_port"] = (Int32)SimInfo.sim_port;
+            response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
+            response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
+
+            //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
+            Console.WriteLine(SimInfo.caps_url);
+            Hashtable SimParams = new Hashtable();
+            SimParams["session_id"] = theUser.CurrentSessionID.ToString();
+            SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
+            SimParams["firstname"] = theUser.firstname;
+            SimParams["lastname"] = theUser.lastname;
+            SimParams["agent_id"] = theUser.UUID.ToString();
+            SimParams["circuit_code"] = (Int32)circode;
+	        SimParams["startpos_x"] = theUser.homepos.X.ToString();
+	        SimParams["startpos_y"] = theUser.homepos.Y.ToString();
+	        SimParams["startpos_z"] = theUser.homepos.Z.ToString();
+            ArrayList SendParams = new ArrayList();
+            SendParams.Add(SimParams);
+
+            XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
+            XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
+        }
+    }
+}

+ 124 - 0
Common/OpenSim.Framework/UserProfileManagerBase.cs

@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using OpenSim.Framework.Utilities;
+using OpenSim.Framework.Inventory;
+using Db4objects.Db4o;
+
+namespace OpenSim.Framework.User
+{
+    public class UserProfileManagerBase
+    {
+
+        public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
+
+        public UserProfileManagerBase()
+        {
+        }
+
+        public virtual void InitUserProfiles()
+        {
+            IObjectContainer db;
+            db = Db4oFactory.OpenFile("userprofiles.yap");
+            IObjectSet result = db.Get(typeof(UserProfile));
+            foreach (UserProfile userprof in result)
+            {
+                UserProfiles.Add(userprof.UUID, userprof);
+            }
+            Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
+            db.Close();
+        }
+
+        public virtual void SaveUserProfiles()		// ZOMG! INEFFICIENT!
+        {
+            IObjectContainer db;
+            db = Db4oFactory.OpenFile("userprofiles.yap");
+            IObjectSet result = db.Get(typeof(UserProfile));
+            foreach (UserProfile userprof in result)
+            {
+                db.Delete(userprof);
+                db.Commit();
+            }
+            foreach (UserProfile userprof in UserProfiles.Values)
+            {
+                db.Set(userprof);
+                db.Commit();
+            }
+            db.Close();
+        }
+
+        public UserProfile GetProfileByName(string firstname, string lastname)
+        {
+            foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
+            {
+                if (UserProfiles[UUID].firstname.Equals(firstname)) if (UserProfiles[UUID].lastname.Equals(lastname))
+                {
+                    return UserProfiles[UUID];
+                }
+            }
+            return null;
+        }
+
+        public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
+        {
+            return UserProfiles[ProfileLLUUID];
+        }
+
+        public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
+        {
+            UserProfile TheUser = GetProfileByName(firstname, lastname);
+            passwd = passwd.Remove(0, 3); //remove $1$
+            if (TheUser != null)
+            {
+                if (TheUser.MD5passwd == passwd)
+                {
+                    Console.WriteLine("UserProfile - authorised " + firstname + " " + lastname);
+                    return true;
+                }
+                else
+                {
+                    Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd);
+                    return false;
+                }
+            }
+            else
+            {
+                Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname);
+                return false;
+            }
+
+        }
+
+        public void SetGod(LLUUID GodID)
+        {
+            this.UserProfiles[GodID].IsGridGod = true;
+        }
+
+        public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
+        {
+            Console.WriteLine("creating new profile for : " + firstname + " , " + lastname);
+            UserProfile newprofile = new UserProfile();
+            newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
+            newprofile.firstname = firstname;
+            newprofile.lastname = lastname;
+            newprofile.MD5passwd = MD5passwd;
+            newprofile.UUID = LLUUID.Random();
+	    newprofile.Inventory.CreateRootFolder(newprofile.UUID, true);
+            this.UserProfiles.Add(newprofile.UUID, newprofile);
+            return newprofile;
+        }
+
+        public virtual AgentInventory GetUsersInventory(LLUUID agentID)
+        {
+            UserProfile user = this.GetProfileByLLUUID(agentID);
+            if (user != null)
+            {
+                return user.Inventory;
+            }
+
+            return null;
+        }
+
+    }
+}

+ 151 - 0
Common/OpenSim.Framework/Util.cs

@@ -0,0 +1,151 @@
+using System;
+using System.Security.Cryptography;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using libsecondlife.Packets;
+
+namespace OpenSim.Framework.Utilities
+{
+    public class Util
+    {
+        private static Random randomClass = new Random();
+        private static uint nextXferID = 5000;
+        private static object XferLock = new object();
+
+        public static ulong UIntsToLong(uint X, uint Y)
+        {
+            return Helpers.UIntsToLong(X, Y);
+        }
+
+        public static Random RandomClass
+        {
+            get
+            {
+                return randomClass;
+            }
+        }
+
+        public static uint GetNextXferID()
+        {
+            uint id = 0;
+            lock(XferLock)
+            {
+                id = nextXferID;
+                nextXferID++;
+            }
+            return id;
+        }
+
+        public static int UnixTimeSinceEpoch()
+        {
+            TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
+            int timestamp = (int)t.TotalSeconds;
+            return timestamp;
+        }
+
+        public static string Md5Hash(string pass)
+        {
+            MD5 md5 = MD5CryptoServiceProvider.Create();
+            byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < dataMd5.Length; i++)
+                sb.AppendFormat("{0:x2}", dataMd5[i]);
+            return sb.ToString();
+        }
+
+        //public static int fast_distance2d(int x, int y)
+        //{
+        //    x = System.Math.Abs(x);
+        //    y = System.Math.Abs(y);
+
+        //    int min = System.Math.Min(x, y);
+
+        //    return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
+        //}
+
+        public static string FieldToString(byte[] bytes)
+        {
+            return FieldToString(bytes, String.Empty);
+        }
+
+        /// <summary>
+        /// Convert a variable length field (byte array) to a string, with a
+        /// field name prepended to each line of the output
+        /// </summary>
+        /// <remarks>If the byte array has unprintable characters in it, a 
+        /// hex dump will be put in the string instead</remarks>
+        /// <param name="bytes">The byte array to convert to a string</param>
+        /// <param name="fieldName">A field name to prepend to each line of output</param>
+        /// <returns>An ASCII string or a string containing a hex dump, minus 
+        /// the null terminator</returns>
+        public static string FieldToString(byte[] bytes, string fieldName)
+        {
+            // Check for a common case
+            if (bytes.Length == 0) return String.Empty;
+
+            StringBuilder output = new StringBuilder();
+            bool printable = true;
+
+            for (int i = 0; i < bytes.Length; ++i)
+            {
+                // Check if there are any unprintable characters in the array
+                if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
+                    && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
+                {
+                    printable = false;
+                    break;
+                }
+            }
+
+            if (printable)
+            {
+                if (fieldName.Length > 0)
+                {
+                    output.Append(fieldName);
+                    output.Append(": ");
+                }
+
+                if (bytes[bytes.Length - 1] == 0x00)
+                    output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
+                else
+                    output.Append(UTF8Encoding.UTF8.GetString(bytes));
+            }
+            else
+            {
+                for (int i = 0; i < bytes.Length; i += 16)
+                {
+                    if (i != 0)
+                        output.Append(Environment.NewLine);
+                    if (fieldName.Length > 0)
+                    {
+                        output.Append(fieldName);
+                        output.Append(": ");
+                    }
+
+                    for (int j = 0; j < 16; j++)
+                    {
+                        if ((i + j) < bytes.Length)
+                            output.Append(String.Format("{0:X2} ", bytes[i + j]));
+                        else
+                            output.Append("   ");
+                    }
+
+                    for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
+                    {
+                        if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
+                            output.Append((char)bytes[i + j]);
+                        else
+                            output.Append(".");
+                    }
+                }
+            }
+
+            return output.ToString();
+        }
+        public Util()
+        {
+
+        }
+    }
+}

+ 93 - 0
Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj

@@ -0,0 +1,93 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{E88EF749-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenSim.GenericConfig.Xml</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenSim.GenericConfig.Xml</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
+      <Name>OpenSim.Framework</Name>
+      <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="XmlConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 42 - 0
Common/OpenSim.GenericConfig/Xml/OpenSim.GenericConfig.Xml.dll.build

@@ -0,0 +1,42 @@
+<?xml version="1.0" ?>
+<project name="OpenSim.GenericConfig.Xml" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenSim.GenericConfig.Xml" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="XmlConfig.cs" />
+                <include name="Properties/AssemblyInfo.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Xml.dll" />
+                <include name="../../../bin/OpenSim.Framework.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 35 - 0
Common/OpenSim.GenericConfig/Xml/Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenSim.GenericConfig")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OpenSim.GenericConfig")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("285a3047-f165-46c8-8767-b51428738a09")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 109 - 0
Common/OpenSim.GenericConfig/Xml/XmlConfig.cs

@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OpenSim.Framework.Interfaces;
+
+namespace OpenSim.GenericConfig
+{
+    public class XmlConfig : IGenericConfig
+    {
+        private XmlDocument doc;
+        private XmlNode rootNode;
+        private XmlNode configNode;
+        private string fileName;
+        private bool createdFile = false;
+
+        public XmlConfig(string filename)
+        {
+            fileName = filename;
+        }
+
+        public void LoadData()
+        {
+            doc = new XmlDocument();
+            try
+            {
+                if (System.IO.File.Exists(fileName))
+                {
+                    XmlTextReader reader = new XmlTextReader(fileName);
+                    reader.WhitespaceHandling = WhitespaceHandling.None;
+                    doc.Load(reader);
+                    reader.Close();
+                }
+                else
+                {
+                    createdFile = true;
+                    rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
+                    doc.AppendChild(rootNode);
+                    configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
+                    rootNode.AppendChild(configNode);
+                }
+
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.Message);
+                return;
+            }
+            try
+            {
+                rootNode = doc.FirstChild;
+                if (rootNode.Name != "Root")
+                    throw new Exception("Error: Invalid .xml File. Missing <Root>");
+
+                configNode = rootNode.FirstChild;
+                if (configNode.Name != "Config")
+                    throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
+                
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.Message);
+            }
+            if (createdFile)
+            {
+                this.Commit();
+            }
+        }
+
+        public string GetAttribute(string attributeName)
+        {
+            string result = "";
+            if (configNode.Attributes[attributeName] != null)
+            {
+                result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value;
+            }
+            return result;
+        }
+
+        public bool SetAttribute(string attributeName, string attributeValue)
+        {
+            if (configNode.Attributes[attributeName] != null)
+            {
+                 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
+            }
+            else
+            {
+                XmlAttribute attri;
+                attri = doc.CreateAttribute(attributeName);
+                attri.Value = attributeValue;
+                configNode.Attributes.Append(attri);
+            }
+            return true;
+        }
+
+        public void Commit()
+        {
+            doc.Save(fileName);
+        }
+
+        public void Close()
+        {
+            configNode = null;
+            rootNode = null;
+            doc = null;
+        }
+                             
+    }
+}

+ 256 - 0
Common/OpenSim.Servers/BaseHttpServer.cs

@@ -0,0 +1,256 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+//using OpenSim.CAPS;
+using Nwc.XmlRpc;
+using System.Collections;
+using OpenSim.Framework.Console;
+
+namespace OpenSim.Servers
+{
+    public class BaseHttpServer
+    {
+        protected class RestMethodEntry
+        {
+            private string m_path;
+            public string Path
+            {
+                get { return m_path; }
+            }
+
+            private RestMethod m_restMethod;
+            public RestMethod RestMethod
+            {
+                get { return m_restMethod; }
+            }
+
+            public RestMethodEntry(string path, RestMethod restMethod)
+            {
+                m_path = path;
+                m_restMethod = restMethod;
+            }
+        }
+
+        protected Thread m_workerThread;
+        protected HttpListener m_httpListener;
+        protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>();
+        protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
+        protected int m_port;
+
+        public BaseHttpServer(int port)
+        {
+            m_port = port;
+        }
+
+        public bool AddRestHandler(string method, string path, RestMethod handler)
+        {
+            string methodKey = String.Format("{0}: {1}", method, path);
+
+            if (!this.m_restHandlers.ContainsKey(methodKey))
+            {
+                this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler));
+                return true;
+            }
+
+            //must already have a handler for that path so return false
+            return false;
+        }
+
+        public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
+        {
+            if (!this.m_rpcHandlers.ContainsKey(method))
+            {
+                this.m_rpcHandlers.Add(method, handler);
+                return true;
+            }
+
+            //must already have a handler for that path so return false
+            return false;
+        }
+
+        protected virtual string ProcessXMLRPCMethod(string methodName, XmlRpcRequest request)
+        {
+            XmlRpcResponse response;
+
+            XmlRpcMethod method;
+            if (this.m_rpcHandlers.TryGetValue(methodName, out method))
+            {
+                response = method(request);
+            }
+            else
+            {
+                response = new XmlRpcResponse();
+                Hashtable unknownMethodError = new Hashtable();
+                unknownMethodError["reason"] = "XmlRequest"; ;
+                unknownMethodError["message"] = "Unknown Rpc request";
+                unknownMethodError["login"] = "false";
+                response.Value = unknownMethodError;
+            }
+
+            return XmlRpcResponseSerializer.Singleton.Serialize(response);
+        }
+
+        protected virtual string ParseREST(string request, string path, string method)
+        {
+            string response;
+
+            string requestKey = String.Format("{0}: {1}", method, path);
+
+            string bestMatch = String.Empty;
+            foreach (string currentKey in m_restHandlers.Keys)
+            {
+                if (requestKey.StartsWith(currentKey))
+                {
+                    if (currentKey.Length > bestMatch.Length)
+                    {
+                        bestMatch = currentKey;
+                    }
+                }
+            }
+
+            RestMethodEntry restMethodEntry;
+            if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry))
+            {
+                RestMethod restMethod = restMethodEntry.RestMethod;
+
+                string param = path.Substring(restMethodEntry.Path.Length);
+                response = restMethod(request, path, param);
+
+            }
+            else
+            {
+                response = String.Empty;
+            }
+
+            return response;
+        }
+
+        protected virtual string ParseLLSDXML(string requestBody)
+        {
+            // dummy function for now - IMPLEMENT ME!
+            return "";
+        }
+
+        protected virtual string ParseXMLRPC(string requestBody)
+        {
+            string responseString = String.Empty;
+
+            try
+            {
+                XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
+
+                string methodName = request.MethodName;
+
+                responseString = ProcessXMLRPCMethod(methodName, request);
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+            return responseString;
+        }
+
+        public virtual void HandleRequest(Object stateinfo)
+        {
+            try
+            {
+                HttpListenerContext context = (HttpListenerContext)stateinfo;
+
+                HttpListenerRequest request = context.Request;
+                HttpListenerResponse response = context.Response;
+
+                response.KeepAlive = false;
+                response.SendChunked = false;
+
+                System.IO.Stream body = request.InputStream;
+                System.Text.Encoding encoding = System.Text.Encoding.UTF8;
+                System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
+
+                string requestBody = reader.ReadToEnd();
+                body.Close();
+                reader.Close();
+
+                //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType);
+                //Console.WriteLine(requestBody);
+
+                string responseString = "";
+                switch (request.ContentType)
+                {
+                    case "text/xml":
+                        // must be XML-RPC, so pass to the XML-RPC parser
+
+                        responseString = ParseXMLRPC(requestBody);
+                        responseString = Regex.Replace(responseString, "utf-16", "utf-8");
+
+                        response.AddHeader("Content-type", "text/xml");
+                        break;
+
+                    case "application/xml":
+                        // probably LLSD we hope, otherwise it should be ignored by the parser
+                        responseString = ParseLLSDXML(requestBody);
+                        response.AddHeader("Content-type", "application/xml");
+                        break;
+
+                    case "application/x-www-form-urlencoded":
+                        // a form data POST so send to the REST parser
+                        responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
+                        response.AddHeader("Content-type", "text/html");
+                        break;
+
+                    case null:
+                        // must be REST or invalid crap, so pass to the REST parser
+                        responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
+                        response.AddHeader("Content-type", "text/html");
+                        break;
+
+                }
+
+                byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
+                System.IO.Stream output = response.OutputStream;
+                response.SendChunked = false;
+                response.ContentLength64 = buffer.Length;
+                output.Write(buffer, 0, buffer.Length);
+                output.Close();
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+        }
+
+        public void Start()
+        {
+            OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server");
+
+            m_workerThread = new Thread(new ThreadStart(StartHTTP));
+            m_workerThread.IsBackground = true;
+            m_workerThread.Start();
+        }
+
+        private void StartHTTP()
+        {
+            try
+            {
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK");
+                m_httpListener = new HttpListener();
+
+                m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
+                m_httpListener.Start();
+
+                HttpListenerContext context;
+                while (true)
+                {
+                    context = m_httpListener.GetContext();
+                    ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
+                }
+            }
+            catch (Exception e)
+            {
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM, e.Message);
+            }
+        }
+    }
+}

+ 10 - 0
Common/OpenSim.Servers/BaseServer.cs

@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Servers
+{
+    public class BaseServer
+    {
+    }
+}

+ 113 - 0
Common/OpenSim.Servers/CheckSumServer.cs

@@ -0,0 +1,113 @@
+using System;
+using System.Text;
+using System.IO;
+using System.Threading;
+using System.Net;
+using System.Net.Sockets;
+using System.Timers;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using libsecondlife;
+using libsecondlife.Packets;
+using OpenSim.Framework.Console;
+
+
+namespace OpenSim.Servers
+{
+    public class CheckSumServer : UDPServerBase
+    {
+        //protected ConsoleBase m_console;
+
+        public CheckSumServer(int port)
+            : base(port)
+        {
+        }
+
+        protected override void OnReceivedData(IAsyncResult result)
+        {
+            ipeSender = new IPEndPoint(IPAddress.Any, 0);
+            epSender = (EndPoint)ipeSender;
+            Packet packet = null;
+            int numBytes = Server.EndReceiveFrom(result, ref epSender);
+            int packetEnd = numBytes - 1;
+
+            packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
+
+            if (packet.Type == PacketType.SecuredTemplateChecksumRequest)
+            {
+                SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet;
+                TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket();
+                checkreply.DataBlock.Checksum = 3220703154;//180572585;
+                checkreply.DataBlock.Flags = 0;
+                checkreply.DataBlock.MajorVersion = 1;
+                checkreply.DataBlock.MinorVersion = 15;
+                checkreply.DataBlock.PatchVersion = 0;
+                checkreply.DataBlock.ServerVersion = 0;
+                checkreply.TokenBlock.Token = checksum.TokenBlock.Token;
+                this.SendPacket(checkreply, epSender);
+
+                /*
+                //if we wanted to echo the the checksum/ version from the client (so that any client worked)
+                SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket();
+                checkrequest.TokenBlock.Token = checksum.TokenBlock.Token;
+                this.SendPacket(checkrequest, epSender);
+                */
+            }
+            else if (packet.Type == PacketType.TemplateChecksumReply)
+            {
+                //echo back the client checksum reply (Hegemon's method)
+                TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet;
+                TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket();
+                checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum;
+                checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags;
+                checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion;
+                checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion;
+                checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion;
+                checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion;
+                checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token;
+                this.SendPacket(checkreply2, epSender);
+            }
+            else
+            {
+            }
+
+            Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
+        }
+
+        private void SendPacket(Packet Pack, EndPoint endp)
+        {
+            if (!Pack.Header.Resent)
+            {
+                Pack.Header.Sequence = 1;
+            }
+
+            byte[] ZeroOutBuffer = new byte[4096];
+            byte[] sendbuffer;
+            sendbuffer = Pack.ToBytes();
+
+            try
+            {
+                if (Pack.Header.Zerocoded)
+                {
+                    int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
+                    this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp);
+                }
+                else
+                {
+                    this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp);
+                }
+            }
+            catch (Exception)
+            {
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection ");
+
+            }
+        }
+
+        private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp)
+        {
+            this.Server.SendTo(buffer, size, flags, endp);
+        }
+    }
+}

+ 8 - 0
Common/OpenSim.Servers/IRestHandler.cs

@@ -0,0 +1,8 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Servers
+{
+    public delegate string RestMethod( string request, string path, string param );
+}

+ 123 - 0
Common/OpenSim.Servers/LocalUserProfileManager.cs

@@ -0,0 +1,123 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Text;
+using OpenSim.Framework.User;
+using OpenSim.Framework.Grid;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Types;
+using libsecondlife;
+
+namespace OpenSim.UserServer
+{
+    public class LocalUserProfileManager : UserProfileManager 
+    {
+        private IGridServer m_gridServer;
+        private int m_port;
+        private string m_ipAddr;
+        private uint regionX;
+        private uint regionY;
+        private AddNewSessionHandler AddSession;
+
+        public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr , uint regX, uint regY)
+		{
+			m_gridServer = gridServer;
+            m_port = simPort;
+            m_ipAddr = ipAddr;
+            regionX = regX;
+            regionY = regY;
+		}
+
+        public void SetSessionHandler(AddNewSessionHandler sessionHandler)
+        {
+            this.AddSession = sessionHandler;
+        }
+
+        public override void InitUserProfiles()
+        {
+            // TODO: need to load from database
+        }
+
+        public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
+        {
+            Int32 circode = (Int32)response["circuit_code"];
+            theUser.AddSimCircuit((uint)circode, LLUUID.Random());
+            response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
+            response["sim_port"] = m_port;
+            response["sim_ip"] = m_ipAddr;
+            response["region_y"] = (Int32)regionY* 256;
+            response["region_x"] = (Int32)regionX* 256;
+
+            string first;
+            string last;
+            if (response.Contains("first_name"))
+            {
+                first = (string)response["first_name"];
+            }
+            else
+            {
+                first = "test";
+            }
+
+            if (response.Contains("last_name"))
+            {
+                last = (string)response["last_name"];
+            }
+            else
+            {
+                last = "User";
+            }
+
+            ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
+            Hashtable Inventory1 = (Hashtable)InventoryList[0];
+
+            Login _login = new Login();
+            //copy data to login object
+            _login.First = first;
+            _login.Last = last;
+            _login.Agent = new LLUUID((string)response["agent_id"]) ;
+            _login.Session = new LLUUID((string)response["session_id"]);
+            _login.SecureSession = new LLUUID((string)response["secure_session_id"]);
+            _login.CircuitCode =(uint) circode;
+            _login.BaseFolder = null;
+            _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
+
+            //working on local computer if so lets add to the gridserver's list of sessions?
+            /*if (m_gridServer.GetName() == "Local")
+            {
+                Console.WriteLine("adding login data to gridserver");
+                ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
+            }*/
+
+            this.AddSession(_login);
+        }
+    }
+}

+ 670 - 0
Common/OpenSim.Servers/LoginResponse.cs

@@ -0,0 +1,670 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+using Nwc.XmlRpc;
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Xml;
+using libsecondlife;
+using OpenSim;
+using OpenSim.Framework.User;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Utilities;
+using OpenSim.Framework.Interfaces;
+
+// ?
+using OpenSim.Framework.Grid;
+
+namespace OpenSim.UserServer
+{
+    /// <summary>
+    /// A temp class to handle login response.
+    /// Should make use of UserProfileManager where possible.
+    /// </summary>
+
+    public class LoginResponse
+    {
+        private Hashtable loginFlagsHash;
+        private Hashtable globalTexturesHash;
+        private Hashtable loginError;
+        private Hashtable eventCategoriesHash;
+        private Hashtable uiConfigHash;
+        private Hashtable classifiedCategoriesHash;
+
+        private ArrayList loginFlags;
+        private ArrayList globalTextures;
+        private ArrayList eventCategories;
+        private ArrayList uiConfig;
+        private ArrayList classifiedCategories;
+        private ArrayList inventoryRoot;
+        private ArrayList initialOutfit;
+        private ArrayList agentInventory;
+
+        private UserProfile userProfile;
+
+        private LLUUID agentID;
+        private LLUUID sessionID;
+        private LLUUID secureSessionID;
+        private LLUUID baseFolderID;
+        private LLUUID inventoryFolderID;
+
+        // Login Flags
+        private string dst;
+        private string stipendSinceLogin;
+        private string gendered;
+        private string everLoggedIn;
+        private string login;
+        private string simPort;
+        private string simAddress;
+        private string agentAccess;
+        private Int32 circuitCode;
+        private uint regionX;
+        private uint regionY;
+
+        // Login
+        private string firstname;
+        private string lastname;
+
+        // Global Textures
+        private string sunTexture;
+        private string cloudTexture;
+        private string moonTexture;
+
+        // Error Flags
+        private string errorReason;
+        private string errorMessage;
+
+        // Response
+        private XmlRpcResponse xmlRpcResponse;
+        private XmlRpcResponse defaultXmlRpcResponse;
+
+        private string welcomeMessage;
+        private string startLocation;
+        private string allowFirstLife;
+        private string home;
+        private string seedCapability;
+        private string lookAt;
+
+        public LoginResponse()
+        {
+            this.loginFlags = new ArrayList();
+            this.globalTextures = new ArrayList();
+            this.eventCategories = new ArrayList();
+            this.uiConfig = new ArrayList();
+            this.classifiedCategories = new ArrayList();
+
+            this.loginError = new Hashtable();
+            this.eventCategoriesHash = new Hashtable();
+            this.classifiedCategoriesHash = new Hashtable();
+            this.uiConfigHash = new Hashtable();
+
+            this.defaultXmlRpcResponse = new XmlRpcResponse();
+            this.userProfile = new UserProfile();
+            this.inventoryRoot = new ArrayList();
+            this.initialOutfit = new ArrayList();
+            this.agentInventory = new ArrayList();
+
+            this.xmlRpcResponse = new XmlRpcResponse();
+            this.defaultXmlRpcResponse = new XmlRpcResponse();
+
+            this.SetDefaultValues();
+        } // LoginServer
+
+        public void SetDefaultValues()
+        {
+            try
+            {
+                this.DST = "N";
+                this.StipendSinceLogin = "N";
+                this.Gendered = "Y";
+                this.EverLoggedIn = "Y";
+                this.login = "false";
+                this.firstname = "Test";
+                this.lastname = "User";
+                this.agentAccess = "M";
+                this.startLocation = "last";
+                this.allowFirstLife = "Y";
+
+                this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
+                this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
+                this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
+
+                this.ErrorMessage = "You have entered an invalid name/password combination.  Check Caps/lock.";
+                this.ErrorReason = "key";
+                this.welcomeMessage = "Welcome to OpenSim!";
+                this.seedCapability = "";
+                this.home = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}";
+                this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
+                this.RegionX = (uint)255232;
+                this.RegionY = (uint)254976;
+
+                // Classifieds;
+                this.AddClassifiedCategory((Int32)1, "Shopping");
+                this.AddClassifiedCategory((Int32)2, "Land Rental");
+                this.AddClassifiedCategory((Int32)3, "Property Rental");
+                this.AddClassifiedCategory((Int32)4, "Special Attraction");
+                this.AddClassifiedCategory((Int32)5, "New Products");
+                this.AddClassifiedCategory((Int32)6, "Employment");
+                this.AddClassifiedCategory((Int32)7, "Wanted");
+                this.AddClassifiedCategory((Int32)8, "Service");
+                this.AddClassifiedCategory((Int32)9, "Personal");
+
+                int SessionRand = Util.RandomClass.Next(1, 999);
+                this.SessionID = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
+                this.SecureSessionID = LLUUID.Random();
+
+                this.userProfile.Inventory.CreateRootFolder(this.userProfile.UUID, true);
+                this.baseFolderID = this.userProfile.Inventory.GetFolderID("Textures");
+                this.inventoryFolderID = this.userProfile.Inventory.GetFolderID("My Inventory-");
+                Hashtable InventoryRootHash = new Hashtable();
+                InventoryRootHash["folder_id"] = this.userProfile.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
+                this.inventoryRoot.Add(InventoryRootHash);
+
+                Hashtable TempHash;
+                foreach (InventoryFolder InvFolder in this.userProfile.Inventory.InventoryFolders.Values)
+                {
+                    TempHash = new Hashtable();
+                    TempHash["name"] = InvFolder.FolderName;
+                    TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
+                    TempHash["version"] = (Int32)InvFolder.Version;
+                    TempHash["type_default"] = (Int32)InvFolder.DefaultType;
+                    TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
+                    this.agentInventory.Add(TempHash);
+                }
+
+                Hashtable InitialOutfitHash = new Hashtable();
+                InitialOutfitHash["folder_name"] = "Nightclub Female";
+                InitialOutfitHash["gender"] = "female";
+                this.initialOutfit.Add(InitialOutfitHash);
+            }
+            catch (Exception e)
+            {
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
+                    OpenSim.Framework.Console.LogPriority.LOW, 
+                    "LoginResponse: Unable to set default values: " + e.Message
+                );
+            }
+
+        } // SetDefaultValues
+
+        protected virtual LLUUID GetAgentId()
+        {
+            // todo
+            LLUUID Agent;
+            int AgentRand = Util.RandomClass.Next(1, 9999);
+            Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
+            return Agent;
+        } // GetAgentId
+
+        private XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
+        {
+            // Overwrite any default values;
+            this.xmlRpcResponse = new XmlRpcResponse();
+
+            // Ensure Login Failed message/reason;
+            this.ErrorMessage = message;
+            this.ErrorReason = reason;
+
+            this.loginError["reason"] = this.ErrorReason;
+            this.loginError["message"] = this.ErrorMessage;
+            this.loginError["login"] = login;
+            this.xmlRpcResponse.Value = this.loginError;
+            return (this.xmlRpcResponse);
+        } // GenerateResponse
+
+        public XmlRpcResponse LoginFailedResponse()
+        {
+            return (this.GenerateFailureResponse("key", "You have entered an invalid name/password combination.  Check Caps/lock.", "false"));
+        } // LoginFailedResponse
+
+        public XmlRpcResponse ConnectionFailedResponse()
+        {
+            return (this.LoginFailedResponse());
+        } // CreateErrorConnectingToGridResponse()
+
+        public XmlRpcResponse CreateAlreadyLoggedInResponse()
+        {
+            return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false"));
+        } // CreateAlreadyLoggedInResponse()
+
+        public XmlRpcResponse ToXmlRpcResponse()
+        {
+            try
+            {
+
+                Hashtable responseData = new Hashtable();
+
+                this.loginFlagsHash = new Hashtable();
+                this.loginFlagsHash["daylight_savings"] = this.DST;
+                this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin;
+                this.loginFlagsHash["gendered"] = this.Gendered;
+                this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn;
+                this.loginFlags.Add(this.loginFlagsHash);
+
+                responseData["first_name"] = this.Firstname;
+                responseData["last_name"] = this.Lastname;
+                responseData["agent_access"] = this.agentAccess;
+
+                this.globalTexturesHash = new Hashtable();
+                this.globalTexturesHash["sun_texture_id"] = this.SunTexture;
+                this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture;
+                this.globalTexturesHash["moon_texture_id"] = this.MoonTexture;
+                this.globalTextures.Add(this.globalTexturesHash);
+                this.eventCategories.Add(this.eventCategoriesHash);
+
+                this.AddToUIConfig("allow_first_life", this.allowFirstLife);
+                this.uiConfig.Add(this.uiConfigHash);
+
+                // Create a agent and session LLUUID
+                this.agentID = this.GetAgentId();
+
+                responseData["sim_port"] = this.SimPort;
+                responseData["sim_ip"] = this.SimAddress;
+                responseData["agent_id"] = this.AgentID.ToStringHyphenated();
+                responseData["session_id"] = this.SessionID.ToStringHyphenated();
+                responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated();
+                responseData["circuit_code"] = this.CircuitCode;
+                responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
+                responseData["login-flags"] = this.loginFlags;
+                responseData["global-textures"] = this.globalTextures;
+                responseData["seed_capability"] = this.seedCapability;
+
+                responseData["event_categories"] = this.eventCategories;
+                responseData["event_notifications"] = new ArrayList(); // todo
+                responseData["classified_categories"] = this.classifiedCategories;
+                responseData["ui-config"] = this.uiConfig;
+
+                responseData["inventory-skeleton"] = this.agentInventory;
+                responseData["inventory-skel-lib"] = new ArrayList(); // todo
+                responseData["inventory-root"] = this.inventoryRoot;
+                responseData["gestures"] = new ArrayList(); // todo
+                responseData["inventory-lib-owner"] = new ArrayList(); // todo
+                responseData["initial-outfit"] = this.initialOutfit;
+                responseData["start_location"] = this.startLocation;
+                responseData["seed_capability"] = this.seedCapability;
+                responseData["home"] = this.home;
+                responseData["look_at"] = this.lookAt;
+                responseData["message"] = this.welcomeMessage;
+                responseData["region_x"] = (Int32)this.RegionX * 256;
+                responseData["region_y"] = (Int32)this.RegionY * 256;
+
+                responseData["login"] = "true";
+                this.xmlRpcResponse.Value = responseData;
+
+                return (this.xmlRpcResponse);
+            }
+            catch (Exception e)
+            {
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
+                    OpenSim.Framework.Console.LogPriority.LOW,
+                    "LoginResponse: Error creating XML-RPC Response: " + e.Message
+                );
+                return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
+
+            }
+
+        } // ToXmlRpcResponse
+
+        public void SetEventCategories(string category, string value)
+        {
+            this.eventCategoriesHash[category] = value;
+        } // SetEventCategories
+
+        public void AddToUIConfig(string itemName, string item)
+        {
+            this.uiConfigHash[itemName] = item;
+        } // SetUIConfig
+
+        public void AddClassifiedCategory(Int32 ID, string categoryName)
+        {
+            this.classifiedCategoriesHash["category_name"] = categoryName;
+            this.classifiedCategoriesHash["category_id"] = ID;
+            this.classifiedCategories.Add(this.classifiedCategoriesHash);
+            // this.classifiedCategoriesHash.Clear();
+        } // SetClassifiedCategory
+
+        public string Login
+        {
+            get
+            {
+                return this.login;
+            }
+            set
+            {
+                this.login = value;
+            }
+        } // Login
+
+        public string DST
+        {
+            get
+            {
+                return this.dst;
+            }
+            set
+            {
+                this.dst = value;
+            }
+        } // DST
+
+        public string StipendSinceLogin
+        {
+            get
+            {
+                return this.stipendSinceLogin;
+            }
+            set
+            {
+                this.stipendSinceLogin = value;
+            }
+        } // StipendSinceLogin
+
+        public string Gendered
+        {
+            get
+            {
+                return this.gendered;
+            }
+            set
+            {
+                this.gendered = value;
+            }
+        } // Gendered
+
+        public string EverLoggedIn
+        {
+            get
+            {
+                return this.everLoggedIn;
+            }
+            set
+            {
+                this.everLoggedIn = value;
+            }
+        } // EverLoggedIn
+
+        public string SimPort
+        {
+            get
+            {
+                return this.simPort;
+            }
+            set
+            {
+                this.simPort = value;
+            }
+        } // SimPort
+
+        public string SimAddress
+        {
+            get
+            {
+                return this.simAddress;
+            }
+            set
+            {
+                this.simAddress = value;
+            }
+        } // SimAddress
+
+        public LLUUID AgentID
+        {
+            get
+            {
+                return this.agentID;
+            }
+            set
+            {
+                this.agentID = value;
+            }
+        } // AgentID
+
+        public LLUUID SessionID
+        {
+            get
+            {
+                return this.sessionID;
+            }
+            set
+            {
+                this.sessionID = value;
+            }
+        } // SessionID
+
+        public LLUUID SecureSessionID
+        {
+            get
+            {
+                return this.secureSessionID;
+            }
+            set
+            {
+                this.secureSessionID = value;
+            }
+        } // SecureSessionID
+
+        public LLUUID BaseFolderID
+        {
+            get
+            {
+                return this.baseFolderID;
+            }
+            set
+            {
+                this.baseFolderID = value;
+            }
+        } // BaseFolderID
+
+        public LLUUID InventoryFolderID
+        {
+            get
+            {
+                return this.inventoryFolderID;
+            }
+            set
+            {
+                this.inventoryFolderID = value;
+            }
+        } // InventoryFolderID
+
+        public Int32 CircuitCode
+        {
+            get
+            {
+                return this.circuitCode;
+            }
+            set
+            {
+                this.circuitCode = value;
+            }
+        } // CircuitCode
+
+        public uint RegionX
+        {
+            get
+            {
+                return this.regionX;
+            }
+            set
+            {
+                this.regionX = value;
+            }
+        } // RegionX
+
+        public uint RegionY
+        {
+            get
+            {
+                return this.regionY;
+            }
+            set
+            {
+                this.regionY = value;
+            }
+        } // RegionY
+
+        public string SunTexture
+        {
+            get
+            {
+                return this.sunTexture;
+            }
+            set
+            {
+                this.sunTexture = value;
+            }
+        } // SunTexture
+
+        public string CloudTexture
+        {
+            get
+            {
+                return this.cloudTexture;
+            }
+            set
+            {
+                this.cloudTexture = value;
+            }
+        } // CloudTexture
+
+        public string MoonTexture
+        {
+            get
+            {
+                return this.moonTexture;
+            }
+            set
+            {
+                this.moonTexture = value;
+            }
+        } // MoonTexture
+
+        public string Firstname
+        {
+            get
+            {
+                return this.firstname;
+            }
+            set
+            {
+                this.firstname = value;
+            }
+        } // Firstname
+
+        public string Lastname
+        {
+            get
+            {
+                return this.lastname;
+            }
+            set
+            {
+                this.lastname = value;
+            }
+        } // Lastname
+
+        public string AgentAccess
+        {
+            get
+            {
+                return this.agentAccess;
+            }
+            set
+            {
+                this.agentAccess = value;
+            }
+        }
+
+        public string StartLocation
+        {
+            get
+            {
+                return this.startLocation;
+            }
+            set
+            {
+                this.startLocation = value;
+            }
+        } // StartLocation
+
+        public string LookAt
+        {
+            get
+            {
+                return this.lookAt;
+            }
+            set
+            {
+                this.lookAt = value;
+            }
+        }
+
+        public string SeedCapability
+        {
+            get
+            {
+                return this.seedCapability;
+            }
+            set
+            {
+                this.seedCapability = value;
+            }
+        } // SeedCapability
+
+        public string ErrorReason
+        {
+            get
+            {
+                return this.errorReason;
+            }
+            set
+            {
+                this.errorReason = value;
+            }
+        } // ErrorReason
+
+        public string ErrorMessage
+        {
+            get
+            {
+                return this.errorMessage;
+            }
+            set
+            {
+                this.errorMessage = value;
+            }
+        } // ErrorMessage
+
+    } // LoginResponse
+} // namespace OpenSim.UserServer

+ 284 - 0
Common/OpenSim.Servers/LoginServer.cs

@@ -0,0 +1,284 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+
+using Nwc.XmlRpc;
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Xml;
+using libsecondlife;
+using OpenSim;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Grid;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.User;
+using OpenSim.Framework.Utilities;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.UserServer
+{
+    public delegate void AddNewSessionHandler(Login loginData);
+    /// <summary>
+    /// When running in local (default) mode , handles client logins.
+    /// </summary>
+    public class LoginServer : LoginService, IUserServer
+    {
+        private IGridServer m_gridServer;
+        public IPAddress clientAddress = IPAddress.Loopback;
+        public IPAddress remoteAddress = IPAddress.Any;
+        private int NumClients;
+        private bool userAccounts = false;
+        private string _mpasswd;
+        private bool _needPasswd = false;
+        private LocalUserProfileManager userManager;
+        private int m_simPort;
+        private string m_simAddr;
+        private uint regionX;
+        private uint regionY;
+        private AddNewSessionHandler AddSession;
+
+        public LocalUserProfileManager LocalUserManager
+        {
+            get
+            {
+                return userManager;
+            }
+        }
+
+        public LoginServer( string simAddr, int simPort, uint regX, uint regY, bool useAccounts)
+        {
+            m_simPort = simPort;
+            m_simAddr = simAddr;
+            regionX = regX;
+            regionY = regY;
+            this.userAccounts = useAccounts;
+        }
+
+        public void SetSessionHandler(AddNewSessionHandler sessionHandler)
+        {
+            this.AddSession = sessionHandler;
+            this.userManager.SetSessionHandler(sessionHandler);
+        }
+
+        public void Startup()
+        {
+            this._needPasswd = false;
+
+            this._mpasswd = EncodePassword("testpass");
+
+            userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr, regionX, regionY);
+            //userManager.InitUserProfiles();
+            userManager.SetKeys("", "", "", "Welcome to OpenSim");
+        }
+
+        public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
+        {
+            Console.WriteLine("login attempt");
+            Hashtable requestData = (Hashtable)request.Params[0];
+            string first;
+            string last;
+            string passwd;
+
+            LoginResponse loginResponse = new LoginResponse();
+            loginResponse.RegionX = regionX;
+            loginResponse.RegionY = regionY;
+
+            //get login name
+            if (requestData.Contains("first"))
+            {
+                first = (string)requestData["first"];
+            }
+            else
+            {
+                first = "test";
+            }
+
+            if (requestData.Contains("last"))
+            {
+                last = (string)requestData["last"];
+            }
+            else
+            {
+                last = "User" + NumClients.ToString();
+            }
+
+            if (requestData.Contains("passwd"))
+            {
+                passwd = (string)requestData["passwd"];
+            }
+            else
+            {
+                passwd = "notfound";
+            }
+
+            if (!Authenticate(first, last, passwd))
+            {
+                return loginResponse.LoginFailedResponse();
+            }
+
+            NumClients++;
+
+            // Create a agent and session LLUUID
+            // Agent = GetAgentId(first, last);
+            // int SessionRand = Util.RandomClass.Next(1, 999);
+            // Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
+            // LLUUID secureSess = LLUUID.Random();            
+
+            loginResponse.SimPort = m_simPort.ToString();
+            loginResponse.SimAddress = m_simAddr.ToString();
+            // loginResponse.AgentID = Agent.ToStringHyphenated();
+            // loginResponse.SessionID = Session.ToStringHyphenated();
+            // loginResponse.SecureSessionID = secureSess.ToStringHyphenated();
+            loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next());
+            XmlRpcResponse response = loginResponse.ToXmlRpcResponse();
+            Hashtable responseData = (Hashtable)response.Value;
+
+            //inventory
+            /* ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
+             Hashtable Inventory1 = (Hashtable)InventoryList[0];
+            Hashtable Inventory2 = (Hashtable)InventoryList[1];
+            LLUUID BaseFolderID = LLUUID.Random();
+             LLUUID InventoryFolderID = LLUUID.Random();
+             Inventory2["name"] = "Textures";
+             Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
+             Inventory2["type_default"] = 0;
+             Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
+
+             ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
+             Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
+             Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
+            */
+            CustomiseLoginResponse(responseData, first, last);
+
+            Login _login = new Login();
+            //copy data to login object
+            _login.First = first;
+            _login.Last = last;
+            _login.Agent = loginResponse.AgentID;
+            _login.Session = loginResponse.SessionID;
+            _login.SecureSession = loginResponse.SecureSessionID;
+            _login.CircuitCode = (uint) loginResponse.CircuitCode;
+            _login.BaseFolder = loginResponse.BaseFolderID;
+            _login.InventoryFolder = loginResponse.InventoryFolderID;
+
+            //working on local computer if so lets add to the gridserver's list of sessions?
+           /* if (m_gridServer.GetName() == "Local")
+            {
+                ((LocalGridBase)m_gridServer).AddNewSession(_login);
+            }*/
+            AddSession(_login);
+
+            return response;
+        }
+
+        protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last)
+        {
+        }
+
+        protected virtual LLUUID GetAgentId(string firstName, string lastName)
+        {
+            LLUUID Agent;
+            int AgentRand = Util.RandomClass.Next(1, 9999);
+            Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
+            return Agent;
+        }
+
+        protected virtual bool Authenticate(string first, string last, string passwd)
+        {
+            if (this._needPasswd)
+            {
+                //every user needs the password to login
+                string encodedPass = passwd.Remove(0, 3); //remove $1$
+                if (encodedPass == this._mpasswd)
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                //do not need password to login
+                return true;
+            }
+        }
+
+        private static string EncodePassword(string passwd)
+        {
+            Byte[] originalBytes;
+            Byte[] encodedBytes;
+            MD5 md5;
+
+            md5 = new MD5CryptoServiceProvider();
+            originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
+            encodedBytes = md5.ComputeHash(originalBytes);
+
+            return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
+        }
+
+        public bool CreateUserAccount(string firstName, string lastName, string password)
+        {
+            Console.WriteLine("creating new user account");
+            string mdPassword = EncodePassword(password);
+            Console.WriteLine("with password: " + mdPassword);
+            this.userManager.CreateNewProfile(firstName, lastName, mdPassword);
+            return true;
+        }
+
+        //IUserServer implementation
+        public AgentInventory RequestAgentsInventory(LLUUID agentID)
+        {
+            AgentInventory aInventory = null;
+            if (this.userAccounts)
+            {
+                aInventory = this.userManager.GetUsersInventory(agentID);
+            }
+
+            return aInventory;
+        }
+
+        public bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory)
+        {
+            return true;
+        }
+
+        public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
+        {
+
+        }
+    }
+
+
+}

+ 130 - 0
Common/OpenSim.Servers/OpenSim.Servers.csproj

@@ -0,0 +1,130 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenSim.Servers</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenSim.Servers</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="libsecondlife.dll" >
+      <HintPath>..\..\bin\libsecondlife.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
+      <Name>OpenSim.Framework</Name>
+      <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
+      <Name>OpenSim.Framework.Console</Name>
+      <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
+      <Name>XMLRPC</Name>
+      <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="BaseHttpServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="BaseServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="CheckSumServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="IRestHandler.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="LocalUserProfileManager.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="LoginResponse.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="LoginServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="UDPServerBase.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcMethod.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
Common/OpenSim.Servers/OpenSim.Servers.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 52 - 0
Common/OpenSim.Servers/OpenSim.Servers.dll.build

@@ -0,0 +1,52 @@
+<?xml version="1.0" ?>
+<project name="OpenSim.Servers" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenSim.Servers" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="BaseHttpServer.cs" />
+                <include name="BaseServer.cs" />
+                <include name="CheckSumServer.cs" />
+                <include name="IRestHandler.cs" />
+                <include name="LocalUserProfileManager.cs" />
+                <include name="LoginResponse.cs" />
+                <include name="LoginServer.cs" />
+                <include name="UDPServerBase.cs" />
+                <include name="XmlRpcMethod.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Xml.dll" />
+                <include name="../../bin/OpenSim.Framework.dll" />
+                <include name="../../bin/OpenSim.Framework.Console.dll" />
+                <include name="../../bin/libsecondlife.dll" />
+                <include name="../../bin/XMLRPC.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 68 - 0
Common/OpenSim.Servers/UDPServerBase.cs

@@ -0,0 +1,68 @@
+using System;
+using System.Text;
+using System.IO;
+using System.Threading;
+using System.Net;
+using System.Net.Sockets;
+using System.Timers;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using libsecondlife;
+using libsecondlife.Packets;
+
+namespace OpenSim.Servers
+{
+    public class UDPServerBase
+    {
+        public Socket Server;
+        protected IPEndPoint ServerIncoming;
+        protected byte[] RecvBuffer = new byte[4096];
+        protected byte[] ZeroBuffer = new byte[8192];
+        protected IPEndPoint ipeSender;
+        protected EndPoint epSender;
+        protected AsyncCallback ReceivedData;
+        protected int listenPort;
+
+        public UDPServerBase(int port)
+        {
+            listenPort = port;
+        }
+
+        protected virtual void OnReceivedData(IAsyncResult result)
+        {
+            ipeSender = new IPEndPoint(IPAddress.Any, 0);
+            epSender = (EndPoint)ipeSender;
+            Packet packet = null;
+            int numBytes = Server.EndReceiveFrom(result, ref epSender);
+            int packetEnd = numBytes - 1;
+
+            packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
+
+            Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
+        }
+
+        protected virtual void AddNewClient(Packet packet)
+        {
+        }
+
+        public virtual void ServerListener()
+        {
+
+            ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort);
+            Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+            Server.Bind(ServerIncoming);
+
+            ipeSender = new IPEndPoint(IPAddress.Any, 0);
+            epSender = (EndPoint)ipeSender;
+            ReceivedData = new AsyncCallback(this.OnReceivedData);
+            Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
+        }
+
+        public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
+        {
+
+        }
+    }
+}
+

+ 7 - 0
Common/OpenSim.Servers/XmlRpcMethod.cs

@@ -0,0 +1,7 @@
+using System;
+using Nwc.XmlRpc;
+
+namespace OpenSim.Servers
+{
+    public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request );    
+}

+ 46 - 0
Common/XmlRpcCS/Logger.cs

@@ -0,0 +1,46 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+
+    /// <summary>Define levels of logging.</summary><remarks> This duplicates
+    /// similar enumerations in System.Diagnostics.EventLogEntryType. The 
+    /// duplication was merited because .NET Compact Framework lacked the EventLogEntryType enum.</remarks>
+    public enum LogLevel
+    {
+        /// <summary>Information level, log entry for informational reasons only.</summary>
+        Information,
+        /// <summary>Warning level, indicates a possible problem.</summary>
+        Warning,
+        /// <summary>Error level, implies a significant problem.</summary>
+        Error
+    }
+
+    ///<summary>
+    ///Logging singleton with swappable output delegate.
+    ///</summary>
+    ///<remarks>
+    ///This singleton provides a centralized log. The actual WriteEntry calls are passed
+    ///off to a delegate however. Having a delegate do the actual logginh allows you to
+    ///implement different logging mechanism and have them take effect throughout the system.
+    ///</remarks>
+    public class Logger
+    {
+        ///<summary>Delegate definition for logging.</summary>
+        ///<param name="message">The message <c>String</c> to log.</param>
+        ///<param name="level">The <c>LogLevel</c> of your message.</param>
+        public delegate void LoggerDelegate(String message, LogLevel level);
+        ///<summary>The LoggerDelegate that will recieve WriteEntry requests.</summary>
+        static public LoggerDelegate Delegate = null;
+
+        ///<summary>
+        ///Method logging events are sent to.
+        ///</summary>
+        ///<param name="message">The message <c>String</c> to log.</param>
+        ///<param name="level">The <c>LogLevel</c> of your message.</param>
+        static public void WriteEntry(String message, LogLevel level)
+        {
+            if (Delegate != null)
+                Delegate(message, level);
+        }
+    }
+}

+ 204 - 0
Common/XmlRpcCS/SimpleHttpRequest.cs

@@ -0,0 +1,204 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.IO;
+    using System.Net.Sockets;
+    using System.Collections;
+
+    ///<summary>Very basic HTTP request handler.</summary>
+    ///<remarks>This class is designed to accept a TcpClient and treat it as an HTTP request.
+    /// It will do some basic header parsing and manage the input and output streams associated
+    /// with the request.</remarks>
+    public class SimpleHttpRequest
+    {
+        private String _httpMethod = null;
+        private String _protocol;
+        private String _filePathFile = null;
+        private String _filePathDir = null;
+        private String __filePath;
+        private TcpClient _client;
+        private StreamReader _input;
+        private StreamWriter _output;
+        private Hashtable _headers;
+
+        /// <summary>A constructor which accepts the TcpClient.</summary>
+        /// <remarks>It creates the associated input and output streams, determines the request type,
+        /// and parses the remaining HTTP header.</remarks>
+        /// <param name="client">The <c>TcpClient</c> associated with the HTTP connection.</param>
+        public SimpleHttpRequest(TcpClient client)
+        {
+            _client = client;
+            _output = new StreamWriter(client.GetStream());
+            _input = new StreamReader(client.GetStream());
+            GetRequestMethod();
+            GetRequestHeaders();
+        }
+
+        /// <summary>The output <c>StreamWriter</c> associated with the request.</summary>
+        public StreamWriter Output
+        {
+            get { return _output; }
+        }
+
+        /// <summary>The input <c>StreamReader</c> associated with the request.</summary>
+        public StreamReader Input
+        {
+            get { return _input; }
+        }
+
+        /// <summary>The <c>TcpClient</c> with the request.</summary>
+        public TcpClient Client
+        {
+            get { return _client; }
+        }
+
+        private String _filePath
+        {
+            get { return __filePath; }
+            set
+            {
+                __filePath = value;
+                _filePathDir = null;
+                _filePathFile = null;
+            }
+        }
+
+        /// <summary>The type of HTTP request (i.e. PUT, GET, etc.).</summary>
+        public String HttpMethod
+        {
+            get { return _httpMethod; }
+        }
+
+        /// <summary>The level of the HTTP protocol.</summary>
+        public String Protocol
+        {
+            get { return _protocol; }
+        }
+
+        /// <summary>The "path" which is part of any HTTP request.</summary>
+        public String FilePath
+        {
+            get { return _filePath; }
+        }
+
+        /// <summary>The file portion of the "path" which is part of any HTTP request.</summary>
+        public String FilePathFile
+        {
+            get
+            {
+                if (_filePathFile != null)
+                    return _filePathFile;
+
+                int i = FilePath.LastIndexOf("/");
+
+                if (i == -1)
+                    return "";
+
+                i++;
+                _filePathFile = FilePath.Substring(i, FilePath.Length - i);
+                return _filePathFile;
+            }
+        }
+
+        /// <summary>The directory portion of the "path" which is part of any HTTP request.</summary>
+        public String FilePathDir
+        {
+            get
+            {
+                if (_filePathDir != null)
+                    return _filePathDir;
+
+                int i = FilePath.LastIndexOf("/");
+
+                if (i == -1)
+                    return "";
+
+                i++;
+                _filePathDir = FilePath.Substring(0, i);
+                return _filePathDir;
+            }
+        }
+
+        private void GetRequestMethod()
+        {
+            string req = _input.ReadLine();
+            if (req == null)
+                throw new ApplicationException("Void request.");
+
+            if (0 == String.Compare("GET ", req.Substring(0, 4), true))
+                _httpMethod = "GET";
+            else if (0 == String.Compare("POST ", req.Substring(0, 5), true))
+                _httpMethod = "POST";
+            else
+                throw new InvalidOperationException("Unrecognized method in query: " + req);
+
+            req = req.TrimEnd();
+            int idx = req.IndexOf(' ') + 1;
+            if (idx >= req.Length)
+                throw new ApplicationException("What do you want?");
+
+            string page_protocol = req.Substring(idx);
+            int idx2 = page_protocol.IndexOf(' ');
+            if (idx2 == -1)
+                idx2 = page_protocol.Length;
+
+            _filePath = page_protocol.Substring(0, idx2).Trim();
+            _protocol = page_protocol.Substring(idx2).Trim();
+        }
+
+        private void GetRequestHeaders()
+        {
+            String line;
+            int idx;
+
+            _headers = new Hashtable();
+
+            while ((line = _input.ReadLine()) != "")
+            {
+                if (line == null)
+                {
+                    break;
+                }
+
+                idx = line.IndexOf(':');
+                if (idx == -1 || idx == line.Length - 1)
+                {
+                    Logger.WriteEntry("Malformed header line: " + line, LogLevel.Information);
+                    continue;
+                }
+
+                String key = line.Substring(0, idx);
+                String value = line.Substring(idx + 1);
+
+                try
+                {
+                    _headers.Add(key, value);
+                }
+                catch (Exception)
+                {
+                    Logger.WriteEntry("Duplicate header key in line: " + line, LogLevel.Information);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Format the object contents into a useful string representation.
+        /// </summary>
+        ///<returns><c>String</c> representation of the <c>SimpleHttpRequest</c> as the <i>HttpMethod FilePath Protocol</i>.</returns>
+        override public String ToString()
+        {
+            return HttpMethod + " " + FilePath + " " + Protocol;
+        }
+
+        /// <summary>
+        /// Close the <c>SimpleHttpRequest</c>. This flushes and closes all associated io streams.
+        /// </summary>
+        public void Close()
+        {
+            _output.Flush();
+            _output.Close();
+            _input.Close();
+            _client.Close();
+        }
+    }
+}

+ 138 - 0
Common/XmlRpcCS/XMLRPC.csproj

@@ -0,0 +1,138 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{8E81D43C-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>XMLRPC</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>XMLRPC</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Logger.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SimpleHttpRequest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcBoxcarRequest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcClientProxy.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcDeserializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcErrorCodes.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcException.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcExposedAttribute.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcRequest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcRequestDeserializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcRequestSerializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcResponder.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcResponse.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcResponseDeserializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcResponseSerializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcSerializer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcServer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcSystemObject.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="XmlRpcXmlTokens.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
Common/XmlRpcCS/XMLRPC.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 58 - 0
Common/XmlRpcCS/XMLRPC.dll.build

@@ -0,0 +1,58 @@
+<?xml version="1.0" ?>
+<project name="XMLRPC" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="XMLRPC" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="Logger.cs" />
+                <include name="SimpleHttpRequest.cs" />
+                <include name="XmlRpcBoxcarRequest.cs" />
+                <include name="XmlRpcClientProxy.cs" />
+                <include name="XmlRpcDeserializer.cs" />
+                <include name="XmlRpcErrorCodes.cs" />
+                <include name="XmlRpcException.cs" />
+                <include name="XmlRpcExposedAttribute.cs" />
+                <include name="XmlRpcRequest.cs" />
+                <include name="XmlRpcRequestDeserializer.cs" />
+                <include name="XmlRpcRequestSerializer.cs" />
+                <include name="XmlRpcResponder.cs" />
+                <include name="XmlRpcResponse.cs" />
+                <include name="XmlRpcResponseDeserializer.cs" />
+                <include name="XmlRpcResponseSerializer.cs" />
+                <include name="XmlRpcSerializer.cs" />
+                <include name="XmlRpcServer.cs" />
+                <include name="XmlRpcSystemObject.cs" />
+                <include name="XmlRpcXmlTokens.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Xml.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 51 - 0
Common/XmlRpcCS/XmlRpcBoxcarRequest.cs

@@ -0,0 +1,51 @@
+namespace Nwc.XmlRpc
+{
+  using System;
+  using System.Collections;
+  using System.IO;
+  using System.Xml;
+  using System.Net;
+  using System.Text;
+  using System.Reflection;
+
+  /// <summary>Class that collects individual <c>XmlRpcRequest</c> objects and submits them as a <i>boxcarred</i> request.</summary>
+  /// <remarks>A boxcared request is when a number of request are collected before being sent via XML-RPC, and then are sent via
+  /// a single HTTP connection. This results in a speed up from reduced connection time.  The results are then retuned collectively
+  /// as well.
+  ///</remarks>
+  /// <seealso cref="XmlRpcRequest"/>
+  public class XmlRpcBoxcarRequest : XmlRpcRequest
+  {
+    /// <summary>ArrayList to collect the requests to boxcar.</summary>
+    public IList Requests = new ArrayList();
+
+    /// <summary>Basic constructor.</summary>
+    public XmlRpcBoxcarRequest()
+      {
+      }
+
+    /// <summary>Returns the <c>String</c> "system.multiCall" which is the server method that handles boxcars.</summary>
+    public override String MethodName
+      {
+	get { return  "system.multiCall";  }
+      }
+
+    /// <summary>The <c>ArrayList</c> of boxcarred <paramref>Requests</paramref> as properly formed parameters.</summary>
+    public override IList Params
+      {
+	get {
+	  _params.Clear();
+	  ArrayList reqArray = new ArrayList();
+	  foreach (XmlRpcRequest request in Requests)
+	    {
+	      Hashtable requestEntry = new Hashtable();
+	      requestEntry.Add(XmlRpcXmlTokens.METHOD_NAME, request.MethodName);
+	      requestEntry.Add(XmlRpcXmlTokens.PARAMS, request.Params);
+	      reqArray.Add(requestEntry);
+	    }
+	  _params.Add(reqArray);
+	  return _params;
+	}
+      }
+  }
+}

+ 61 - 0
Common/XmlRpcCS/XmlRpcClientProxy.cs

@@ -0,0 +1,61 @@
+namespace Nwc.XmlRpc
+{
+  using System;
+  using System.Runtime.Remoting.Proxies;
+  using System.Runtime.Remoting.Messaging;
+
+  /// <summary>This class provides support for creating local proxies of XML-RPC remote objects</summary>
+  /// <remarks>
+  /// To create a local proxy you need to create a local C# interface and then, via <i>createProxy</i>
+  /// associate that interface with a remote object at a given URL.
+  /// </remarks>
+public class XmlRpcClientProxy : RealProxy
+{
+  private String _remoteObjectName;
+  private String _url;
+  private XmlRpcRequest _client = new XmlRpcRequest();
+
+  /// <summary>Factory method to create proxies.</summary>
+  /// <remarks>
+  /// To create a local proxy you need to create a local C# interface with methods that mirror those of the server object.
+  /// Next, pass that interface into <c>createProxy</c> along with the object name and URL of the remote object and 
+  /// cast the resulting object to the specifice interface.
+  /// </remarks>
+  /// <param name="remoteObjectName"><c>String</c> The name of the remote object.</param>
+  /// <param name="url"><c>String</c> The URL of the remote object.</param>
+  /// <param name="anInterface"><c>Type</c> The typeof() of a C# interface.</param>
+  /// <returns><c>Object</c> A proxy for your specified interface. Cast to appropriate type.</returns>
+  public static Object createProxy(String remoteObjectName, String url, Type anInterface)
+    {
+      return new XmlRpcClientProxy(remoteObjectName, url, anInterface).GetTransparentProxy();
+    }
+
+  private XmlRpcClientProxy(String remoteObjectName, String url, Type t) : base(t)
+    {
+      _remoteObjectName = remoteObjectName;
+      _url = url;
+    }
+
+  /// <summary>The local method dispatcher - do not invoke.</summary>
+  override public IMessage Invoke(IMessage msg)
+    {
+      IMethodCallMessage methodMessage = (IMethodCallMessage)msg;
+
+      _client.MethodName = _remoteObjectName + "." + methodMessage.MethodName;
+      _client.Params.Clear();
+      foreach (Object o in methodMessage.Args)
+	_client.Params.Add(o);
+
+      try
+	{
+	  Object ret = _client.Invoke(_url);
+	  return new ReturnMessage(ret,null,0,
+				   methodMessage.LogicalCallContext, methodMessage);
+	}
+      catch (Exception e)
+	{
+	  return new ReturnMessage(e, methodMessage);
+	}
+    }
+}
+}

+ 195 - 0
Common/XmlRpcCS/XmlRpcDeserializer.cs

@@ -0,0 +1,195 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Xml;
+    using System.Globalization;
+
+    /// <summary>Parser context, we maintain contexts in a stack to avoiding recursion. </summary>
+    struct Context
+    {
+        public String Name;
+        public Object Container;
+    }
+
+    /// <summary>Basic XML-RPC data deserializer.</summary>
+    /// <remarks>Uses <c>XmlTextReader</c> to parse the XML data. This level of the class 
+    /// only handles the tokens common to both Requests and Responses. This class is not useful in and of itself
+    /// but is designed to be subclassed.</remarks>
+    public class XmlRpcDeserializer : XmlRpcXmlTokens
+    {
+        private static DateTimeFormatInfo _dateFormat = new DateTimeFormatInfo();
+
+        private Object _container;
+        private Stack _containerStack;
+
+        /// <summary>Protected reference to last text.</summary>
+        protected String _text;
+        /// <summary>Protected reference to last deserialized value.</summary>
+        protected Object _value;
+        /// <summary>Protected reference to last name field.</summary>
+        protected String _name;
+
+
+        /// <summary>Basic constructor.</summary>
+        public XmlRpcDeserializer()
+        {
+            Reset();
+            _dateFormat.FullDateTimePattern = ISO_DATETIME;
+        }
+
+        /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
+        /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
+        /// <returns><c>Object</c> object resulting from the deserialization.</returns>
+        virtual public Object Deserialize(TextReader xmlData)
+        {
+            return null;
+        }
+
+        /// <summary>Protected method to parse a node in an XML-RPC XML stream.</summary>
+        /// <remarks>Method deals with elements common to all XML-RPC data, subclasses of 
+        /// this object deal with request/response spefic elements.</remarks>
+        /// <param name="reader"><c>XmlTextReader</c> of the in progress parsing data stream.</param>
+        protected void DeserializeNode(XmlTextReader reader)
+        {
+            switch (reader.NodeType)
+            {
+                case XmlNodeType.Element:
+                    if (Logger.Delegate != null)
+                        Logger.WriteEntry("START " + reader.Name, LogLevel.Information);
+                    switch (reader.Name)
+                    {
+                        case VALUE:
+                            _value = null;
+                            _text = null;
+                            break;
+                        case STRUCT:
+                            PushContext();
+                            _container = new Hashtable();
+                            break;
+                        case ARRAY:
+                            PushContext();
+                            _container = new ArrayList();
+                            break;
+                    }
+                    break;
+                case XmlNodeType.EndElement:
+                    if (Logger.Delegate != null)
+                        Logger.WriteEntry("END " + reader.Name, LogLevel.Information);
+                    switch (reader.Name)
+                    {
+                        case BASE64:
+                            _value = Convert.FromBase64String(_text);
+                            break;
+                        case BOOLEAN:
+                            int val = Int16.Parse(_text);
+                            if (val == 0)
+                                _value = false;
+                            else if (val == 1)
+                                _value = true;
+                            break;
+                        case STRING:
+                            _value = _text;
+                            break;
+                        case DOUBLE:
+                            _value = Double.Parse(_text);
+                            break;
+                        case INT:
+                        case ALT_INT:
+                            _value = Int32.Parse(_text);
+                            break;
+                        case DATETIME:
+#if __MONO__
+		    _value = DateParse(_text);
+#else
+                            _value = DateTime.ParseExact(_text, "F", _dateFormat);
+#endif
+                            break;
+                        case NAME:
+                            _name = _text;
+                            break;
+                        case VALUE:
+                            if (_value == null)
+                                _value = _text; // some kits don't use <string> tag, they just do <value>
+
+                            if ((_container != null) && (_container is IList)) // in an array?  If so add value to it.
+                                ((IList)_container).Add(_value);
+                            break;
+                        case MEMBER:
+                            if ((_container != null) && (_container is IDictionary)) // in an struct?  If so add value to it.
+                                ((IDictionary)_container).Add(_name, _value);
+                            break;
+                        case ARRAY:
+                        case STRUCT:
+                            _value = _container;
+                            PopContext();
+                            break;
+                    }
+                    break;
+                case XmlNodeType.Text:
+                    if (Logger.Delegate != null)
+                        Logger.WriteEntry("Text " + reader.Value, LogLevel.Information);
+                    _text = reader.Value;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        /// <summary>Static method that parses XML in a <c>String</c> into a 
+        /// request using the Singleton.</summary>
+        /// <param name="xmlData"><c>String</c> containing an XML-RPC request.</param>
+        /// <returns><c>XmlRpcRequest</c> object resulting from the parse.</returns>
+        public Object Deserialize(String xmlData)
+        {
+            StringReader sr = new StringReader(xmlData);
+            return Deserialize(sr);
+        }
+
+        /// <summary>Pop a Context of the stack, an Array or Struct has closed.</summary>
+        private void PopContext()
+        {
+            Context c = (Context)_containerStack.Pop();
+            _container = c.Container;
+            _name = c.Name;
+        }
+
+        /// <summary>Push a Context on the stack, an Array or Struct has opened.</summary>
+        private void PushContext()
+        {
+            Context context;
+
+            context.Container = _container;
+            context.Name = _name;
+
+            _containerStack.Push(context);
+        }
+
+        /// <summary>Reset the internal state of the deserializer.</summary>
+        protected void Reset()
+        {
+            _text = null;
+            _value = null;
+            _name = null;
+            _container = null;
+            _containerStack = new Stack();
+        }
+
+#if __MONO__
+    private DateTime DateParse(String str)
+      {
+	int year = Int32.Parse(str.Substring(0,4));
+	int month = Int32.Parse(str.Substring(4,2));
+	int day = Int32.Parse(str.Substring(6,2));
+	int hour = Int32.Parse(str.Substring(9,2));
+	int min = Int32.Parse(str.Substring(12,2));
+	int sec = Int32.Parse(str.Substring(15,2));
+	return new DateTime(year,month,day,hour,min,sec);
+      }
+#endif
+
+    }
+}
+
+

+ 51 - 0
Common/XmlRpcCS/XmlRpcErrorCodes.cs

@@ -0,0 +1,51 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+
+    /// <summary>Standard XML-RPC error codes.</summary>
+    public class XmlRpcErrorCodes
+    {
+        /// <summary></summary>
+        public const int PARSE_ERROR_MALFORMED = -32700;
+        /// <summary></summary>
+        public const String PARSE_ERROR_MALFORMED_MSG = "Parse Error, not well formed";
+
+        /// <summary></summary>
+        public const int PARSE_ERROR_ENCODING = -32701;
+        /// <summary></summary>
+        public const String PARSE_ERROR_ENCODING_MSG = "Parse Error, unsupported encoding";
+
+        //
+        // -32702 ---> parse error. invalid character for encoding
+        // -32600 ---> server error. invalid xml-rpc. not conforming to spec.
+        //
+
+        /// <summary></summary>
+        public const int SERVER_ERROR_METHOD = -32601;
+        /// <summary></summary>
+        public const String SERVER_ERROR_METHOD_MSG = "Server Error, requested method not found";
+
+        /// <summary></summary>
+        public const int SERVER_ERROR_PARAMS = -32602;
+        /// <summary></summary>
+        public const String SERVER_ERROR_PARAMS_MSG = "Server Error, invalid method parameters";
+
+        //
+        // -32603 ---> server error. internal xml-rpc error
+        //
+
+        /// <summary></summary>
+        public const int APPLICATION_ERROR = -32500;
+        /// <summary></summary>
+        public const String APPLICATION_ERROR_MSG = "Application Error";
+
+        //
+        // -32400 ---> system error
+        //
+
+        /// <summary></summary>
+        public const int TRANSPORT_ERROR = -32300;
+        /// <summary></summary>
+        public const String TRANSPORT_ERROR_MSG = "Transport Layer Error";
+    }
+}

+ 39 - 0
Common/XmlRpcCS/XmlRpcException.cs

@@ -0,0 +1,39 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+
+    /// <summary>An XML-RPC Exception.</summary>
+    /// <remarks>Maps a C# exception to an XML-RPC fault. Normal exceptions
+    /// include a message so this adds the code needed by XML-RPC.</remarks>
+    public class XmlRpcException : Exception
+    {
+        private int _code;
+
+        /// <summary>Instantiate an <c>XmlRpcException</c> with a code and message.</summary>
+        /// <param name="code"><c>Int</c> faultCode associated with this exception.</param>
+        /// <param name="message"><c>String</c> faultMessage associated with this exception.</param>
+        public XmlRpcException(int code, String message)
+            : base(message)
+        {
+            _code = code;
+        }
+
+        /// <summary>The value of the faults message, i.e. the faultString.</summary>
+        public String FaultString
+        {
+            get { return Message; }
+        }
+
+        /// <summary>The value of the faults code, i.e. the faultCode.</summary>
+        public int FaultCode
+        {
+            get { return _code; }
+        }
+
+        /// <summary>Format the message to include the code.</summary>
+        override public String ToString()
+        {
+            return "Code: " + FaultCode + " Message: " + base.ToString();
+        }
+    }
+}

+ 60 - 0
Common/XmlRpcCS/XmlRpcExposedAttribute.cs

@@ -0,0 +1,60 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Reflection;
+
+    /// <summary>
+    /// Simple tagging attribute to indicate participation is XML-RPC exposure.
+    /// </summary>
+    /// <remarks>
+    /// If present at the class level it indicates that this class does explicitly 
+    /// expose methods. If present at the method level it denotes that the method
+    /// is exposed.
+    /// </remarks>
+    [AttributeUsage(
+          AttributeTargets.Class | AttributeTargets.Method,
+          AllowMultiple = false,
+          Inherited = true
+      )]
+    public class XmlRpcExposedAttribute : Attribute
+    {
+        /// <summary>Check if <paramref>obj</paramref> is an object utilizing the XML-RPC exposed Attribute.</summary>
+        /// <param name="obj"><c>Object</c> of a class or method to check for attribute.</param>
+        /// <returns><c>Boolean</c> true if attribute present.</returns>
+        public static Boolean ExposedObject(Object obj)
+        {
+            return IsExposed(obj.GetType());
+        }
+
+        /// <summary>Check if <paramref>obj</paramref>.<paramref>methodName</paramref> is an XML-RPC exposed method.</summary>
+        /// <remarks>A method is considered to be exposed if it exists and, either, the object does not use the XmlRpcExposed attribute,
+        /// or the object does use the XmlRpcExposed attribute and the method has the XmlRpcExposed attribute as well.</remarks>
+        /// <returns><c>Boolean</c> true if the  method is exposed.</returns>
+        public static Boolean ExposedMethod(Object obj, String methodName)
+        {
+            Type type = obj.GetType();
+            MethodInfo method = type.GetMethod(methodName);
+
+            if (method == null)
+                throw new MissingMethodException("Method " + methodName + " not found.");
+
+            if (!IsExposed(type))
+                return true;
+
+            return IsExposed(method);
+        }
+
+        /// <summary>Check if <paramref>mi</paramref> is XML-RPC exposed.</summary>
+        /// <param name="mi"><c>MemberInfo</c> of a class or method to check for attribute.</param>
+        /// <returns><c>Boolean</c> true if attribute present.</returns>
+        public static Boolean IsExposed(MemberInfo mi)
+        {
+            foreach (Attribute attr in mi.GetCustomAttributes(true))
+            {
+                if (attr is XmlRpcExposedAttribute)
+                    return true;
+            }
+            return false;
+        }
+    }
+}

+ 150 - 0
Common/XmlRpcCS/XmlRpcRequest.cs

@@ -0,0 +1,150 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Xml;
+    using System.Net;
+    using System.Text;
+    using System.Reflection;
+    using System.Net.Security;
+    using System.Security.Cryptography.X509Certificates;
+
+    internal class AcceptAllCertificatePolicy : ICertificatePolicy
+    {
+        public AcceptAllCertificatePolicy()
+        {
+        }
+
+        public bool CheckValidationResult(ServicePoint sPoint,
+            System.Security.Cryptography.X509Certificates.X509Certificate cert,
+            WebRequest wRequest, int certProb)
+        {
+            // Always accept
+            return true;
+        }
+    }
+
+    /// <summary>Class supporting the request side of an XML-RPC transaction.</summary>
+    public class XmlRpcRequest
+    {
+        private String _methodName = null;
+        private Encoding _encoding = new ASCIIEncoding();
+        private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
+        private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
+
+        /// <summary><c>ArrayList</c> containing the parameters.</summary>
+        protected IList _params = null;
+
+        /// <summary>Instantiate an <c>XmlRpcRequest</c></summary>
+        public XmlRpcRequest()
+        {
+            _params = new ArrayList();
+        }
+
+        /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary>
+        /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request
+        /// should be directed to.</param>
+        /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param>
+        public XmlRpcRequest(String methodName, IList parameters)
+        {
+            MethodName = methodName;
+            _params = parameters;
+        }
+
+        /// <summary><c>ArrayList</c> conntaining the parameters for the request.</summary>
+        public virtual IList Params
+        {
+            get { return _params; }
+        }
+
+        /// <summary><c>String</c> conntaining the method name, both object and method, that the request will be sent to.</summary>
+        public virtual String MethodName
+        {
+            get { return _methodName; }
+            set { _methodName = value; }
+        }
+
+        /// <summary><c>String</c> object name portion of the method name.</summary>
+        public String MethodNameObject
+        {
+            get
+            {
+                int index = MethodName.IndexOf(".");
+
+                if (index == -1)
+                    return MethodName;
+
+                return MethodName.Substring(0, index);
+            }
+        }
+
+        /// <summary><c>String</c> method name portion of the object.method name.</summary>
+        public String MethodNameMethod
+        {
+            get
+            {
+                int index = MethodName.IndexOf(".");
+
+                if (index == -1)
+                    return MethodName;
+
+                return MethodName.Substring(index + 1, MethodName.Length - index - 1);
+            }
+        }
+
+        /// <summary>Invoke this request on the server.</summary>
+        /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
+        /// <returns><c>Object</c> The value returned from the method invocation on the server.</returns>
+        /// <exception cref="XmlRpcException">If an exception generated on the server side.</exception>
+        public Object Invoke(String url)
+        {
+            XmlRpcResponse res = Send(url, 10000);
+
+            if (res.IsFault)
+                throw new XmlRpcException(res.FaultCode, res.FaultString);
+
+            return res.Value;
+        }
+
+        /// <summary>Send the request to the server.</summary>
+        /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
+        /// <param name="timeout">Milliseconds before the connection times out.</param>
+        /// <returns><c>XmlRpcResponse</c> The response generated.</returns>
+        public XmlRpcResponse Send(String url, int timeout)
+        {
+            // Override SSL authentication mechanisms
+            ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
+
+            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+            if (request == null)
+                throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR,
+                              XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " + url);
+            request.Method = "POST";
+            request.ContentType = "text/xml";
+            request.AllowWriteStreamBuffering = true;
+            request.Timeout = timeout;
+
+            Stream stream = request.GetRequestStream();
+            XmlTextWriter xml = new XmlTextWriter(stream, _encoding);
+            _serializer.Serialize(xml, this);
+            xml.Flush();
+            xml.Close();
+
+            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+            StreamReader input = new StreamReader(response.GetResponseStream());
+
+            XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input);
+            input.Close();
+            response.Close();
+            return resp;
+        }
+
+        /// <summary>Produce <c>String</c> representation of the object.</summary>
+        /// <returns><c>String</c> representation of the object.</returns>
+        override public String ToString()
+        {
+            return _serializer.Serialize(this);
+        }
+    }
+}

+ 64 - 0
Common/XmlRpcCS/XmlRpcRequestDeserializer.cs

@@ -0,0 +1,64 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.Diagnostics;
+    using System.IO;
+    using System.Xml;
+
+    /// <summary>Class to deserialize XML data representing a request.</summary>
+    public class XmlRpcRequestDeserializer : XmlRpcDeserializer
+    {
+        static private XmlRpcRequestDeserializer _singleton;
+        /// <summary>A static singleton instance of this deserializer.</summary>
+        [Obsolete("This object is now thread safe, just use an instance.", false)]
+        static public XmlRpcRequestDeserializer Singleton
+        {
+            get
+            {
+                if (_singleton == null)
+                    _singleton = new XmlRpcRequestDeserializer();
+
+                return _singleton;
+            }
+        }
+
+        /// <summary>Static method that parses XML data into a request using the Singleton.</summary>
+        /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC request.</param>
+        /// <returns><c>XmlRpcRequest</c> object resulting from the parse.</returns>
+        override public Object Deserialize(TextReader xmlData)
+        {
+            XmlTextReader reader = new XmlTextReader(xmlData);
+            XmlRpcRequest request = new XmlRpcRequest();
+            bool done = false;
+
+            lock (this)
+            {
+                Reset();
+                while (!done && reader.Read())
+                {
+                    DeserializeNode(reader); // Parent parse...
+                    switch (reader.NodeType)
+                    {
+                        case XmlNodeType.EndElement:
+                            switch (reader.Name)
+                            {
+                                case METHOD_NAME:
+                                    request.MethodName = _text;
+                                    break;
+                                case METHOD_CALL:
+                                    done = true;
+                                    break;
+                                case PARAM:
+                                    request.Params.Add(_value);
+                                    _text = null;
+                                    break;
+                            }
+                            break;
+                    }
+                }
+            }
+            return request;
+        }
+    }
+}

+ 51 - 0
Common/XmlRpcCS/XmlRpcRequestSerializer.cs

@@ -0,0 +1,51 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.Xml;
+    using System.IO;
+
+    /// <summary>Class responsible for serializing an XML-RPC request.</summary>
+    /// <remarks>This class handles the request envelope, depending on <c>XmlRpcSerializer</c>
+    /// to serialize the payload.</remarks>
+    /// <seealso cref="XmlRpcSerializer"/>
+    public class XmlRpcRequestSerializer : XmlRpcSerializer
+    {
+        static private XmlRpcRequestSerializer _singleton;
+        /// <summary>A static singleton instance of this deserializer.</summary>
+        static public XmlRpcRequestSerializer Singleton
+        {
+            get
+            {
+                if (_singleton == null)
+                    _singleton = new XmlRpcRequestSerializer();
+
+                return _singleton;
+            }
+        }
+
+        /// <summary>Serialize the <c>XmlRpcRequest</c> to the output stream.</summary>
+        /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
+        /// <param name="obj">An <c>XmlRpcRequest</c> to serialize.</param>
+        /// <seealso cref="XmlRpcRequest"/>
+        override public void Serialize(XmlTextWriter output, Object obj)
+        {
+            XmlRpcRequest request = (XmlRpcRequest)obj;
+            output.WriteStartDocument();
+            output.WriteStartElement(METHOD_CALL);
+            output.WriteElementString(METHOD_NAME, request.MethodName);
+            output.WriteStartElement(PARAMS);
+            foreach (Object param in request.Params)
+            {
+                output.WriteStartElement(PARAM);
+                output.WriteStartElement(VALUE);
+                SerializeObject(output, param);
+                output.WriteEndElement();
+                output.WriteEndElement();
+            }
+
+            output.WriteEndElement();
+            output.WriteEndElement();
+        }
+    }
+}

+ 98 - 0
Common/XmlRpcCS/XmlRpcResponder.cs

@@ -0,0 +1,98 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Xml;
+    using System.Net.Sockets;
+
+    /// <summary>The class is a container of the context of an XML-RPC dialog on the server side.</summary>
+    /// <remarks>Instances of this class maintain the context for an individual XML-RPC server
+    /// side dialog. Namely they manage an inbound deserializer and an outbound serializer. </remarks>
+    public class XmlRpcResponder
+    {
+        private XmlRpcRequestDeserializer _deserializer = new XmlRpcRequestDeserializer();
+        private XmlRpcResponseSerializer _serializer = new XmlRpcResponseSerializer();
+        private XmlRpcServer _server;
+        private TcpClient _client;
+        private SimpleHttpRequest _httpReq;
+
+        /// <summary>The SimpleHttpRequest based on the TcpClient.</summary>
+        public SimpleHttpRequest HttpReq
+        {
+            get { return _httpReq; }
+        }
+
+        /// <summary>Basic constructor.</summary>
+        /// <param name="server">XmlRpcServer that this XmlRpcResponder services.</param>
+        /// <param name="client">TcpClient with the connection.</param>
+        public XmlRpcResponder(XmlRpcServer server, TcpClient client)
+        {
+            _server = server;
+            _client = client;
+            _httpReq = new SimpleHttpRequest(_client);
+        }
+
+        /// <summary>Call close to insure proper shutdown.</summary>
+        ~XmlRpcResponder()
+        {
+            Close();
+        }
+
+        ///<summary>Respond using this responders HttpReq.</summary>
+        public void Respond()
+        {
+            Respond(HttpReq);
+        }
+
+        /// <summary>Handle an HTTP request containing an XML-RPC request.</summary>
+        /// <remarks>This method deserializes the XML-RPC request, invokes the 
+        /// described method, serializes the response (or fault) and sends the XML-RPC response
+        /// back as a valid HTTP page.
+        /// </remarks>
+        /// <param name="httpReq"><c>SimpleHttpRequest</c> containing the request.</param>
+        public void Respond(SimpleHttpRequest httpReq)
+        {
+            XmlRpcRequest xmlRpcReq = (XmlRpcRequest)_deserializer.Deserialize(httpReq.Input);
+            XmlRpcResponse xmlRpcResp = new XmlRpcResponse();
+
+            try
+            {
+                xmlRpcResp.Value = _server.Invoke(xmlRpcReq);
+            }
+            catch (XmlRpcException e)
+            {
+                xmlRpcResp.SetFault(e.FaultCode, e.FaultString);
+            }
+            catch (Exception e2)
+            {
+                xmlRpcResp.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR,
+                      XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
+            }
+
+            if (Logger.Delegate != null)
+                Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information);
+
+            XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output);
+            httpReq.Output.Flush();
+            XmlTextWriter xml = new XmlTextWriter(httpReq.Output);
+            _serializer.Serialize(xml, xmlRpcResp);
+            xml.Flush();
+            httpReq.Output.Flush();
+        }
+
+        ///<summary>Close all contained resources, both the HttpReq and client.</summary>
+        public void Close()
+        {
+            if (_httpReq != null)
+            {
+                _httpReq.Close();
+                _httpReq = null;
+            }
+
+            if (_client != null)
+            {
+                _client.Close();
+                _client = null;
+            }
+        }
+    }
+}

+ 85 - 0
Common/XmlRpcCS/XmlRpcResponse.cs

@@ -0,0 +1,85 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Xml;
+
+    /// <summary>Class designed to represent an XML-RPC response.</summary>
+    public class XmlRpcResponse
+    {
+        private Object _value;
+        /// <summary><c>bool</c> indicating if this response represents a fault.</summary>
+        public bool IsFault;
+
+        /// <summary>Basic constructor</summary>
+        public XmlRpcResponse()
+        {
+            Value = null;
+            IsFault = false;
+        }
+
+        /// <summary>Constructor for a fault.</summary>
+        /// <param name="code"><c>int</c> the numeric faultCode value.</param>
+        /// <param name="message"><c>String</c> the faultString value.</param>
+        public XmlRpcResponse(int code, String message)
+            : this()
+        {
+            SetFault(code, message);
+        }
+
+        /// <summary>The data value of the response, may be fault data.</summary>
+        public Object Value
+        {
+            get { return _value; }
+            set
+            {
+                IsFault = false;
+                _value = value;
+            }
+        }
+
+        /// <summary>The faultCode if this is a fault.</summary>
+        public int FaultCode
+        {
+            get
+            {
+                if (!IsFault)
+                    return 0;
+                else
+                    return (int)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_CODE];
+            }
+        }
+
+        /// <summary>The faultString if this is a fault.</summary>
+        public String FaultString
+        {
+            get
+            {
+                if (!IsFault)
+                    return "";
+                else
+                    return (String)((Hashtable)_value)[XmlRpcXmlTokens.FAULT_STRING];
+            }
+        }
+
+        /// <summary>Set this response to be a fault.</summary>
+        /// <param name="code"><c>int</c> the numeric faultCode value.</param>
+        /// <param name="message"><c>String</c> the faultString value.</param>
+        public void SetFault(int code, String message)
+        {
+            Hashtable fault = new Hashtable();
+            fault.Add("faultCode", code);
+            fault.Add("faultString", message);
+            Value = fault;
+            IsFault = true;
+        }
+
+        /// <summary>Form a useful string representation of the object, in this case the XML response.</summary>
+        /// <returns><c>String</c> The XML serialized XML-RPC response.</returns>
+        override public String ToString()
+        {
+            return XmlRpcResponseSerializer.Singleton.Serialize(this);
+        }
+    }
+}

+ 65 - 0
Common/XmlRpcCS/XmlRpcResponseDeserializer.cs

@@ -0,0 +1,65 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Xml;
+
+    /// <summary>Class to deserialize XML data representing a response.</summary>
+    public class XmlRpcResponseDeserializer : XmlRpcDeserializer
+    {
+        static private XmlRpcResponseDeserializer _singleton;
+        /// <summary>A static singleton instance of this deserializer.</summary>
+        [Obsolete("This object is now thread safe, just use an instance.", false)]
+        static public XmlRpcResponseDeserializer Singleton
+        {
+            get
+            {
+                if (_singleton == null)
+                    _singleton = new XmlRpcResponseDeserializer();
+
+                return _singleton;
+            }
+        }
+
+        /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
+        /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
+        /// <returns><c>XmlRpcResponse</c> object resulting from the parse.</returns>
+        override public Object Deserialize(TextReader xmlData)
+        {
+            XmlTextReader reader = new XmlTextReader(xmlData);
+            XmlRpcResponse response = new XmlRpcResponse();
+            bool done = false;
+
+            lock (this)
+            {
+                Reset();
+
+                while (!done && reader.Read())
+                {
+                    DeserializeNode(reader); // Parent parse...
+                    switch (reader.NodeType)
+                    {
+                        case XmlNodeType.EndElement:
+                            switch (reader.Name)
+                            {
+                                case FAULT:
+                                    response.Value = _value;
+                                    response.IsFault = true;
+                                    break;
+                                case PARAM:
+                                    response.Value = _value;
+                                    _value = null;
+                                    _text = null;
+                                    break;
+                            }
+                            break;
+                        default:
+                            break;
+                    }
+                }
+            }
+            return response;
+        }
+    }
+}

+ 57 - 0
Common/XmlRpcCS/XmlRpcResponseSerializer.cs

@@ -0,0 +1,57 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.Xml;
+
+    /// <summary>Class responsible for serializing an XML-RPC response.</summary>
+    /// <remarks>This class handles the response envelope, depending on XmlRpcSerializer
+    /// to serialize the payload.</remarks>
+    /// <seealso cref="XmlRpcSerializer"/>
+    public class XmlRpcResponseSerializer : XmlRpcSerializer
+    {
+        static private XmlRpcResponseSerializer _singleton;
+        /// <summary>A static singleton instance of this deserializer.</summary>
+        static public XmlRpcResponseSerializer Singleton
+        {
+            get
+            {
+                if (_singleton == null)
+                    _singleton = new XmlRpcResponseSerializer();
+
+                return _singleton;
+            }
+        }
+
+        /// <summary>Serialize the <c>XmlRpcResponse</c> to the output stream.</summary>
+        /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
+        /// <param name="obj">An <c>Object</c> to serialize.</param>
+        /// <seealso cref="XmlRpcResponse"/>
+        override public void Serialize(XmlTextWriter output, Object obj)
+        {
+            XmlRpcResponse response = (XmlRpcResponse)obj;
+
+            output.WriteStartDocument();
+            output.WriteStartElement(METHOD_RESPONSE);
+
+            if (response.IsFault)
+                output.WriteStartElement(FAULT);
+            else
+            {
+                output.WriteStartElement(PARAMS);
+                output.WriteStartElement(PARAM);
+            }
+
+            output.WriteStartElement(VALUE);
+
+            SerializeObject(output, response.Value);
+
+            output.WriteEndElement();
+
+            output.WriteEndElement();
+            if (!response.IsFault)
+                output.WriteEndElement();
+            output.WriteEndElement();
+        }
+    }
+}

+ 109 - 0
Common/XmlRpcCS/XmlRpcSerializer.cs

@@ -0,0 +1,109 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Xml;
+
+    /// <summary>Base class of classes serializing data to XML-RPC's XML format.</summary>
+    /// <remarks>This class handles the basic type conversions like Integer to &lt;i4&gt;. </remarks>
+    /// <seealso cref="XmlRpcXmlTokens"/>
+    public class XmlRpcSerializer : XmlRpcXmlTokens
+    {
+
+        /// <summary>Serialize the <c>XmlRpcRequest</c> to the output stream.</summary>
+        /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
+        /// <param name="obj">An <c>Object</c> to serialize.</param>
+        /// <seealso cref="XmlRpcRequest"/>
+        virtual public void Serialize(XmlTextWriter output, Object obj)
+        {
+        }
+
+        /// <summary>Serialize the <c>XmlRpcRequest</c> to a String.</summary>
+        /// <remarks>Note this may represent a real memory hog for a large request.</remarks>
+        /// <param name="obj">An <c>Object</c> to serialize.</param>
+        /// <returns><c>String</c> containing XML-RPC representation of the request.</returns>
+        /// <seealso cref="XmlRpcRequest"/>
+        public String Serialize(Object obj)
+        {
+            StringWriter strBuf = new StringWriter();
+            XmlTextWriter xml = new XmlTextWriter(strBuf);
+            xml.Formatting = Formatting.Indented;
+            xml.Indentation = 4;
+            Serialize(xml, obj);
+            xml.Flush();
+            String returns = strBuf.ToString();
+            xml.Close();
+            return returns;
+        }
+
+        /// <remarks>Serialize the object to the output stream.</remarks>
+        /// <param name="output">An <c>XmlTextWriter</c> stream to write data to.</param>
+        /// <param name="obj">An <c>Object</c> to serialize.</param>
+        public void SerializeObject(XmlTextWriter output, Object obj)
+        {
+            if (obj == null)
+                return;
+
+            if (obj is byte[])
+            {
+                byte[] ba = (byte[])obj;
+                output.WriteStartElement(BASE64);
+                output.WriteBase64(ba, 0, ba.Length);
+                output.WriteEndElement();
+            }
+            else if (obj is String)
+            {
+                output.WriteElementString(STRING, obj.ToString());
+            }
+            else if (obj is Int32)
+            {
+                output.WriteElementString(INT, obj.ToString());
+            }
+            else if (obj is DateTime)
+            {
+                output.WriteElementString(DATETIME, ((DateTime)obj).ToString(ISO_DATETIME));
+            }
+            else if (obj is Double)
+            {
+                output.WriteElementString(DOUBLE, obj.ToString());
+            }
+            else if (obj is Boolean)
+            {
+                output.WriteElementString(BOOLEAN, ((((Boolean)obj) == true) ? "1" : "0"));
+            }
+            else if (obj is IList)
+            {
+                output.WriteStartElement(ARRAY);
+                output.WriteStartElement(DATA);
+                if (((ArrayList)obj).Count > 0)
+                {
+                    foreach (Object member in ((IList)obj))
+                    {
+                        output.WriteStartElement(VALUE);
+                        SerializeObject(output, member);
+                        output.WriteEndElement();
+                    }
+                }
+                output.WriteEndElement();
+                output.WriteEndElement();
+            }
+            else if (obj is IDictionary)
+            {
+                IDictionary h = (IDictionary)obj;
+                output.WriteStartElement(STRUCT);
+                foreach (String key in h.Keys)
+                {
+                    output.WriteStartElement(MEMBER);
+                    output.WriteElementString(NAME, key);
+                    output.WriteStartElement(VALUE);
+                    SerializeObject(output, h[key]);
+                    output.WriteEndElement();
+                    output.WriteEndElement();
+                }
+                output.WriteEndElement();
+            }
+
+        }
+    }
+}

+ 239 - 0
Common/XmlRpcCS/XmlRpcServer.cs

@@ -0,0 +1,239 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.IO;
+    using System.Net;
+    using System.Net.Sockets;
+    using System.Text;
+    using System.Threading;
+    using System.Xml;
+
+    /// <summary>A restricted HTTP server for use with XML-RPC.</summary>
+    /// <remarks>It only handles POST requests, and only POSTs representing XML-RPC calls.
+    /// In addition to dispatching requests it also provides a registry for request handlers. 
+    /// </remarks>
+    public class XmlRpcServer : IEnumerable
+    {
+#pragma warning disable 0414 // disable "private field assigned but not used"
+        const int RESPONDER_COUNT = 10;
+        private TcpListener _myListener;
+        private int _port;
+        private IPAddress _address;
+        private IDictionary _handlers;
+        private XmlRpcSystemObject _system;
+        private WaitCallback _wc;
+#pragma warning restore 0414
+
+        ///<summary>Constructor with port and address.</summary>
+        ///<remarks>This constructor sets up a TcpListener listening on the
+        ///given port and address. It also calls a Thread on the method StartListen().</remarks>
+        ///<param name="address"><c>IPAddress</c> value of the address to listen on.</param>
+        ///<param name="port"><c>Int</c> value of the port to listen on.</param>
+        public XmlRpcServer(IPAddress address, int port)
+        {
+            _port = port;
+            _address = address;
+            _handlers = new Hashtable();
+            _system = new XmlRpcSystemObject(this);
+            _wc = new WaitCallback(WaitCallback);
+        }
+
+        ///<summary>Basic constructor.</summary>
+        ///<remarks>This constructor sets up a TcpListener listening on the
+        ///given port. It also calls a Thread on the method StartListen(). IPAddress.Any
+        ///is assumed as the address here.</remarks>
+        ///<param name="port"><c>Int</c> value of the port to listen on.</param>
+        public XmlRpcServer(int port) : this(IPAddress.Any, port) { }
+
+        /// <summary>Start the server.</summary>
+        public void Start()
+        {
+            try
+            {
+                Stop();
+                //start listing on the given port
+                //	    IPAddress addr = IPAddress.Parse("127.0.0.1");
+                lock (this)
+                {
+                    _myListener = new TcpListener(IPAddress.Any, _port);
+                    _myListener.Start();
+                    //start the thread which calls the method 'StartListen'
+                    Thread th = new Thread(new ThreadStart(StartListen));
+                    th.Start();
+                }
+            }
+            catch (Exception e)
+            {
+                Logger.WriteEntry("An Exception Occurred while Listening :" + e.ToString(), LogLevel.Error);
+            }
+        }
+
+        /// <summary>Stop the server.</summary>
+        public void Stop()
+        {
+            try
+            {
+                if (_myListener != null)
+                {
+                    lock (this)
+                    {
+                        _myListener.Stop();
+                        _myListener = null;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                Logger.WriteEntry("An Exception Occurred while stopping :" +
+                      e.ToString(), LogLevel.Error);
+            }
+        }
+
+        /// <summary>Get an enumeration of my XML-RPC handlers.</summary>
+        /// <returns><c>IEnumerable</c> the handler enumeration.</returns>
+        public IEnumerator GetEnumerator()
+        {
+            return _handlers.GetEnumerator();
+        }
+
+        /// <summary>Retrieve a handler by name.</summary>
+        /// <param name="name"><c>String</c> naming a handler</param>
+        /// <returns><c>Object</c> that is the handler.</returns>
+        public Object this[String name]
+        {
+            get { return _handlers[name]; }
+        }
+
+        ///<summary>
+        ///This method Accepts new connections and dispatches them when appropriate.
+        ///</summary>
+        public void StartListen()
+        {
+            while (true && _myListener != null)
+            {
+                //Accept a new connection
+                XmlRpcResponder responder = new XmlRpcResponder(this, _myListener.AcceptTcpClient());
+                ThreadPool.QueueUserWorkItem(_wc, responder);
+            }
+        }
+
+
+        ///<summary>
+        ///Add an XML-RPC handler object by name.
+        ///</summary>
+        ///<param name="name"><c>String</c> XML-RPC dispatch name of this object.</param>
+        ///<param name="obj"><c>Object</c> The object that is the XML-RPC handler.</param>
+        public void Add(String name, Object obj)
+        {
+            _handlers.Add(name, obj);
+        }
+
+        ///<summary>Return a C# object.method name for and XML-RPC object.method name pair.</summary>
+        ///<param name="methodName">The XML-RPC object.method.</param>
+        ///<returns><c>String</c> of form object.method for the underlying C# method.</returns>
+        public String MethodName(String methodName)
+        {
+            int dotAt = methodName.LastIndexOf('.');
+
+            if (dotAt == -1)
+            {
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Bad method name " + methodName);
+            }
+
+            String objectName = methodName.Substring(0, dotAt);
+            Object target = _handlers[objectName];
+
+            if (target == null)
+            {
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Object " + objectName + " not found");
+            }
+
+            return target.GetType().FullName + "." + methodName.Substring(dotAt + 1);
+        }
+
+        ///<summary>Invoke a method described in a request.</summary>
+        ///<param name="req"><c>XmlRpcRequest</c> containing a method descriptions.</param>
+        /// <seealso cref="XmlRpcSystemObject.Invoke"/>
+        /// <seealso cref="XmlRpcServer.Invoke(String,String,IList)"/>
+        public Object Invoke(XmlRpcRequest req)
+        {
+            return Invoke(req.MethodNameObject, req.MethodNameMethod, req.Params);
+        }
+
+        ///<summary>Invoke a method on a named handler.</summary>
+        ///<param name="objectName"><c>String</c> The name of the handler.</param>
+        ///<param name="methodName"><c>String</c> The name of the method to invoke on the handler.</param>
+        ///<param name="parameters"><c>IList</c> The parameters to invoke the method with.</param>
+        /// <seealso cref="XmlRpcSystemObject.Invoke"/>
+        public Object Invoke(String objectName, String methodName, IList parameters)
+        {
+            Object target = _handlers[objectName];
+
+            if (target == null)
+            {
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Object " + objectName + " not found");
+            }
+
+            return XmlRpcSystemObject.Invoke(target, methodName, parameters);
+        }
+
+        /// <summary>The method the thread pool invokes when a thread is available to handle an HTTP request.</summary>
+        /// <param name="responder">TcpClient from the socket accept.</param>
+        public void WaitCallback(object responder)
+        {
+            XmlRpcResponder resp = (XmlRpcResponder)responder;
+
+            if (resp.HttpReq.HttpMethod == "POST")
+            {
+                try
+                {
+                    resp.Respond();
+                }
+                catch (Exception e)
+                {
+                    Logger.WriteEntry("Failed on post: " + e, LogLevel.Error);
+                }
+            }
+            else
+            {
+                Logger.WriteEntry("Only POST methods are supported: " + resp.HttpReq.HttpMethod +
+                          " ignored", LogLevel.Error);
+            }
+
+            resp.Close();
+        }
+
+        /// <summary>
+        /// This function send the Header Information to the client (Browser)
+        /// </summary>
+        /// <param name="sHttpVersion">HTTP Version</param>
+        /// <param name="sMIMEHeader">Mime Type</param>
+        /// <param name="iTotBytes">Total Bytes to be sent in the body</param>
+        /// <param name="sStatusCode"></param>
+        /// <param name="output">Socket reference</param>
+        static public void HttpHeader(string sHttpVersion, string sMIMEHeader, long iTotBytes, string sStatusCode, TextWriter output)
+        {
+            String sBuffer = "";
+
+            // if Mime type is not provided set default to text/html
+            if (sMIMEHeader.Length == 0)
+            {
+                sMIMEHeader = "text/html";  // Default Mime Type is text/html
+            }
+
+            sBuffer += sHttpVersion + sStatusCode + "\r\n";
+            sBuffer += "Connection: close\r\n";
+            if (iTotBytes > 0)
+                sBuffer += "Content-Length: " + iTotBytes + "\r\n";
+            sBuffer += "Server: XmlRpcServer \r\n";
+            sBuffer += "Content-Type: " + sMIMEHeader + "\r\n";
+            sBuffer += "\r\n";
+
+            output.Write(sBuffer);
+        }
+    }
+}

+ 252 - 0
Common/XmlRpcCS/XmlRpcSystemObject.cs

@@ -0,0 +1,252 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+    using System.Collections;
+    using System.Reflection;
+
+    /// <summary> XML-RPC System object implementation of extended specifications.</summary>
+    [XmlRpcExposed]
+    public class XmlRpcSystemObject
+    {
+        private XmlRpcServer _server;
+        static private IDictionary _methodHelp = new Hashtable();
+
+        /// <summary>Static <c>IDictionary</c> to hold mappings of method name to associated documentation String</summary>
+        static public IDictionary MethodHelp
+        {
+            get { return _methodHelp; }
+        }
+
+        /// <summary>Constructor.</summary>
+        /// <param name="server"><c>XmlRpcServer</c> server to be the system object for.</param>
+        public XmlRpcSystemObject(XmlRpcServer server)
+        {
+            _server = server;
+            server.Add("system", this);
+            _methodHelp.Add(this.GetType().FullName + ".methodHelp", "Return a string description.");
+        }
+
+        /// <summary>Invoke a method on a given object.</summary>
+        /// <remarks>Using reflection, and respecting the <c>XmlRpcExposed</c> attribute,
+        /// invoke the <paramref>methodName</paramref> method on the <paramref>target</paramref>
+        /// instance with the <paramref>parameters</paramref> provided. All this packages other <c>Invoke</c> methods 
+        /// end up calling this.</remarks>
+        /// <returns><c>Object</c> the value the invoked method returns.</returns>
+        /// <exception cref="XmlRpcException">If method does not exist, is not exposed, parameters invalid, or invocation
+        /// results in an exception. Note, the <c>XmlRpcException.Code</c> will indicate cause.</exception>
+        static public Object Invoke(Object target, String methodName, IList parameters)
+        {
+            if (target == null)
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Invalid target object.");
+
+            Type type = target.GetType();
+            MethodInfo method = type.GetMethod(methodName);
+
+            try
+            {
+                if (!XmlRpcExposedAttribute.ExposedMethod(target, methodName))
+                    throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": Method " + methodName + " is not exposed.");
+            }
+            catch (MissingMethodException me)
+            {
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_METHOD,
+                              XmlRpcErrorCodes.SERVER_ERROR_METHOD_MSG + ": " + me.Message);
+            }
+
+            Object[] args = new Object[parameters.Count];
+
+            int index = 0;
+            foreach (Object arg in parameters)
+            {
+                args[index] = arg;
+                index++;
+            }
+
+            try
+            {
+                Object retValue = method.Invoke(target, args);
+                if (retValue == null)
+                    throw new XmlRpcException(XmlRpcErrorCodes.APPLICATION_ERROR,
+                              XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": Method returned NULL.");
+                return retValue;
+            }
+            catch (XmlRpcException e)
+            {
+                throw e;
+            }
+            catch (ArgumentException ae)
+            {
+                Logger.WriteEntry(XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": " + ae.Message,
+                          LogLevel.Information);
+                String call = methodName + "( ";
+                foreach (Object o in args)
+                {
+                    call += o.GetType().Name;
+                    call += " ";
+                }
+                call += ")";
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_PARAMS,
+                              XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": Arguement type mismatch invoking " + call);
+            }
+            catch (TargetParameterCountException tpce)
+            {
+                Logger.WriteEntry(XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": " + tpce.Message,
+                          LogLevel.Information);
+                throw new XmlRpcException(XmlRpcErrorCodes.SERVER_ERROR_PARAMS,
+                              XmlRpcErrorCodes.SERVER_ERROR_PARAMS_MSG + ": Arguement count mismatch invoking " + methodName);
+            }
+            catch (TargetInvocationException tie)
+            {
+                throw new XmlRpcException(XmlRpcErrorCodes.APPLICATION_ERROR,
+                              XmlRpcErrorCodes.APPLICATION_ERROR_MSG + " Invoked method " + methodName + ": " + tie.Message);
+            }
+        }
+
+        /// <summary>List methods available on all handlers of this server.</summary>
+        /// <returns><c>IList</c> An array of <c>Strings</c>, each <c>String</c> will have form "object.method".</returns>
+        [XmlRpcExposed]
+        public IList listMethods()
+        {
+            IList methods = new ArrayList();
+            Boolean considerExposure;
+
+            foreach (DictionaryEntry handlerEntry in _server)
+            {
+                considerExposure = XmlRpcExposedAttribute.IsExposed(handlerEntry.Value.GetType());
+
+                foreach (MemberInfo mi in handlerEntry.Value.GetType().GetMembers())
+                {
+                    if (mi.MemberType != MemberTypes.Method)
+                        continue;
+
+                    if (!((MethodInfo)mi).IsPublic)
+                        continue;
+
+                    if (considerExposure && !XmlRpcExposedAttribute.IsExposed(mi))
+                        continue;
+
+                    methods.Add(handlerEntry.Key + "." + mi.Name);
+                }
+            }
+
+            return methods;
+        }
+
+        /// <summary>Given a method name return the possible signatures for it.</summary>
+        /// <param name="name"><c>String</c> The object.method name to look up.</param>
+        /// <returns><c>IList</c> Of arrays of signatures.</returns>
+        [XmlRpcExposed]
+        public IList methodSignature(String name)
+        {
+            IList signatures = new ArrayList();
+            int index = name.IndexOf('.');
+
+            if (index < 0)
+                return signatures;
+
+            String oName = name.Substring(0, index);
+            Object obj = _server[oName];
+
+            if (obj == null)
+                return signatures;
+
+            MemberInfo[] mi = obj.GetType().GetMember(name.Substring(index + 1));
+
+            if (mi == null || mi.Length != 1) // for now we want a single signature
+                return signatures;
+
+            MethodInfo method;
+
+            try
+            {
+                method = (MethodInfo)mi[0];
+            }
+            catch (Exception e)
+            {
+                Logger.WriteEntry("Attempted methodSignature call on " + mi[0] + " caused: " + e,
+                          LogLevel.Information);
+                return signatures;
+            }
+
+            if (!method.IsPublic)
+                return signatures;
+
+            IList signature = new ArrayList();
+            signature.Add(method.ReturnType.Name);
+
+            foreach (ParameterInfo param in method.GetParameters())
+            {
+                signature.Add(param.ParameterType.Name);
+            }
+
+
+            signatures.Add(signature);
+
+            return signatures;
+        }
+
+        /// <summary>Help for given method signature. Not implemented yet.</summary>
+        /// <param name="name"><c>String</c> The object.method name to look up.</param>
+        /// <returns><c>String</c> help text. Rich HTML text.</returns>
+        [XmlRpcExposed]
+        public String methodHelp(String name)
+        {
+            String help = null;
+
+            try
+            {
+                help = (String)_methodHelp[_server.MethodName(name)];
+            }
+            catch (XmlRpcException e)
+            {
+                throw e;
+            }
+            catch (Exception) { /* ignored */ };
+
+            if (help == null)
+                help = "No help available for: " + name;
+
+            return help;
+        }
+
+        /// <summary>Boxcarring support method.</summary>
+        /// <param name="calls"><c>IList</c> of calls</param>
+        /// <returns><c>ArrayList</c> of results/faults.</returns>
+        [XmlRpcExposed]
+        public IList multiCall(IList calls)
+        {
+            IList responses = new ArrayList();
+            XmlRpcResponse fault = new XmlRpcResponse();
+
+            foreach (IDictionary call in calls)
+            {
+                try
+                {
+                    XmlRpcRequest req = new XmlRpcRequest((String)call[XmlRpcXmlTokens.METHOD_NAME],
+                                          (ArrayList)call[XmlRpcXmlTokens.PARAMS]);
+                    Object results = _server.Invoke(req);
+                    IList response = new ArrayList();
+                    response.Add(results);
+                    responses.Add(response);
+                }
+                catch (XmlRpcException e)
+                {
+                    fault.SetFault(e.FaultCode, e.FaultString);
+                    responses.Add(fault.Value);
+                }
+                catch (Exception e2)
+                {
+                    fault.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR,
+                               XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
+                    responses.Add(fault.Value);
+                }
+            }
+
+            return responses;
+        }
+
+    }
+}
+

+ 76 - 0
Common/XmlRpcCS/XmlRpcXmlTokens.cs

@@ -0,0 +1,76 @@
+namespace Nwc.XmlRpc
+{
+    using System;
+
+    /// <summary>Class collecting <c>String</c> tokens that are part of XML-RPC files.</summary>
+    public class XmlRpcXmlTokens
+    {
+        /// <summary>C# formatting string to describe an ISO 8601 date.</summary>
+        public const String ISO_DATETIME = "yyyyMMdd\\THH\\:mm\\:ss";
+        /// <summary>Base64 field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;base64&gt; tag.</remarks>
+        public const String BASE64 = "base64";
+        /// <summary>String field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;string&gt; tag.</remarks>
+        public const String STRING = "string";
+        /// <summary>Integer field integer.</summary>
+        /// <remarks>Corresponds to the &lt;i4&gt; tag.</remarks>
+        public const String INT = "i4";
+        /// <summary>Alternate integer field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;int&gt; tag.</remarks>
+        public const String ALT_INT = "int";
+        /// <summary>Date field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;dateTime.iso8601&gt; tag.</remarks>
+        public const String DATETIME = "dateTime.iso8601";
+        /// <summary>Boolean field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;boolean&gt; tag.</remarks>
+        public const String BOOLEAN = "boolean";
+        /// <summary>Value token.</summary>
+        /// <remarks>Corresponds to the &lt;value&gt; tag.</remarks>
+        public const String VALUE = "value";
+        /// <summary>Name token.</summary>
+        /// <remarks>Corresponds to the &lt;name&gt; tag.</remarks>
+        public const String NAME = "name";
+        /// <summary>Array field indicator..</summary>
+        /// <remarks>Corresponds to the &lt;array&gt; tag.</remarks>
+        public const String ARRAY = "array";
+        /// <summary>Data token.</summary>
+        /// <remarks>Corresponds to the &lt;data&gt; tag.</remarks>
+        public const String DATA = "data";
+        /// <summary>Member token.</summary>
+        /// <remarks>Corresponds to the &lt;member&gt; tag.</remarks>
+        public const String MEMBER = "member";
+        /// <summary>Stuct field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;struct&gt; tag.</remarks>
+        public const String STRUCT = "struct";
+        /// <summary>Double field indicator.</summary>
+        /// <remarks>Corresponds to the &lt;double&gt; tag.</remarks>
+        public const String DOUBLE = "double";
+        /// <summary>Param token.</summary>
+        /// <remarks>Corresponds to the &lt;param&gt; tag.</remarks>
+        public const String PARAM = "param";
+        /// <summary>Params token.</summary>
+        /// <remarks>Corresponds to the &lt;params&gt; tag.</remarks>
+        public const String PARAMS = "params";
+        /// <summary>MethodCall token.</summary>
+        /// <remarks>Corresponds to the &lt;methodCall&gt; tag.</remarks>
+        public const String METHOD_CALL = "methodCall";
+        /// <summary>MethodName token.</summary>
+        /// <remarks>Corresponds to the &lt;methodName&gt; tag.</remarks>
+        public const String METHOD_NAME = "methodName";
+        /// <summary>MethodResponse token</summary>
+        /// <remarks>Corresponds to the &lt;methodResponse&gt; tag.</remarks>
+        public const String METHOD_RESPONSE = "methodResponse";
+        /// <summary>Fault response token.</summary>
+        /// <remarks>Corresponds to the &lt;fault&gt; tag.</remarks>
+        public const String FAULT = "fault";
+        /// <summary>FaultCode token.</summary>
+        /// <remarks>Corresponds to the &lt;faultCode&gt; tag.</remarks>
+        public const String FAULT_CODE = "faultCode";
+        /// <summary>FaultString token.</summary>
+        /// <remarks>Corresponds to the &lt;faultString&gt; tag.</remarks>
+        public const String FAULT_STRING = "faultString";
+    }
+}
+
+

+ 100 - 0
OpenGridServices.build

@@ -0,0 +1,100 @@
+<?xml version="1.0" ?>
+<project name="OpenGridServices" default="build">
+    <echo message="Using '${nant.settings.currentframework}' Framework"/>
+
+    <property name="bin.dir" value="bin" />
+    <property name="obj.dir" value="obj" />
+    <property name="doc.dir" value="doc" />
+    <property name="project.main.dir" value="${project::get-base-directory()}" />
+
+    <target name="Debug" description="">
+        <property name="project.config" value="Debug" />
+        <property name="build.debug" value="true" />
+    </target>
+
+    <property name="project.config" value="Release" />
+
+    <target name="Release" description="">
+        <property name="project.config" value="Release" />
+        <property name="build.debug" value="false" />
+    </target>
+
+    <target name="net-1.1" description="Sets framework to .NET 1.1">
+        <property name="nant.settings.currentframework" value="net-1.1" />
+    </target>
+
+    <target name="net-2.0" description="Sets framework to .NET 2.0">
+        <property name="nant.settings.currentframework" value="net-2.0" />
+    </target>
+
+    <target name="mono-2.0" description="Sets framework to mono 2.0">
+        <property name="nant.settings.currentframework" value="mono-2.0" />
+    </target>
+
+    <target name="mono-1.0" description="Sets framework to mono 1.0">
+        <property name="nant.settings.currentframework" value="mono-1.0" />
+    </target>
+
+    <target name="init" description="">
+        <call target="${project.config}" />
+        <sysinfo />
+        <echo message="Platform ${sys.os.platform}" />
+        <property name="build.dir" value="${bin.dir}/${project.config}" />
+    </target>
+
+    <target name="clean" description="">
+        <echo message="Deleting all builds from all configurations" />
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+        <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="clean" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="clean" />
+    </target>
+
+    <target name="build" depends="init" description="">
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="build" />
+        <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="build" />
+    </target>
+
+    <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
+
+    <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
+
+    <target name="package" depends="clean, doc" description="Builds all" />
+
+    <target name="doc" depends="build-release">
+        <echo message="Generating all documentation from all builds" />
+        <nant buildfile="OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/ServiceManager/ServiceManager.exe.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="doc" />
+        <nant buildfile="OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build" target="doc" />
+    </target>
+
+</project>

+ 85 - 0
OpenGridServices.sln

@@ -0,0 +1,85 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C# Express 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenUser.Config.UserConfigDb4o", "OpenGridServices\OpenUser.Config\UserConfigDb4o\OpenUser.Config.UserConfigDb4o.csproj", "{7E494328-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.AssetServer", "OpenGridServices\OpenGridServices.AssetServer\OpenGridServices.AssetServer.csproj", "{0021261B-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Config.GridConfigDb4o", "OpenGridServices\OpenGrid.Config\GridConfigDb4o\OpenGrid.Config.GridConfigDb4o.csproj", "{B0027747-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.SQLite", "OpenGridServices\OpenGrid.Framework.Data.SQLite\OpenGrid.Framework.Data.SQLite.csproj", "{1E3F341A-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.DB4o", "OpenGridServices\OpenGrid.Framework.Data.DB4o\OpenGrid.Framework.Data.DB4o.csproj", "{39BD9497-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceManager", "OpenGridServices\ServiceManager\ServiceManager.csproj", "{E141F4EE-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Manager", "OpenGridServices\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj", "{7924FD35-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.GridServer", "OpenGridServices\OpenGridServices.GridServer\OpenGridServices.GridServer.csproj", "{21BFC8E2-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MSSQL", "OpenGridServices\OpenGrid.Framework.Data.MSSQL\OpenGrid.Framework.Data.MSSQL.csproj", "{0A563AC1-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data", "OpenGridServices\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj", "{62CDF671-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.UserServer", "OpenGridServices\OpenGridServices.UserServer\OpenGridServices.UserServer.csproj", "{66591469-0000-0000-0000-000000000000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MySQL", "OpenGridServices\OpenGrid.Framework.Data.MySQL\OpenGrid.Framework.Data.MySQL.csproj", "{0F3C3AC1-0000-0000-0000-000000000000}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

BIN
OpenGridServices.suo


+ 31 - 0
OpenGridServices/OpenGrid.Config/GridConfigDb4o/AssemblyInfo.cs

@@ -0,0 +1,31 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("GridConfig")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("GridConfig")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]

+ 112 - 0
OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs

@@ -0,0 +1,112 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*     * Redistributions of source code must retain the above copyright
+*       notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above copyright
+*       notice, this list of conditions and the following disclaimer in the
+*       documentation and/or other materials provided with the distribution.
+*     * Neither the name of the <organization> nor the
+*       names of its contributors may be used to endorse or promote products
+*       derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+* 
+*/
+using System;
+using System.Collections.Generic;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Interfaces;
+using Db4objects.Db4o;
+
+namespace OpenGrid.Config.GridConfigDb4o
+{
+	public class Db40ConfigPlugin: IGridConfig
+	{
+		public GridConfig GetConfigObject()
+		{
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll");
+			return ( new DbGridConfig());
+		}
+	}
+	
+	public class DbGridConfig : GridConfig
+	{
+		private IObjectContainer db;	
+		
+		public void LoadDefaults() {
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
+			
+			this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team");
+
+			this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/");
+            		this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server","null");
+            		this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server","null");
+
+		        this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/");
+            		this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server","null");
+            		this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server","null");
+
+            		this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims","null");
+            		this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims","null");
+		}
+
+		public override void InitConfig() {
+			try {
+				db = Db4oFactory.OpenFile("opengrid.yap");
+				IObjectSet result = db.Get(typeof(DbGridConfig));
+				if(result.Count==1) {
+					OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
+					foreach (DbGridConfig cfg in result) {
+						this.GridOwner=cfg.GridOwner;
+						this.DefaultAssetServer=cfg.DefaultAssetServer;
+						this.AssetSendKey=cfg.AssetSendKey;
+						this.AssetRecvKey=cfg.AssetRecvKey;
+						this.DefaultUserServer=cfg.DefaultUserServer;
+						this.UserSendKey=cfg.UserSendKey;
+						this.UserRecvKey=cfg.UserRecvKey;
+						this.SimSendKey=cfg.SimSendKey;
+						this.SimRecvKey=cfg.SimRecvKey;
+					}
+				} else {
+					OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
+					LoadDefaults();
+					OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Writing out default settings to local database");
+					db.Set(this);
+					db.Close();
+				}
+			} catch(Exception e) {
+				OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured");
+                OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString());
+			}
+			
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid settings loaded:");
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid owner: " + this.GridOwner);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default asset server: " + this.DefaultAssetServer);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to asset server: " + this.AssetSendKey);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from asset server: " + this.AssetRecvKey);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default user server: " + this.DefaultUserServer);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to user server: " + this.UserSendKey);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from user server: " + this.UserRecvKey);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to sims: " + this.SimSendKey);
+			OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from sims: " + this.SimRecvKey);
+		}
+	
+
+		public void Shutdown() {
+			db.Close();
+		}
+	}
+	
+}

+ 107 - 0
OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj

@@ -0,0 +1,107 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{B0027747-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenGrid.Config.GridConfigDb4o</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenGrid.Config.GridConfigDb4o</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data.dll" >
+      <HintPath>..\..\..\bin\System.Data.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="libsecondlife.dll" >
+      <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Db4objects.Db4o.dll" >
+      <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="OpenSim.Framework" >
+      <HintPath>OpenSim.Framework.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="OpenSim.Framework.Console" >
+      <HintPath>OpenSim.Framework.Console.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DbGridConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 46 - 0
OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build

@@ -0,0 +1,46 @@
+<?xml version="1.0" ?>
+<project name="OpenGrid.Config.GridConfigDb4o" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenGrid.Config.GridConfigDb4o" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="AssemblyInfo.cs" />
+                <include name="DbGridConfig.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Data.dll.dll" />
+                <include name="System.Xml.dll" />
+                <include name="../../../bin/libsecondlife.dll" />
+                <include name="../../../bin/Db4objects.Db4o.dll" />
+                <include name="../../../bin/OpenSim.Framework.dll" />
+                <include name="../../../bin/OpenSim.Framework.Console.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 83 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs

@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenGrid.Framework.Data;
+using libsecondlife;
+
+
+namespace OpenGrid.Framework.Data.DB4o
+{
+    class DB4oGridData : IGridData
+    {
+        DB4oGridManager manager;
+
+        public void Initialise() {
+             manager = new DB4oGridManager("gridserver.yap");
+        }
+
+        public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
+        {
+            return null;
+        }
+
+        public SimProfileData GetProfileByHandle(ulong handle) {
+            lock (manager.simProfiles)
+            {
+                foreach (LLUUID UUID in manager.simProfiles.Keys)
+                {
+                    if (manager.simProfiles[UUID].regionHandle == handle)
+                    {
+                        return manager.simProfiles[UUID];
+                    }
+                }
+            }
+            throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")");
+        }
+
+        public SimProfileData GetProfileByLLUUID(LLUUID uuid)
+        {
+            lock (manager.simProfiles)
+            {
+                if (manager.simProfiles.ContainsKey(uuid))
+                    return manager.simProfiles[uuid];
+            }
+            throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
+        }
+
+        public DataResponse AddProfile(SimProfileData profile)
+        {
+            lock (manager.simProfiles)
+            {
+                if (manager.AddRow(profile))
+                {
+                    return DataResponse.RESPONSE_OK;
+                }
+                else
+                {
+                    return DataResponse.RESPONSE_ERROR;
+                }
+            }
+        }
+
+        public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
+            if (manager.simProfiles[uuid].regionRecvKey == key)
+                return true;
+            return false;
+        }
+
+        public void Close()
+        {
+            manager = null;
+        }
+
+        public string getName()
+        {
+            return "DB4o Grid Provider";
+        }
+
+        public string getVersion()
+        {
+            return "0.1";
+        }
+    }
+}

+ 111 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs

@@ -0,0 +1,111 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Db4objects.Db4o;
+using OpenGrid.Framework.Data;
+using libsecondlife;
+
+namespace OpenGrid.Framework.Data.DB4o
+{
+    class DB4oGridManager
+    {
+        public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>();
+        string dbfl;
+
+        public DB4oGridManager(string db4odb)
+        {
+            dbfl = db4odb;
+            IObjectContainer database;
+            database = Db4oFactory.OpenFile(dbfl);
+            IObjectSet result = database.Get(typeof(SimProfileData));
+            foreach(SimProfileData row in result) {
+                simProfiles.Add(row.UUID, row);
+            }
+            database.Close();
+        }
+
+        /// <summary>
+        /// Adds a new profile to the database (Warning: Probably slow.)
+        /// </summary>
+        /// <param name="row">The profile to add</param>
+        /// <returns>Successful?</returns>
+        public bool AddRow(SimProfileData row)
+        {
+            if (simProfiles.ContainsKey(row.UUID))
+            {
+                simProfiles[row.UUID] = row;
+            }
+            else
+            {
+                simProfiles.Add(row.UUID, row);
+            }
+
+            try
+            {
+                IObjectContainer database;
+                database = Db4oFactory.OpenFile(dbfl);
+                database.Set(row);
+                database.Close();
+                return true;
+            }
+            catch (Exception e)
+            {
+                return false;
+            }
+        }
+
+
+    }
+
+    class DB4oUserManager
+    {
+        public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
+        string dbfl;
+
+        public DB4oUserManager(string db4odb)
+        {
+            dbfl = db4odb;
+            IObjectContainer database;
+            database = Db4oFactory.OpenFile(dbfl);
+            IObjectSet result = database.Get(typeof(UserProfileData));
+            foreach (UserProfileData row in result)
+            {
+                userProfiles.Add(row.UUID, row);
+            }
+            database.Close();
+        }
+
+        /// <summary>
+        /// Adds a new profile to the database (Warning: Probably slow.)
+        /// </summary>
+        /// <param name="row">The profile to add</param>
+        /// <returns>Successful?</returns>
+        public bool AddRow(UserProfileData row)
+        {
+            Console.WriteLine("adding profile to database" + row.username);
+            if (userProfiles.ContainsKey(row.UUID))
+            {
+                userProfiles[row.UUID] = row;
+            }
+            else
+            {
+                userProfiles.Add(row.UUID, row);
+            }
+
+            try
+            {
+                IObjectContainer database;
+                database = Db4oFactory.OpenFile(dbfl);
+                database.Set(row);
+                database.Close();
+                return true;
+            }
+            catch (Exception e)
+            {
+                return false;
+            }
+        }
+
+
+    }
+}

+ 100 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs

@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenGrid.Framework.Data;
+using libsecondlife;
+
+namespace OpenGrid.Framework.Data.DB4o
+{
+    public class DB4oUserData : IUserData
+    {
+        DB4oUserManager manager;
+
+        public void Initialise()
+        {
+            manager = new DB4oUserManager("userprofiles.yap");
+        }
+
+        public UserProfileData getUserByUUID(LLUUID uuid)
+        {
+            if(manager.userProfiles.ContainsKey(uuid))
+                return manager.userProfiles[uuid];
+            return null;
+        }
+
+        public UserProfileData getUserByName(string name)
+        {
+            return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
+        }
+
+        public UserProfileData getUserByName(string fname, string lname)
+        {
+            foreach (UserProfileData profile in manager.userProfiles.Values)
+            {
+                if (profile.username == fname && profile.surname == lname)
+                    return profile;
+            }
+            return null;
+        }
+
+        public UserAgentData getAgentByUUID(LLUUID uuid)
+        {   
+            try
+            {
+                return getUserByUUID(uuid).currentAgent;
+            }
+            catch (Exception e)
+            {
+                return null;
+            }
+        }
+
+        public UserAgentData getAgentByName(string name)
+        {
+            return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
+        }
+
+        public UserAgentData getAgentByName(string fname, string lname)
+        {
+            try
+            {
+                return getUserByName(fname,lname).currentAgent;
+            }
+            catch (Exception e)
+            {
+                return null;
+            }
+        }
+
+        public void addNewUserProfile(UserProfileData user)
+        {
+            manager.AddRow(user);
+        }
+
+        public void addNewUserAgent(UserAgentData agent)
+        {
+            // Do nothing. yet.
+        }
+
+        public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
+        {
+            return true;
+        }
+
+        public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
+        {
+            return true;
+        }
+
+
+        public string getName()
+        {
+            return "DB4o Userdata";
+        }
+
+        public string getVersion()
+        {
+            return "0.1";
+        }
+    }
+}

+ 111 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj

@@ -0,0 +1,111 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{39BD9497-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data" >
+      <HintPath>System.Data.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="libsecondlife.dll" >
+      <HintPath>..\..\bin\libsecondlife.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Db4objects.Db4o.dll" >
+      <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
+      <Name>OpenGrid.Framework.Data</Name>
+      <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="DB4oGridData.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DB4oManager.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DB4oUserData.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

+ 12 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj.user

@@ -0,0 +1,12 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
+    <LastOpenVersion>8.0.50727</LastOpenVersion>
+    <ProjectView>ProjectFiles</ProjectView>
+    <ProjectTrust>0</ProjectTrust>
+  </PropertyGroup>
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
+  <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+</Project>

+ 47 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build

@@ -0,0 +1,47 @@
+<?xml version="1.0" ?>
+<project name="OpenGrid.Framework.Data.DB4o" default="build">
+    <target name="build">
+        <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
+        <mkdir dir="${project::get-base-directory()}/${build.dir}" />
+        <copy todir="${project::get-base-directory()}/${build.dir}">
+            <fileset basedir="${project::get-base-directory()}">
+            </fileset>
+        </copy>
+        <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
+            <resources prefix="OpenGrid.Framework.Data.DB4o" dynamicprefix="true" >
+            </resources>
+            <sources failonempty="true">
+                <include name="DB4oGridData.cs" />
+                <include name="DB4oManager.cs" />
+                <include name="DB4oUserData.cs" />
+                <include name="Properties/AssemblyInfo.cs" />
+            </sources>
+            <references basedir="${project::get-base-directory()}">
+                <lib>
+                    <include name="${project::get-base-directory()}" />
+                    <include name="${project::get-base-directory()}/${build.dir}" />
+                </lib>
+                <include name="System.dll" />
+                <include name="System.Xml.dll" />
+                <include name="System.Data.dll" />
+                <include name="../../bin/OpenGrid.Framework.Data.dll" />
+                <include name="../../bin/libsecondlife.dll" />
+                <include name="../../bin/Db4objects.Db4o.dll" />
+            </references>
+        </csc>
+        <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
+        <mkdir dir="${project::get-base-directory()}/../../bin/"/>
+        <copy todir="${project::get-base-directory()}/../../bin/">
+            <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
+                <include name="*.dll"/>
+                <include name="*.exe"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="${bin.dir}" failonerror="false" />
+        <delete dir="${obj.dir}" failonerror="false" />
+    </target>
+    <target name="doc" description="Creates documentation.">
+    </target>
+</project>

+ 35 - 0
OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenGrid.Framework.Data.DB4o")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")]
+[assembly: AssemblyCopyright("Copyright ©  2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 136 - 0
OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs

@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OpenGrid.Framework.Data;
+
+namespace OpenGrid.Framework.Data.MSSQL
+{
+    public class SqlGridData : IGridData
+    {
+        private MSSqlManager database;
+
+        /// <summary>
+        /// Initialises the Grid Interface
+        /// </summary>
+        public void Initialise()
+        {
+            database = new MSSqlManager("localhost", "db", "user", "password", "false");
+        }
+
+        /// <summary>
+        /// Shuts down the grid interface
+        /// </summary>
+        public void Close()
+        {
+            database.Close();
+        }
+
+        public string getName()
+        {
+            return "Sql OpenGridData";
+        }
+
+        public string getVersion()
+        {
+            return "0.1";
+        }
+
+        public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
+        {
+            return null;
+        }
+
+        /// <summary>
+        /// Returns a sim profile from it's location
+        /// </summary>
+        /// <param name="handle">Region location handle</param>
+        /// <returns>Sim profile</returns>
+        public SimProfileData GetProfileByHandle(ulong handle)
+        {
+            Dictionary<string, string> param = new Dictionary<string, string>();
+            param["handle"] = handle.ToString();
+
+            System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param);
+            System.Data.IDataReader reader = result.ExecuteReader();
+
+            SimProfileData row = database.getRow(reader);
+            reader.Close();
+            result.Dispose();
+
+            return row;
+        }
+
+        /// <summary>
+        /// Returns a sim profile from it's UUID
+        /// </summary>
+        /// <param name="uuid">The region UUID</param>
+        /// <returns>The sim profile</returns>
+        public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
+        {
+            Dictionary<string, string> param = new Dictionary<string, string>();
+            param["uuid"] = uuid.ToStringHyphenated();
+
+            System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
+            System.Data.IDataReader reader = result.ExecuteReader();
+
+            SimProfileData row = database.getRow(reader);
+            reader.Close();
+            result.Dispose();
+
+            return row;
+        }
+
+        public DataResponse AddProfile(SimProfileData profile)
+        {
+            if (database.insertRow(profile))
+            {
+                return DataResponse.RESPONSE_OK;
+            }
+            else
+            {
+                return DataResponse.RESPONSE_ERROR;
+            }
+        }
+
+        /// <summary>
+        /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
+        /// </summary>
+        /// <param name="uuid">The UUID of the challenger</param>
+        /// <param name="handle">The attempted regionHandle of the challenger</param>
+        /// <param name="authkey">The secret</param>
+        /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
+        public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
+        {
+            bool throwHissyFit = false; // Should be true by 1.0
+
+            if (throwHissyFit)
+                throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
+
+            SimProfileData data = GetProfileByLLUUID(uuid);
+
+            return (handle == data.regionHandle && authkey == data.regionSecret);
+        }
+
+        /// <summary>
+        /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
+        /// </summary>
+        /// <remarks>This requires a security audit.</remarks>
+        /// <param name="uuid"></param>
+        /// <param name="handle"></param>
+        /// <param name="authhash"></param>
+        /// <param name="challenge"></param>
+        /// <returns></returns>
+        public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
+        {
+            System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
+            System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
+
+            byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
+            byte[] hash = HashProvider.ComputeHash(stream);
+
+            return false;
+        }
+    }
+
+
+}

+ 171 - 0
OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs

@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+using System.Data.SqlClient;
+
+using OpenGrid.Framework.Data;
+
+namespace OpenGrid.Framework.Data.MSSQL
+{
+    class MSSqlManager
+    {
+        IDbConnection dbcon;
+
+        /// <summary>
+        /// Initialises and creates a new Sql connection and maintains it.
+        /// </summary>
+        /// <param name="hostname">The Sql server being connected to</param>
+        /// <param name="database">The name of the Sql database being used</param>
+        /// <param name="username">The username logging into the database</param>
+        /// <param name="password">The password for the user logging in</param>
+        /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
+        public MSSqlManager(string hostname, string database, string username, string password, string cpooling)
+        {
+            try
+            {
+                string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
+                dbcon = new SqlConnection(connectionString);
+
+                dbcon.Open();
+            }
+            catch (Exception e)
+            {
+                throw new Exception("Error initialising Sql Database: " + e.ToString());
+            }
+        }
+
+        /// <summary>
+        /// Shuts down the database connection
+        /// </summary>
+        public void Close()
+        {
+            dbcon.Close();
+            dbcon = null;
+        }
+
+        /// <summary>
+        /// Runs a query with protection against SQL Injection by using parameterised input.
+        /// </summary>
+        /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
+        /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
+        /// <returns>A Sql DB Command</returns>
+        public IDbCommand Query(string sql, Dictionary<string, string> parameters)
+        {
+            SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand();
+            dbcommand.CommandText = sql;
+            foreach (KeyValuePair<string, string> param in parameters)
+            {
+                dbcommand.Parameters.AddWithValue(param.Key, param.Value);
+            }
+
+            return (IDbCommand)dbcommand;
+        }
+
+        public SimProfileData getRow(IDataReader reader)
+        {
+            SimProfileData retval = new SimProfileData();
+
+            if (reader.Read())
+            {
+                // Region Main
+                retval.regionHandle = (ulong)reader["regionHandle"];
+                retval.regionName = (string)reader["regionName"];
+                retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
+
+                // Secrets
+                retval.regionRecvKey = (string)reader["regionRecvKey"];
+                retval.regionSecret = (string)reader["regionSecret"];
+                retval.regionSendKey = (string)reader["regionSendKey"];
+
+                // Region Server
+                retval.regionDataURI = (string)reader["regionDataURI"];
+                retval.regionOnline = false; // Needs to be pinged before this can be set.
+                retval.serverIP = (string)reader["serverIP"];
+                retval.serverPort = (uint)reader["serverPort"];
+                retval.serverURI = (string)reader["serverURI"];
+
+                // Location
+                retval.regionLocX = (uint)((int)reader["locX"]);
+                retval.regionLocY = (uint)((int)reader["locY"]);
+                retval.regionLocZ = (uint)((int)reader["locZ"]);
+
+                // Neighbours - 0 = No Override
+                retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"];
+                retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"];
+                retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"];
+                retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"];
+
+                // Assets
+                retval.regionAssetURI = (string)reader["regionAssetURI"];
+                retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
+                retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
+
+                // Userserver
+                retval.regionUserURI = (string)reader["regionUserURI"];
+                retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
+                retval.regionUserSendKey = (string)reader["regionUserSendKey"];
+            }
+            else
+            {
+                throw new Exception("No rows to return");
+            }
+            return retval;
+        }
+
+        public bool insertRow(SimProfileData profile)
+        {
+            string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
+            sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
+            sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
+
+            sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
+            sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
+            sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
+
+            Dictionary<string, string> parameters = new Dictionary<string, string>();
+
+            parameters["regionHandle"] = profile.regionHandle.ToString();
+            parameters["regionName"] = profile.regionName;
+            parameters["uuid"] = profile.UUID.ToString();
+            parameters["regionRecvKey"] = profile.regionRecvKey;
+            parameters["regionSendKey"] = profile.regionSendKey;
+            parameters["regionDataURI"] = profile.regionDataURI;
+            parameters["serverIP"] = profile.serverIP;
+            parameters["serverPort"] = profile.serverPort.ToString();
+            parameters["serverURI"] = profile.serverURI;
+            parameters["locX"] = profile.regionLocX.ToString();
+            parameters["locY"] = profile.regionLocY.ToString();
+            parameters["locZ"] = profile.regionLocZ.ToString();
+            parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
+            parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
+            parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
+            parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
+            parameters["regionAssetURI"] = profile.regionAssetURI;
+            parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
+            parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
+            parameters["regionUserURI"] = profile.regionUserURI;
+            parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
+            parameters["regionUserSendKey"] = profile.regionUserSendKey;
+
+            bool returnval = false;
+
+            try
+            {
+                IDbCommand result = Query(sql, parameters);
+
+                if (result.ExecuteNonQuery() == 1)
+                    returnval = true;
+
+                result.Dispose();
+            }
+            catch (Exception e)
+            {
+                return false;
+            }
+
+            return returnval;
+        }
+    }
+}

+ 104 - 0
OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj

@@ -0,0 +1,104 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{0A563AC1-0000-0000-0000-000000000000}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon></ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>OpenGrid.Framework.Data.MSSQL</AssemblyName>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder></AppDesignerFolder>
+    <RootNamespace>OpenGrid.Framework.Data.MSSQL</RootNamespace>
+    <StartupObject></StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;DEBUG</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>True</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>False</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile></DocumentationFile>
+    <DebugSymbols>False</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <Optimize>True</Optimize>
+    <OutputPath>..\..\bin\</OutputPath>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <RemoveIntegerChecks>False</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn></NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" >
+      <HintPath>System.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml" >
+      <HintPath>System.Xml.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data" >
+      <HintPath>System.Data.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="libsecondlife.dll" >
+      <HintPath>..\..\bin\libsecondlife.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
+      <Name>OpenGrid.Framework.Data</Name>
+      <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+			<Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MSSQLGridData.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MSSQLManager.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

Some files were not shown because too many files changed in this diff