Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed all static FormMain. references

  • Loading branch information...
commit 9cc1c4ebf09cf1f16a15b1fc5b16266bcc3a61af 1 parent 0ec6f81
@seuffert authored
View
4 XBSlink/xbs_chat.cs
@@ -50,12 +50,12 @@ public static void addChatMessage( String sender, String msg)
public static void sendChatMessage(String message)
{
- FormMain.node_list.sendChatMessageToAllNodes(message);
+ xbs_node_list.getInstance().sendChatMessageToAllNodes(message);
}
public static void addLocalMessage(String message)
{
- addMessage("<" + FormMain.node_list.local_node.nickname + "> : " + message);
+ addMessage("<" + xbs_node_list.getInstance().local_node.nickname + "> : " + message);
}
public static void addSystemMessage(String message)
View
6 XBSlink/xbs_cloudlist.cs
@@ -242,7 +242,7 @@ public bool JoinOrCreateCloud(String url, String cloudname, String max_nodes, St
return false;
}
xbs_node_message_announce msg = new xbs_node_message_announce(ip, port);
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
}
startUpdateThread();
@@ -282,8 +282,8 @@ public bool LeaveCloud()
if (update_thread.ThreadState != ThreadState.Stopped )
update_thread.Join();
update_thread = null;
- FormMain.node_list.sendLogOff();
- FormMain.node_list.clear_nodes();
+ xbs_node_list.getInstance().sendLogOff();
+ xbs_node_list.getInstance().clear_nodes();
cloudlist_url = null;
return true;
}
View
20 XBSlink/xbs_node.cs
@@ -134,14 +134,14 @@ public bool has_xbox(PhysicalAddress xbox_addr)
public void sendDataMessage( ref byte[] data)
{
xbs_node_message_data msg = new xbs_node_message_data(this, data);
- FormMain.udp_listener.send_xbs_node_message_high_prio(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message_high_prio(msg);
}
public void sendAddNodeMessage(IPAddress ip, int port)
{
xbs_node_message_addnode msg_addnode = new xbs_node_message_addnode( ip, (UInt16)port);
msg_addnode.receiver = this;
- FormMain.udp_listener.send_xbs_node_message(msg_addnode);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg_addnode);
}
public void sendAddNodeMessage(xbs_node node)
@@ -153,7 +153,7 @@ public void sendKnownNodeMessage(IPAddress ip, int port)
{
xbs_node_message_knownnode msg_knownnode = new xbs_node_message_knownnode(ip, (UInt16)port);
msg_knownnode.receiver = this;
- FormMain.udp_listener.send_xbs_node_message(msg_knownnode);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg_knownnode);
}
public void sendKnownNodeMessage(xbs_node node)
@@ -198,31 +198,31 @@ public void sendDelNodeMessage(xbs_node node)
#endif
xbs_node_message_delnode msg = new xbs_node_message_delnode(node.ip_public, (UInt16)node.port_public);
msg.receiver = this;
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public void sendPing()
{
xbs_node_message_ping msg_ping = new xbs_node_message_ping(this);
- FormMain.udp_listener.send_xbs_node_message(msg_ping);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg_ping);
}
public void sendGetClientVersion()
{
xbs_node_message_getclientversion msg = new xbs_node_message_getclientversion(this);
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public void sendChatMessage(String chat_message)
{
xbs_node_message_chatmsg msg = new xbs_node_message_chatmsg(this, chat_message);
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public void sendGetNickname()
{
xbs_node_message_getnickname msg = new xbs_node_message_getnickname(this);
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public IPAddress getSendToIP()
@@ -245,14 +245,14 @@ public void sendToCloudHelper_HelpWithNode(xbs_node node)
{
xbs_node_message_toCloudHelper_HelpWithNode msg = new xbs_node_message_toCloudHelper_HelpWithNode(node.ip_public, (UInt16)node.port_public);
msg.receiver = this;
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public void send_fromCloudhelper_helpWithAddingNode(xbs_node node)
{
xbs_node_message_fromCloudHelper_ContactNode msg = new xbs_node_message_fromCloudHelper_ContactNode(node.ip_public, (UInt16)node.port_public);
msg.receiver = this;
- FormMain.udp_listener.send_xbs_node_message(msg);
+ xbs_udp_listener.getInstance().send_xbs_node_message(msg);
}
public int get_xbox_count()
View
5 XBSlink/xbs_node_list.cs
@@ -407,5 +407,10 @@ public DateTime getLastChangeTime()
}
return lct;
}
+
+ public static xbs_node_list getInstance()
+ {
+ return (FormMain.node_list!=null) ? FormMain.node_list : xbs_console_app.node_list;
+ }
}
}
View
5 XBSlink/xbs_sniffer.cs
@@ -375,5 +375,10 @@ public void setSpecialMacPacketFilter(List<PhysicalAddress> mac_list)
pdev_filter_special_macs = mac_list;
setPdevFilter();
}
+
+ public static xbs_sniffer getInstance()
+ {
+ return (FormMain.sniffer != null) ? FormMain.sniffer : xbs_console_app.sniffer;
+ }
}
}
View
8 XBSlink/xbs_udp_listener.cs
@@ -458,7 +458,7 @@ private void dispatch_DATA_message(ref xbs_udp_message udp_msg)
#if DEBUG
xbs_messages.addDebugMessage(" * DATA (" + udp_msg.data.Length + ") from " + srcMAC + " => " + dstMAC);
#endif
- FormMain.sniffer.injectRemotePacket(ref udp_msg.data, dstMAC, srcMAC);
+ xbs_sniffer.getInstance().injectRemotePacket(ref udp_msg.data, dstMAC, srcMAC);
xbs_node node = node_list.findNode(udp_msg.src_ip, (UInt16)udp_msg.src_port);
if (node != null)
node.addXbox(srcMAC);
@@ -539,5 +539,11 @@ public void dispatch_out_queue()
}
}
}
+
+ public static xbs_udp_listener getInstance()
+ {
+ return (FormMain.udp_listener != null) ? FormMain.udp_listener : xbs_console_app.udp_listener;
+ }
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.