/// <summary> /// Public constructor. /// </summary> public StarSystemScreen(XnaGame game) { m_game = game; m_debug = new Debug(m_game); m_content = m_game.Content; m_graphics = m_game.GraphicsDevice; }
public MainWindow() { InitializeComponent(); this.Game = new Game("Unknown Team"); this.Debug = new Debug(this, this.Game); welcomeWindow(); }
public void GotDebug(Debug msg) { if (SendDebug != null) SendDebug(msg); if (!isEnabled) return; try { if (_log != null) { string data = DateTime.Now.ToString("HHmmss") + ": " + msg.Msg; _log.WriteLine(data); _content.AppendLine(data); } } catch { } }
public static void Register(Control control, string prefix, Debug debug) { string pageScript = @" <script> function Ajax_GetXMLHttpRequest() { var x = null; if (typeof XMLHttpRequest != ""undefined"") { x = new XMLHttpRequest(); } else { try { x = new ActiveXObject(""Msxml2.XMLHTTP""); } catch (e) { try { x = new ActiveXObject(""Microsoft.XMLHTTP""); } catch (e) { } } } return x; } function Ajax_CallBack(target, args, clientCallBack, debugRequestText, debugResponseText, debugErrors) { var x = Ajax_GetXMLHttpRequest(); var url = document.location.href.substring(0, document.location.href.length - document.location.hash.length); x.open(""POST"", url, clientCallBack ? true : false); x.setRequestHeader(""Content-Type"", ""application/x-www-form-urlencoded""); if (clientCallBack) { x.onreadystatechange = function() { if (x.readyState != 4) { return; } if (debugResponseText) { alert(x.responseText); } var result = eval(""("" + x.responseText + "")""); if (debugErrors && result.error) { alert(""error: "" + result.error); } clientCallBack(result); } } var encodedData = ""Ajax_CallBackTarget="" + target; if (args) { for (var i in args) { encodedData += ""&Ajax_CallBackArgument"" + i + ""="" + encodeURIComponent(args[i]); } } if (document.forms.length > 0) { var form = document.forms[0]; for (var i = 0; i < form.length; ++i) { var element = form.elements[i]; if (element.name) { var elementValue = null; if (element.nodeName == ""INPUT"") { var inputType = element.getAttribute(""TYPE"").toUpperCase(); if (inputType == ""TEXT"" || inputType == ""PASSWORD"" || inputType == ""HIDDEN"") { elementValue = element.value; } else if (inputType == ""CHECKBOX"" || inputType == ""RADIO"") { if (element.checked) { elementValue = element.value; } } } else if (element.nodeName == ""SELECT"") { elementValue = element.value; } if (elementValue) { encodedData += ""&"" + element.name + ""="" + encodeURIComponent(elementValue); } } } } if (debugRequestText) { alert(encodedData); } x.send(encodedData); var result = null; if (!clientCallBack) { if (debugResponseText) { alert(x.responseText); } result = eval(""("" + x.responseText + "")""); if (debugErrors && result.error) { alert(""error: "" + result.error); } } delete x; return result; } </script>"; control.Page.ClientScript.RegisterClientScriptBlock(Type.GetType("System.String"), typeof (Manager).FullName, pageScript); Type type = control.GetType(); StringBuilder controlScript = new StringBuilder(); controlScript.Append("\n<script>\n"); string[] prefixParts = prefix.Split('.', '+'); controlScript.AppendFormat("var {0} = {{\n", prefixParts[0]); for (int i = 1; i < prefixParts.Length; ++i) { controlScript.AppendFormat("\"{0}\": {{\n", prefixParts[i]); } int methodCount = 0; foreach (MethodInfo methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Public)) { object[] attributes = methodInfo.GetCustomAttributes(typeof (MethodAttribute), true); if (attributes != null && attributes.Length > 0) { ++methodCount; controlScript.AppendFormat("\n\"{0}\": function(", methodInfo.Name); foreach (ParameterInfo paramInfo in methodInfo.GetParameters()) { controlScript.Append(paramInfo.Name + ", "); } controlScript.AppendFormat("clientCallBack) {{\n\treturn Ajax_CallBack('{0}.{1}', [", type.FullName, methodInfo.Name); int paramCount = 0; foreach (ParameterInfo paramInfo in methodInfo.GetParameters()) { ++paramCount; controlScript.Append(paramInfo.Name); controlScript.Append(","); } // If parameters were written, remove the // trailing comma. if (paramCount > 0) { --controlScript.Length; } controlScript.AppendFormat("], clientCallBack, {0}, {1}, {2});\n}}", (debug & Debug.RequestText) == Debug.RequestText ? "true" : "false", (debug & Debug.ResponseText) == Debug.ResponseText ? "true" : "false", (debug & Debug.Errors) == Debug.Errors ? "true" : "false"); controlScript.Append(",\n"); } } // If no methods were found, you probably forget to add // [Ajax.Method] attributes to your methods. if (methodCount == 0) { throw new ApplicationException( string.Format("{0} does not contain any public methods with the Ajax.Method attribute.", type.FullName)); } // Remove the trailing comma and newline. controlScript.Length -= 2; controlScript.Append("\n\n"); for (int i = 0; i < prefixParts.Length; ++i) { controlScript.Append("}"); } controlScript.Append(";\n</script>"); control.Page.ClientScript.RegisterClientScriptBlock(Type.GetType("System.String"), "Ajax.Manager:" + type.FullName, controlScript.ToString()); control.PreRender += OnPreRender; }
public static void Register(Control control, Debug debug) { Register(control, control.GetType().FullName, debug); }
void debug(Debug deb) { debug(deb.Msg); }
public DebugImpl(Debug copy) { _msg = copy.Msg; _level = copy.Level; }
void b_SendDebug(Debug debug) { debugs++; }
void workingres_GotDebug(Debug d) { // display to screen debug(d.Msg); }
void myres_GotDebug(Debug msg) { debug(nowtime+":"+myres.Name+" "+msg.Msg); }
private void SSRSExport_Load(object sender, EventArgs e) { LoadSettings(); if (mDebug) { oDebugForm = new Debug(); oDebugForm.Show(); btnShowDebug.Visible = true; } }
void Response_GotDebug(Debug msg) { // _sb.AppendLine(msg.Msg); _sb.AppendFormat("{0}: {1}{2}", nowtime, msg.Msg, Environment.NewLine); }
void myres_GotDebug(Debug msg) { _msg.AppendFormat("{0}: {1}{2}",nowtime,msg.Msg,Environment.NewLine); }
void tt_SendDebug(Debug deb) { debug(deb.Msg); }
void Response_GotDebug(Debug msg) { if (!args.Debugs) return; debug(msg.Msg); }
public void Print() { Dictionary<String, Debug> d = new Dictionary<String, Debug>(); foreach (var t in Transitions) { Debug n = null; if (d.TryGetValue(t.From, out n) == false) { n = new Debug(); d.Add(t.From, n); } n.Transitions.Add(String.Format("{0} -> 0x{1:X8}", t.To, t.Function.GetMethodInfo().GetHashCode())); } foreach (var e in Events) { Debug n = null; if (d.TryGetValue(e.State, out n) == false) { n = new Debug(); d.Add(e.State, n); } n.Triggers.Add(String.Format("{0} -> 0x{1:X8}", e.Evt, e.Function.GetMethodInfo().GetHashCode())); } StringBuilder sb = new StringBuilder(2048); sb.AppendLine(GetType().Name); foreach (var np in d) { var n = np.Value; sb.AppendFormat(" - {0}", np.Key); sb.AppendLine(); foreach (var t in n.Transitions) { sb.AppendFormat(" > {0}", t); sb.AppendLine(); } foreach (var e in n.Triggers) { sb.AppendFormat(" . {0}", e); sb.AppendLine(); } } Console.WriteLine(sb); }
void workingres_GotDebug(Debug d) { // see if we are processing debugs if (!debugon.Checked) return; // display to screen debug(d.Msg); }
/// <summary> /// log something /// </summary> /// <param name="msg"></param> public void GotDebug(Debug msg) { if (SendDebug != null) SendDebug(msg); if (!isEnabled) return; try { if (_log != null) { StringBuilder sb = new StringBuilder(); if (_timestamps) { DateTime now = DateTime.Now; // see if date changed int newdate = Util.ToTLDate(now); // if date has changed, start new file if (newdate != _date) { _date = newdate; setfile(); } sb.Append(now.ToString("HHmmss")); sb.Append(": "); } sb.Append(msg.Msg); _log.WriteLine(sb.ToString()); _content.Append(sb.ToString()); } } catch { } }
public void GotDebug(Debug msg) { debug(msg.Msg); }