/// <summary> /// Gets the script for the associated event. /// </summary> /// <param name="serverEvent">The server event to get the script for.</param> /// <returns>The script that represents the function that will be called as the entry point to user provided script.</returns> /// <remarks> /// To make the implementation easier each script constant is named for a ServerEvent enum. This allows us to look up the constant using /// the name of the server event. If the event is found it is cached so it can be used later without a reflection performance hit. /// </remarks> public static string GetScript(ServerEvent serverEvent) { if (!_Functions.ContainsKey(serverEvent)) { FieldInfo field = typeof(ScriptFunctions).GetFields().Where(f => f.Name.ToLower() == serverEvent.ToString().ToLower()).FirstOrDefault(); if (field == null) { return(string.Empty); } _Functions[serverEvent] = field.GetValue(null).ToString(); } return(_Functions[serverEvent]); }
private void connection_OnSocketEvent(ServerEvent socketEvent) { this.ctlControlPanel.AppendToUILog(socketEvent.ToString()); }
private void connection_OnSocketEvent(ServerEvent socketEvent) { AppendToUILog(socketEvent.ToString()); }