6fdb6471 90ca 4bf7 b380 7b23d1ad6663 - StarShip-Avalon-Projects/FurcadiaFramework GitHub Wiki
Starting a proxy is simple.
C#
using BugProxy.Net;
using Furcadia.Net.Options;
using Furcadia.Net.Proxy;
using System;
namespace BugConsole
{
internal class Program
{
#region Private Fields
private static ProxySession proxy;
private static ProxySessionOptions ProxyOptions;
#endregion Private Fields
#region Private Methods
private static void Main(string[] args)
{
while (true)
{
Console.WriteLine("type connect when ready");
string cmd = Console.ReadLine();
if (cmd.ToLower() == "connect")
{
if (proxy is null)
{
ProxyOptions = new ProxySessionOptions();
proxy = new ProxySession(ProxyOptions);
proxy.ClientData2 += onClientDataReceived;
proxy.ServerData2 += onServerDataReceived;
// We need a Character.ini file to work with -Gerolkae
proxy.Connect();
}
else if (!proxy.IsServerConnected)
{
proxy.Connect();
}
}
}
}
static private void onClientDataReceived(string data)
{
Console.WriteLine("C>: " + data);
proxy.SendToServer(data);
}
static private void onServerDataReceived(string data)
{
Console.WriteLine("S>: " + data);
proxy.SendToClient(data);
}
#endregion Private Methods
}
}
VB
Dim proxy As New NetProxy()
proxy.ServerData += Sub(data As String)
Console.WriteLine(Convert.ToString("SERVER: ") & data)
Return data
End Sub
proxy.ClientExited += Sub()
Console.WriteLine("Client exited.")
proxy.Kill()
End Sub
proxy.[Error] += Sub(e As Exception) Console.WriteLine(e.Message)
proxy.Connect()
Add one or more sections with content