Looked through the sample code just out of interest and noticed one possible performance issue. Using reflection each time a packet is received doesn't look like a very good idea. I might be wrong though, please correct me in that case.
static void insim_PacketReceived(object sender, PacketEventArgs e)
{
// Use reflection to get the packet properties.
var properties = e.Packet.GetType().GetProperties();
// Print out each packet property and its value.
foreach (var property in properties)
{
Console.WriteLine("{0}: {1}", property.Name, property.GetValue(e.Packet, null));
}
// Blank line.
Console.WriteLine();
}
<?php
_insim.Send("/msg š " + NCN.PName);
?>
? [Ls?C]Povo
private void CommandGarage(User user, string[] args)
{
if (user.Cars.Any())
{
MessageTo(user, "Garage:");
foreach (var car in user.Cars)
{
var price = Dealer.GetCarPrice(car.Name);
MessageTo(user, "{0}: ${1}", car.Name, price);
}
}
else
{
MessageTo(user, "You do not own any cars");
}
}
using System;
using Spark;
using Spark.Packets;
namespace FlameSim
{
class Program
{
static void Main(string[] args)
{
// Create InSim object.
using (var insim = new InSim())
{
const string INSIM_NAME = "FlameSim";
const string INSIM_AUTHOR = "Martin Kapal";
const string SERVER_IP = "127.0.0.1";
const int SERVER_PORT = 30000;
const string ADMIN_PASS = "xxx";
insim.Connect(SERVER_IP, SERVER_PORT);
insim.Send(new IS_ISI { IName = INSIM_NAME, Admin = ADMIN_PASS });
insim.Send("/msg ^EConnected : ^7" + INSIM_NAME);
insim.Send("/msg ^EAuthor : ^7" + INSIM_AUTHOR);
[COLOR="Blue"]
[B]insim.Send(new IS_BTN
{
ReqI = 255,
UCID = 255,
ClickID = 2,
BStyle = ButtonStyles.ISB_DARK | ButtonStyles.ISB_LEFT,
T = 8,
L = 8,
W = 20,
H = 4,
Text = "Test",
});
[/B][/COLOR]
// Stop program from exiting.
insim.Run();
}
}
}
}