TestClient can load a list of accounts from a file at the command line now, and a slew of bugfixes
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@647 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -16,7 +16,7 @@ namespace libsecondlife.TestClient
|
||||
|
||||
public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
if (args.Length != 1)
|
||||
return "usage: jump 1000";
|
||||
|
||||
float height = 0;
|
||||
|
||||
@@ -1,34 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace libsecondlife.TestClient
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static void Usage()
|
||||
{
|
||||
Console.WriteLine("Usage: " + Environment.NewLine +
|
||||
"TestClient.exe firstname lastname password [master name]" + Environment.NewLine +
|
||||
"TestClient.exe --file filename [master name]");
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 1 || args.Length > 5)
|
||||
if (args.Length < 2 || args.Length > 5)
|
||||
{
|
||||
Console.WriteLine("Usage: " + Environment.NewLine +
|
||||
"TestClient.exe firstname lastname password [master name]" + Environment.NewLine +
|
||||
"TestClient.exe filename [master name]");
|
||||
Usage();
|
||||
return;
|
||||
}
|
||||
|
||||
TestClient tester;
|
||||
List<LoginDetails> accounts = new List<LoginDetails>();
|
||||
LoginDetails account;
|
||||
|
||||
if (args.Length <= 2)
|
||||
if (args[0] == "--file")
|
||||
{
|
||||
// Loading names from a file
|
||||
// FIXME:
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(args[1]))
|
||||
{
|
||||
string line;
|
||||
int lineNumber = 0;
|
||||
|
||||
Console.WriteLine("FIXME!");
|
||||
return;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
lineNumber++;
|
||||
string[] tokens = line.Trim().Split(new char[] { ' ', ',' });
|
||||
|
||||
if (tokens.Length == 3)
|
||||
{
|
||||
account = new LoginDetails();
|
||||
account.FirstName = tokens[0];
|
||||
account.LastName = tokens[1];
|
||||
account.Password = tokens[2];
|
||||
|
||||
if (args.Length == 4)
|
||||
{
|
||||
account.Master = args[2] + " " + args[3];
|
||||
}
|
||||
|
||||
accounts.Add(account);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid data on line " + lineNumber +
|
||||
", must be in the format of: FirstName LastName Password");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine("Error reading from " + args[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (args.Length == 3 || args.Length == 5)
|
||||
{
|
||||
// Taking a single login off the command-line
|
||||
account = new LoginDetails();
|
||||
@@ -43,7 +83,13 @@ namespace libsecondlife.TestClient
|
||||
|
||||
accounts.Add(account);
|
||||
}
|
||||
else
|
||||
{
|
||||
Usage();
|
||||
return;
|
||||
}
|
||||
|
||||
// Login the accounts and run the input loop
|
||||
tester = new TestClient(accounts);
|
||||
tester.Run();
|
||||
}
|
||||
|
||||
@@ -322,18 +322,27 @@ Begin:
|
||||
LLUUID regionID, LLVector3 position, byte dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp,
|
||||
string message, byte offline, byte[] binaryBucket)
|
||||
{
|
||||
if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID) && fromAgentName.ToLower().TrimEnd() != Master.ToLower().TrimEnd())
|
||||
if (Master.Length > 0)
|
||||
{
|
||||
// Not a member of my group and not master, ignore the IM
|
||||
Console.WriteLine("<IM>" + fromAgentName + " (ignored): " + message);
|
||||
|
||||
return;
|
||||
if (fromAgentName.ToLower().Trim() != Master.ToLower().Trim())
|
||||
{
|
||||
// Received an IM from someone that is not the bot's master, ignore
|
||||
Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("<IM>" + fromAgentName + ": " + message);
|
||||
if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
|
||||
{
|
||||
// Received an IM from someone outside the bot's group, ignore
|
||||
Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("<IM>" + fromAgentName + ": " + message);
|
||||
|
||||
if (Clients.ContainsKey(toAgentID))
|
||||
{
|
||||
if (dialog == 22)
|
||||
@@ -348,6 +357,7 @@ Begin:
|
||||
}
|
||||
else
|
||||
{
|
||||
// This shouldn't happen
|
||||
Console.WriteLine("A bot that we aren't tracking received an IM?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\bin\</OutputPath>
|
||||
<OutputPath>..\..\..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -35,6 +35,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="Commands\BalanceCommand.cs" />
|
||||
<Compile Include="Commands\TeleportCommand.cs" />
|
||||
<Compile Include="Commands\LoginCommand.cs" />
|
||||
<Compile Include="Commands\LogoutCommand.cs" />
|
||||
<Compile Include="Commands\WhoCommand.cs" />
|
||||
|
||||
Reference in New Issue
Block a user