From 80cbd468ea4dca31c0bf28607f4ab3ed3963f765 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 8 May 2008 04:34:02 +0000 Subject: * Some refactorings. * Added shell of new Python scripting engine. Similar in design to the one used by Rex, but will be structured at a region rather than object level, also is a region module. --- .../Modules/Python/Properties/AssemblyInfo.cs | 36 ++++++++++++++++ OpenSim/Region/Modules/Python/PythonAPI/Console.cs | 21 ++++++++++ OpenSim/Region/Modules/Python/PythonModule.cs | 48 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Modules/Python/PythonAPI/Console.cs create mode 100644 OpenSim/Region/Modules/Python/PythonModule.cs (limited to 'OpenSim/Region/Modules') diff --git a/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs b/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e4d7852 --- /dev/null +++ b/OpenSim/Region/Modules/Python/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Python")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Python")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[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("5bd55f67-385d-4a43-893a-b5d2ea43f07d")] + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Modules/Python/PythonAPI/Console.cs b/OpenSim/Region/Modules/Python/PythonAPI/Console.cs new file mode 100644 index 0000000..0d23dc6 --- /dev/null +++ b/OpenSim/Region/Modules/Python/PythonAPI/Console.cs @@ -0,0 +1,21 @@ +using System; +using System.Reflection; +using log4net; + +namespace OpenSim.Region.Modules.Python.PythonAPI +{ + class Console + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public void WriteLine(string txt) + { + m_log.Info(txt); + } + + public void WriteLine(string txt, params Object[] e) + { + m_log.Info(String.Format(txt, e)); + } + } +} diff --git a/OpenSim/Region/Modules/Python/PythonModule.cs b/OpenSim/Region/Modules/Python/PythonModule.cs new file mode 100644 index 0000000..142a7df --- /dev/null +++ b/OpenSim/Region/Modules/Python/PythonModule.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Security.Policy; +using System.Text; +using IronPython.Hosting; +using log4net; +using Nini.Config; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.Modules.Python +{ + class PythonModule : IRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private PythonEngine m_python; + + public void Initialise(Scene scene, IConfigSource source) + { + + } + + public void PostInitialise() + { + /* + m_log.Info("[PYTHON] Initialising IronPython engine."); + m_python = new PythonEngine(); + m_python.AddToPath(System.Environment.CurrentDirectory + System.IO.Path.DirectorySeparatorChar + "Python"); + */ + } + + public void Close() + { + + } + + public string Name + { + get { return "PythonModule"; } + } + + public bool IsSharedModule + { + get { return true; } + } + } +} -- cgit v1.1