Open sourced NatiBot

This commit is contained in:
2014-09-04 04:26:22 +01:00
parent 0c66d4a2ea
commit e4b4c631af
301 changed files with 84837 additions and 7 deletions

View File

@@ -0,0 +1,90 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : AboutCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Text;
public class AboutCommand : Command
{
public AboutCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "about";
base.Description = bot.Localization.clResourceManager.getText("Commands.About.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
bot.license.Version botVersion = new bot.license.Version();
StringBuilder sbAbout = new StringBuilder();
sbAbout.AppendLine();
sbAbout.Append("NatiBot " + botVersion.ToString() + " " + botVersion.v_rev);
sbAbout.AppendLine();
sbAbout.Append("© 2009-2010 Claunia.com " + bot.Localization.clResourceManager.getText("frmAbout.Copyright"));
sbAbout.AppendLine();
sbAbout.AppendLine();
sbAbout.Append(bot.Localization.clResourceManager.getText("frmAbout.Coding"));
sbAbout.Append("Natalia Portillo");
sbAbout.AppendLine();
sbAbout.Append(bot.Localization.clResourceManager.getText("frmAbout.Interface"));
sbAbout.Append("Ana Sánchez");
sbAbout.AppendLine();
sbAbout.AppendFormat(bot.Localization.clResourceManager.getText("frmAbout.TranslationOrder"),
bot.Localization.clResourceManager.getText("frmAbout.Translation"),
bot.Localization.clResourceManager.getText("Language.English"),
"Natalia Portillo");
sbAbout.AppendLine();
sbAbout.AppendFormat(bot.Localization.clResourceManager.getText("frmAbout.TranslationOrder"),
bot.Localization.clResourceManager.getText("frmAbout.Translation"),
bot.Localization.clResourceManager.getText("Language.Spanish"),
"Natalia Portillo");
sbAbout.AppendLine();
sbAbout.AppendFormat(bot.Localization.clResourceManager.getText("frmAbout.TranslationOrder"),
bot.Localization.clResourceManager.getText("frmAbout.Translation"),
bot.Localization.clResourceManager.getText("Language.Catalan"),
"Alejandro Sánchez");
sbAbout.AppendLine();
sbAbout.AppendFormat(bot.Localization.clResourceManager.getText("frmAbout.TranslationOrder"),
bot.Localization.clResourceManager.getText("frmAbout.Translation"),
bot.Localization.clResourceManager.getText("Language.French"),
"Natalia Portillo & Google");
sbAbout.AppendLine();
return sbAbout.ToString();
}
}
}

View File

@@ -0,0 +1,59 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ChangelogCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class ChangelogCommand : Command
{
public ChangelogCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "changelog";
base.Description = bot.Localization.clResourceManager.getText("Commands.Changelog.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
bot.license.Version botVersion = new bot.license.Version();
StringBuilder builder = new StringBuilder();
builder.AppendLine("NatiBot " + botVersion.ToString());
builder.AppendLine(botVersion.Changelog);
return builder.ToString();
}
}
}

View File

@@ -0,0 +1,68 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ClientTagsCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
public class ClientTagsCommand : Command
{
public ClientTagsCommand(SecondLifeBot SecondLifeBot)
{
Name = "clienttags";
Description = bot.Localization.clResourceManager.getText("Commands.ClientTags.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
Dictionary<UUID, string> Tags = ClientTags.ToDictionary();
StringBuilder sbTags = new StringBuilder();
foreach (UUID key in Tags.Keys)
{
string name;
if (Tags.TryGetValue(key, out name))
{
sbTags.AppendFormat(bot.Localization.clResourceManager.getText("Commands.ClientTags.Client"), name, key.ToString());
sbTags.AppendLine();
}
}
return sbTags.ToString();
}
}
}

View File

@@ -0,0 +1,83 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ClockCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Text;
using System.Collections.ObjectModel;
using Claunia.clUtils;
public class ClockCommand : Command
{
public ClockCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "clock";
base.Description = bot.Localization.clResourceManager.getText("Commands.Clock.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
DateTime utcTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now);
DateTime localTime = DateTime.Now;
TimeZoneInfo pstZone, gmtZone;
if (Utilities.GetRunningPlatform() == Utilities.Platform.Windows)
{
pstZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
gmtZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
}
else
{
pstZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific");
gmtZone = TimeZoneInfo.FindSystemTimeZoneById("Atlantic/Canary");
}
DateTime pstTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, pstZone);
DateTime gmtTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, gmtZone);
StringBuilder sbOutput = new StringBuilder();
sbOutput.AppendLine();
sbOutput.AppendLine(bot.Localization.clResourceManager.getText("Commands.Clock.Current"));
sbOutput.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Clock.Local"), localTime).AppendLine();
sbOutput.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Clock.UTC"), utcTime).AppendLine();
sbOutput.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Clock.GMT"), pstTime).AppendLine();
sbOutput.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Clock.PST"), gmtTime).AppendLine();
return sbOutput.ToString();
}
}
}

View File

@@ -0,0 +1,67 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : DebugCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
/*
public class DebugCommand : Command
{
public DebugCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "debug";
base.Description = "Turn debug messages on or off. Usage: debug [on/off]";
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 1)
{
if (args[0].ToLower() == "on")
{
base.Client.Settings.DEBUG = true;
return "Debug logging is on";
}
if (args[0].ToLower() == "off")
{
base.Client.Settings.DEBUG = false;
return "Debug logging is off";
}
}
return "Usage: debug [on/off]";
}
}*/
}

View File

@@ -0,0 +1,63 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : GCCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using System;
using OpenMetaverse;
using bot;
using System.Text;
class GCCommand : Command
{
public GCCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "gc";
base.Description = bot.Localization.clResourceManager.getText("Commands.GC.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder sbResult = new StringBuilder();
DateTime Start;
sbResult.AppendFormat(bot.Localization.clResourceManager.getText("Commands.GC.Before"), GC.GetTotalMemory(false) / 1048576).AppendLine();
sbResult.AppendFormat(bot.Localization.clResourceManager.getText("Commands.GC.Starting")).AppendLine();
Start = DateTime.Now;
GC.Collect();
sbResult.AppendFormat(bot.Localization.clResourceManager.getText("Commands.GC.After"), GC.GetTotalMemory(true) / 1048576).AppendLine();
sbResult.AppendFormat(bot.Localization.clResourceManager.getText("Commands.GC.Took"), (DateTime.Now - Start).TotalSeconds).AppendLine();
return sbResult.ToString();
}
}
}

View File

@@ -0,0 +1,167 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : Help2NCCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using OpenMetaverse;
using OpenMetaverse.Assets;
public class Help2NCCommand : Command
{
const int NOTECARD_CREATE_TIMEOUT = 2500 * 10;
const int NOTECARD_FETCH_TIMEOUT = 1500 * 10;
const int INVENTORY_FETCH_TIMEOUT = 1500 * 10;
public Help2NCCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "help2nc";
base.Description = bot.Localization.clResourceManager.getText("Commands.Help2NC.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool something_else)
{
UUID notecardItemID = UUID.Zero, notecardAssetID = UUID.Zero;
string notename, notedata;
bool success = false, finalUploadSuccess = false;
string message = String.Empty;
AutoResetEvent notecardEvent = new AutoResetEvent(false);
bot.license.Version version = new license.Version();
string str = version.ToString() + " " + version.v_rev;
notename = string.Format(bot.Localization.clResourceManager.getText("Commands.Help2NC.Commands"), str);
#region Create notecard
StringBuilder builder = new StringBuilder();
builder.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Help2NC.Commands"), str).AppendLine();
builder.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Help.Message"), new object[0]).AppendLine();
string[] entries = new string[base.Client.Commands.Values.Count];
int i = 0;
foreach (Command command in base.Client.Commands.Values)
{
entries[i] = string.Format(" * {0} - {1}\n", command.Name, command.Description);
i++;
}
Array.Sort(entries);
foreach (string entry in entries)
{
builder.Append(entry);
}
notedata = builder.ToString();
#endregion
#region Notecard asset data
AssetNotecard notecard = new AssetNotecard();
notecard.BodyText = notedata;
notecard.Encode();
#endregion Notecard asset data
Client.Inventory.RequestCreateItem(Client.Inventory.FindFolderForType(AssetType.Notecard),
notename, String.Format(bot.Localization.clResourceManager.getText("Commands.CreateNotecard.CreatedBy"), notename, DateTime.Now), AssetType.Notecard,
UUID.Random(), InventoryType.Notecard, PermissionMask.All,
delegate(bool createSuccess, InventoryItem item)
{
if (createSuccess)
{
#region Upload an empty notecard asset first
AutoResetEvent emptyNoteEvent = new AutoResetEvent(false);
AssetNotecard empty = new AssetNotecard();
empty.BodyText = "\n";
empty.Encode();
Client.Inventory.RequestUploadNotecardAsset(empty.AssetData, item.UUID,
delegate(bool uploadSuccess, string status, UUID itemID, UUID assetID)
{
notecardItemID = itemID;
notecardAssetID = assetID;
success = uploadSuccess;
message = status ?? bot.Localization.clResourceManager.getText("Commands.CreateNotecard.UnknownError");
emptyNoteEvent.Set();
});
emptyNoteEvent.WaitOne(NOTECARD_CREATE_TIMEOUT, false);
#endregion Upload an empty notecard asset first
if (success)
{
// Upload the actual notecard asset
Client.Inventory.RequestUploadNotecardAsset(notecard.AssetData, item.UUID,
delegate(bool uploadSuccess, string status, UUID itemID, UUID assetID)
{
notecardItemID = itemID;
notecardAssetID = assetID;
finalUploadSuccess = uploadSuccess;
message = status ?? bot.Localization.clResourceManager.getText("Commands.CreateNotecard.UnknownError");
notecardEvent.Set();
});
}
else
{
notecardEvent.Set();
}
}
else
{
message = bot.Localization.clResourceManager.getText("Commands.CreateNotecard.CreateFail");
notecardEvent.Set();
}
}
);
notecardEvent.WaitOne(NOTECARD_CREATE_TIMEOUT, false);
if (finalUploadSuccess)
{
Client.Inventory.GiveItem(notecardItemID, notename, AssetType.Notecard, Client.MasterKey, false);
return String.Format(bot.Localization.clResourceManager.getText("Commands.Help2NC.Sending"));
}
else
return String.Format(bot.Localization.clResourceManager.getText("Commands.CreateNotecard.CreateFailDetails"), message);
}
}
}

View File

@@ -0,0 +1,90 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : HelpCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Text;
using System.Collections.Generic;
public class HelpCommand : Command
{
public HelpCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "help";
base.Description = bot.Localization.clResourceManager.getText("Commands.Help.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder builder = new StringBuilder();
builder.AppendLine();
builder.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Help.Message"), new object[0]).AppendLine();
string[] entries = new string[base.Client.Commands.Values.Count];
#if DEBUG
bool doHTML = false;
if (args.Length == 1)
if (args[0].ToLower() == "html")
doHTML = true;
#endif
int i = 0;
foreach (Command command in base.Client.Commands.Values)
{
#if DEBUG
if (doHTML)
entries[i] = string.Format("<p> * <span class=\"command\">{0}</span> - {1}</p>\n", command.Name, command.Description);
else
entries[i] = string.Format(" * {0} - {1}\n", command.Name, command.Description);
#else
entries[i] = string.Format(" * {0} - {1}\n", command.Name, command.Description);
#endif
i++;
}
Array.Sort(entries);
foreach (string entry in entries)
{
builder.Append(entry);
}
return builder.ToString();
}
}
}

View File

@@ -0,0 +1,60 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : LoadCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Reflection;
public class LoadCommand : Command
{
public LoadCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "load";
base.Description = bot.Localization.clResourceManager.getText("Commands.Load.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Load.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length < 1)
{
return bot.Localization.clResourceManager.getText("Commands.Load.Usage");
}
string path = AppDomain.CurrentDomain.BaseDirectory + args[0] + ".dll";
base.Client.RegisterAllCommands(Assembly.LoadFile(path));
return String.Format(bot.Localization.clResourceManager.getText("Commands.Load.Loaded"), path);
}
}
}

View File

@@ -0,0 +1,65 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : LogoutCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class LogoutCommand : Command
{
public LogoutCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "logout";
base.Description = bot.Localization.clResourceManager.getText("Commands.Logout.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Logout.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 1)
{
if (args[0].ToLower() == "yes")
{
Client.Netcom.Logout();
return bot.Localization.clResourceManager.getText("Commands.Logout.Exiting");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Logout.Usage");
}
}
return bot.Localization.clResourceManager.getText("Commands.Logout.Usage");
}
}
}

View File

@@ -0,0 +1,57 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : MD5Command.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class MD5Command : Command
{
public MD5Command(SecondLifeBot SecondLifeBot)
{
base.Name = "md5";
base.Description = bot.Localization.clResourceManager.getText("Commands.MD5.Description") + " " + bot.Localization.clResourceManager.getText("Commands.MD5.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 1)
{
return Utils.MD5(args[0]);
}
return bot.Localization.clResourceManager.getText("Commands.MD5.Usage");
}
}
}

View File

@@ -0,0 +1,52 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : MemFreeCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using System;
using OpenMetaverse;
using bot;
class MemFreeCommand : Command
{
public MemFreeCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "memfree";
base.Description = bot.Localization.clResourceManager.getText("Commands.MemFree.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
return String.Format(bot.Localization.clResourceManager.getText("Commands.MemFree.Using"), GC.GetTotalMemory(false) / 1048576);
}
}
}

View File

@@ -0,0 +1,127 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : NetstatsCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.Packets;
namespace bot.Commands
{
public class NetstatsCommand : Command
{
public NetstatsCommand(SecondLifeBot secondLifeBot)
{
Name = "netstats";
Description = bot.Localization.clResourceManager.getText("Commands.NetStats.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
StringBuilder output = new StringBuilder();
if (!Client.Settings.TRACK_UTILIZATION)
{
return bot.Localization.clResourceManager.getText("Commands.NetStats.NoStats");
}
StringBuilder packetOutput = new StringBuilder();
StringBuilder capsOutput = new StringBuilder();
packetOutput.AppendFormat("{0,-30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, "Packet Name", "Sent", "Recv",
" TX Bytes ", " RX Bytes ");
capsOutput.AppendFormat("{0,-30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, "Message Name", "Sent", "Recv",
" TX Bytes ", " RX Bytes ");
// " RX "
long packetsSentCount = 0;
long packetsRecvCount = 0;
long packetBytesSent = 0;
long packetBytesRecv = 0;
long capsSentCount = 0;
long capsRecvCount = 0;
long capsBytesSent = 0;
long capsBytesRecv = 0;
foreach (KeyValuePair<string, OpenMetaverse.Stats.UtilizationStatistics.Stat> kvp in Client.Stats.GetStatistics())
{
if (kvp.Value.Type == OpenMetaverse.Stats.Type.Message)
{
capsOutput.AppendFormat("{0,-30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, kvp.Key, kvp.Value.TxCount, kvp.Value.RxCount,
FormatBytes(kvp.Value.TxBytes), FormatBytes(kvp.Value.RxBytes));
capsSentCount += kvp.Value.TxCount;
capsRecvCount += kvp.Value.RxCount;
capsBytesSent += kvp.Value.TxBytes;
capsBytesRecv += kvp.Value.RxBytes;
}
else if (kvp.Value.Type == OpenMetaverse.Stats.Type.Packet)
{
packetOutput.AppendFormat("{0,-30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, kvp.Key, kvp.Value.TxCount, kvp.Value.RxCount,
FormatBytes(kvp.Value.TxBytes), FormatBytes(kvp.Value.RxBytes));
packetsSentCount += kvp.Value.TxCount;
packetsRecvCount += kvp.Value.RxCount;
packetBytesSent += kvp.Value.TxBytes;
packetBytesRecv += kvp.Value.RxBytes;
}
}
capsOutput.AppendFormat("{0,30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, "Capabilities Totals", capsSentCount, capsRecvCount,
FormatBytes(capsBytesSent), FormatBytes(capsBytesRecv));
packetOutput.AppendFormat("{0,30}|{1,4}|{2,4}|{3,-10}|{4,-10}|" + System.Environment.NewLine, "Packet Totals", packetsSentCount, packetsRecvCount,
FormatBytes(packetBytesSent), FormatBytes(packetBytesRecv));
return System.Environment.NewLine + capsOutput.ToString() + System.Environment.NewLine + System.Environment.NewLine + packetOutput.ToString();
}
public string FormatBytes(long bytes)
{
const int scale = 1024;
string[] orders = new string[] { "GiB", "MiB", "KiB", "Bytes" };
long max = (long)Math.Pow(scale, orders.Length - 1);
foreach (string order in orders)
{
if (bytes > max)
return string.Format("{0:##.##} {1}", decimal.Divide(bytes, max), order);
max /= scale;
}
return "0";
}
}
}

View File

@@ -0,0 +1,67 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : QuitCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class QuitCommand : Command
{
public QuitCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "quit";
base.Description = bot.Localization.clResourceManager.getText("Commands.Quit.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Quit.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 1)
{
if (args[0].ToLower() == "yes")
{
Program.NBStats.AddStatData(String.Format("{0}: Exiting natibot from {1}.", DateTime.Now, Client));
Program.NBStats.SendStatistics();
System.Windows.Forms.Application.Exit();
return bot.Localization.clResourceManager.getText("Commands.Quit.Exiting");
}
else
{
return bot.Localization.clResourceManager.getText("Commands.Quit.Usage");
}
}
return bot.Localization.clResourceManager.getText("Commands.Quit.Usage");
}
}
}

View File

@@ -0,0 +1,77 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ScriptCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using System;
using System.IO;
using OpenMetaverse;
public class ScriptCommand : Command
{
public ScriptCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "script";
base.Description = bot.Localization.clResourceManager.getText("Commands.Script.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Script.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length != 1)
return bot.Localization.clResourceManager.getText("Commands.Script.Usage");
// Load the file
string[] lines;
try
{
lines = File.ReadAllLines(args[0]);
}
catch (Exception e)
{
return e.Message;
}
// Execute all of the commands
for (int i = 0; i < lines.Length; i++)
{
string line = lines[i].Trim();
if (line.Length > 0)
//Client.ClientManager.DoCommandAll(line, UUID.Zero);
Client.DoCommand(line, fromAgentID, fromSL);
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.Script.Done"), lines.Length);
}
}
}

View File

@@ -0,0 +1,100 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : SetMasterCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System.Collections.Generic;
using System;
using System.Threading;
public class SetMasterCommand : Command
{
public DateTime Created = DateTime.Now;
private UUID resolvedMasterKey = UUID.Zero;
private ManualResetEvent keyResolution = new ManualResetEvent(false);
private UUID query = UUID.Zero;
public SetMasterCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "setmaster";
base.Description = bot.Localization.clResourceManager.getText("Commands.SetMaster.Description") + " " + bot.Localization.clResourceManager.getText("Commands.SetMaster.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
string masterName = String.Empty;
for (int ct = 0; ct < args.Length; ct++)
masterName = masterName + args[ct] + " ";
masterName = masterName.TrimEnd();
if (masterName.Length == 0)
return bot.Localization.clResourceManager.getText("Commands.SetMaster.Usage");
EventHandler<DirPeopleReplyEventArgs> callback = KeyResolvHandler;
Client.Directory.DirPeopleReply += callback;
query = Client.Directory.StartPeopleSearch(masterName, 0);
if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
{
Client.MasterKey = resolvedMasterKey;
keyResolution.Reset();
Client.Directory.DirPeopleReply -= callback;
}
else
{
keyResolution.Reset();
Client.Directory.DirPeopleReply -= callback;
return String.Format(bot.Localization.clResourceManager.getText("Commands.SetMaster.UUIDNotFound"), masterName);
}
// Send an Online-only IM to the new master
Client.Self.InstantMessage(
Client.MasterKey, bot.Localization.clResourceManager.getText("Commands.SetMaster.Greet"));
return String.Format(bot.Localization.clResourceManager.getText("Commands.SetMaster.Set"), masterName, Client.MasterKey.ToString());
}
private void KeyResolvHandler(object sender, DirPeopleReplyEventArgs e)
{
if (query != e.QueryID)
return;
resolvedMasterKey = e.MatchedPeople[0].AgentID;
keyResolution.Set();
query = UUID.Zero;
}
}
}

View File

@@ -0,0 +1,77 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : SetMasterKeyCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class SetMasterKeyCommand : Command
{
public DateTime Created = DateTime.Now;
public SetMasterKeyCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "setMasterKey";
base.Description = bot.Localization.clResourceManager.getText("Commands.SetMasterKey.Description") + " " + bot.Localization.clResourceManager.getText("Commands.SetMasterKey.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
Client.MasterKey = UUID.Parse(args[0]);
lock (Client.Network.Simulators)
{
for (int i = 0; i < Client.Network.Simulators.Count; i++)
{
Avatar master = Client.Network.Simulators[i].ObjectsAvatars.Find(
delegate(Avatar avatar)
{
return avatar.ID == Client.MasterKey;
}
);
if (master != null)
{
Client.Self.InstantMessage(master.ID,
bot.Localization.clResourceManager.getText("Commands.SetMaster.Greet"));
break;
}
}
}
return String.Format(bot.Localization.clResourceManager.getText("Commands.SetMasterKey.Set"), Client.MasterKey.ToString());
}
}
}

View File

@@ -0,0 +1,106 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : ShowEffectsCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class ShowEffectsCommand : Command
{
private bool ShowEffects;
public ShowEffectsCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "showeffects";
base.Description = bot.Localization.clResourceManager.getText("Commands.ShowEffects.Description") + " " + bot.Localization.clResourceManager.getText("Commands.ShowEffects.Usage");
SecondLifeBot.Avatars.ViewerEffect += new EventHandler<ViewerEffectEventArgs>(Avatars_ViewerEffect);
SecondLifeBot.Avatars.ViewerEffectPointAt += new EventHandler<ViewerEffectPointAtEventArgs>(Avatars_ViewerEffectPointAt);
SecondLifeBot.Avatars.ViewerEffectLookAt += new EventHandler<ViewerEffectLookAtEventArgs>(Avatars_ViewerEffectLookAt);
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length == 0)
{
ShowEffects = true;
return bot.Localization.clResourceManager.getText("Commands.ShowEffects.On");
}
else if (args.Length == 1)
{
if (args[0] == "on")
{
ShowEffects = true;
return bot.Localization.clResourceManager.getText("Commands.ShowEffects.On");
}
else
{
ShowEffects = false;
return bot.Localization.clResourceManager.getText("Commands.ShowEffects.Off");
}
}
else
{
return bot.Localization.clResourceManager.getText("Commands.ShowEffects.Usage");
}
}
void Avatars_ViewerEffectPointAt(object sender, ViewerEffectPointAtEventArgs e)
{
if (ShowEffects)
bot.Console.WriteLine(
bot.Localization.clResourceManager.getText("Commands.ShowEffects.PointAt"),
e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.PointType, e.Duration,
e.EffectID.ToString());
}
void Avatars_ViewerEffectLookAt(object sender, ViewerEffectLookAtEventArgs e)
{
if (ShowEffects)
bot.Console.WriteLine(
bot.Localization.clResourceManager.getText("Commands.ShowEffects.LookAt"),
e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.LookType, e.Duration,
e.EffectID.ToString());
}
void Avatars_ViewerEffect(object sender, ViewerEffectEventArgs e)
{
if (ShowEffects)
bot.Console.WriteLine(
bot.Localization.clResourceManager.getText("Commands.ShowEffects.Other"),
e.Type, e.SourceID.ToString(), e.TargetID.ToString(), e.TargetPosition, e.Duration,
e.EffectID.ToString());
}
}
}

View File

@@ -0,0 +1,64 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : TranslateCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using Claunia.clUtils;
public class TranslateCommand : Command
{
public TranslateCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "translate";
base.Description = bot.Localization.clResourceManager.getText("Commands.Translate.Description") + " " + bot.Localization.clResourceManager.getText("Commands.Translate.Usage");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
if (args.Length >= 3)
{
string text = String.Empty;
for (int ct = 2; ct < args.Length; ct++)
text += args[ct] + " ";
string newtext = Utilities.TranslateText(text, args[0] + "|" + args[1]);
return newtext;
}
else
return bot.Localization.clResourceManager.getText("Commands.Translate.Usage");
}
}
}

View File

@@ -0,0 +1,56 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : UptimeCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
public class UptimeCommand : Command
{
public DateTime Created = DateTime.Now;
public UptimeCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "uptime";
base.Description = bot.Localization.clResourceManager.getText("Commands.Uptime.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
string name = Client.ToString();
return String.Format(bot.Localization.clResourceManager.getText("Commands.Uptime.Uptime"), name, Created, (DateTime.Now - Created));
}
}
}

View File

@@ -0,0 +1,62 @@
/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
Filename : VersionCommand.cs
Version : 1.0.326
Author(s) : Natalia Portillo
Component : NatiBot
Revision : r326
Last change by : Natalia Portillo
Date : 2010/01/01
--[ License ] --------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
Copyright (C) 2008-2014 Claunia.com
****************************************************************************/
namespace bot.Commands
{
using bot;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
public class VersionCommand : Command
{
public VersionCommand(SecondLifeBot SecondLifeBot)
{
base.Name = "version";
base.Description = bot.Localization.clResourceManager.getText("Commands.Version.Description");
}
public override string Execute(string[] args, UUID fromAgentID, bool fromSL)
{
bot.license.Version botVersion = new bot.license.Version();
StringBuilder builder = new StringBuilder();
builder.AppendLine();
builder.AppendLine("NatiBot " + botVersion.ToString());
builder.AppendFormat(bot.Localization.clResourceManager.getText("Commands.Version.CurrentSim"), this.Client.Network.CurrentSim.Name).AppendLine();
builder.AppendLine(this.Client.Network.CurrentSim.SimVersion);
return builder.ToString();
}
}
}