Click or drag to resize

ProxySession

This stuff is still in the planning stages. Any questions or Comments are welcome.

[This is preliminary documentation and is subject to change.]

Required introduction

ProxySession Class Example

C#
 1using BugProxy.Net;
 2using Furcadia.Net.Options;
 3using Furcadia.Net.Proxy;
 4using System;
 5
 6namespace BugConsole
 7{
 8internal class Program
 9{
10-#region Private Fields
11 
12 private static ProxySession proxy;
13 private static ProxySessionOptions ProxyOptions;
14 
15 #endregion Private Fields
16
17-#region Private Methods
18 
19 private static void Main(string[] args)
20 {
21 while (true)
22 {
23 Console.WriteLine("type connect when ready");
24 string cmd = Console.ReadLine();
25 
26 if (cmd.ToLower() == "connect")
27 {
28 if (proxy is null)
29 {
30 ProxyOptions = new ProxySessionOptions();
31 proxy = new ProxySession(ProxyOptions);
32 proxy.ClientData2 += onClientDataReceived;
33 proxy.ServerData2 += onServerDataReceived;
34 // We need a Character.ini file to work with -Gerolkae
35 proxy.Connect();
36 }
37 else if (!proxy.IsServerConnected)
38 {
39 proxy.Connect();
40 }
41 }
42 }
43 }
44 
45 static private void onClientDataReceived(string data)
46 {
47 Console.WriteLine("C>: " + data);
48 proxy.SendToServer(data);
49 }
50 
51 static private void onServerDataReceived(string data)
52 {
53 Console.WriteLine("S>: " + data);
54 proxy.SendToClient(data);
55 }
56 
57 #endregion Private Methods
58}
59}