+//
+// Radegast Metaverse Client
+// Copyright (c) 2009, Radegast Development Team
+// 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 application "Radegast", 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+//
+// $Id$
+//
namespace Radegast
{
+ /// <summary>
+ /// Interface of Radegast plugins
+ /// </summary>
public interface IRadegastPlugin
{
+ /// <summary>
+ /// Called in plugin initialization
+ /// </summary>
+ /// <param name="inst">RadegastInstance plugin is loaded into</param>
void StartPlugin(RadegastInstance inst);
+
+ /// <summary>
+ /// Called on plugin shutdown
+ /// </summary>
+ /// <param name="inst">RadegastInstance plugin is unloaded from</param>
void StopPlugin(RadegastInstance inst);
}
-}
\ No newline at end of file
+}
--- /dev/null
+//
+// Radegast Metaverse Client
+// Copyright (c) 2009, Radegast Development Team
+// 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 application "Radegast", 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+//
+// $Id$
+//
+using System;
+
+namespace Radegast
+{
+ /// <summary>
+ /// Metadata about Radegast Plugins
+ /// </summary>
+ public class PluginAttribute : Attribute
+ {
+ /// <summary>Plugin short name</summary>
+ public string Name = string.Empty;
+
+ /// <summary>Plugin description</summary>
+ public string Description = string.Empty;
+
+ /// <summary>Plugin version</summary>
+ public string Version = string.Empty;
+ }
+}
}
}
+ public static PluginAttribute GetAttributes(IRadegastPlugin plug)
+ {
+ PluginAttribute a = null;
+
+ foreach(Attribute attr in Attribute.GetCustomAttributes(plug.GetType()))
+ {
+ if (attr is PluginAttribute)
+ a = (PluginAttribute)attr;
+ }
+
+ if (a == null)
+ {
+ a = new PluginAttribute();
+ a.Name = plug.GetType().FullName;
+ }
+
+ return a;
+ }
+
public void StartPlugins()
{
lock (PluginsLoaded)
lock (PluginsLoaded) PluginsLoaded.Add(plug);
if (startPlugins && plug != null)
{
- plug.StartPlugin(instance);
+ try { plug.StartPlugin(instance); }
+ catch (Exception ex) { Logger.Log(string.Format("Failed starting plugin {0}:", type), Helpers.LogLevel.Error, ex); }
}
}
catch (Exception ex)
<Compile Include="Core\Media\MediaObject.cs" />\r
<Compile Include="Core\Media\Sound.cs" />\r
<Compile Include="Core\PluginInterface\IRadegastPlugin.cs" />\r
+ <Compile Include="Core\PluginInterface\PluginAttribute.cs" />\r
<Compile Include="Core\PluginInterface\PluginManager.cs" />\r
<Compile Include="Core\RLV\RLVEventArgs.cs" />\r
<Compile Include="Core\RLV\RLVManager.cs" />\r
namespace Radegast.Plugin.Alice
{
- public class DemoPlugin : IRadegastPlugin
+ [Radegast.Plugin(Name = "ALICE Chatbot", Description = "A.L.I.C.E. based AI chat bot", Version = "1.0")]
+ public class AliceAI : IRadegastPlugin
{
private RadegastInstance Instance;
private GridClient Client { get { return Instance.Client; } }
namespace Radegast.Plugin.Demo
{
+ [Radegast.Plugin(Name="Demo Plugin", Description="Demontration of plugin capabilites", Version="1.0")]
public class DemoPlugin : IRadegastPlugin
{
private RadegastInstance Instance;
namespace RadegastSpeech
{
+ [Radegast.Plugin(Name = "Speech", Description = "Adds TTS and STT accesibility capabilities to Radegast", Version = "0.3")]
public class PluginControl : IRadegastPlugin
{
private const string VERSION = "0.3";