private void script_Message(object sender, Frida.ScriptMessageEventArgs e) { if (sender == script) { debugConsole.Items.Add(String.Format("Message from Script: {0}", e.Message)); debugConsole.Items.Add(String.Format(" Data: {0}", e.Data == null ? "null" : String.Join(", ", e.Data))); } }
private void Script_Message(object sender, Frida.ScriptMessageEventArgs e) { Frida.Script senderscript = (Frida.Script)sender; String jsonmessage = e.Message; String message = ""; JsonTextReader jtr = new JsonTextReader(new StringReader(jsonmessage)); while (jtr.Read()) { if (jtr.TokenType == JsonToken.PropertyName && jtr.Value.Equals("error")) { MessageBox.Show(jtr.ReadAsString()); Application.Current.Shutdown(); } if (jtr.TokenType == JsonToken.PropertyName && jtr.Value.Equals("payload")) { message = jtr.ReadAsString(); break; } } jtr.Close(); String fn = message + modfileext; string scriptfilepath = moddirectory + "\\" + fn; if (infoLabel.Content.ToString().Contains("Revelator") || loadcounter == 4) { infoLabel.Content = ""; loadcounter = 0; } if (File.Exists(scriptfilepath)) { byte[] bytes = File.ReadAllBytes(scriptfilepath); String payload = message; senderscript.Post(makeJSONmessageString(bytes)); loadcounter++; if (message.Contains("_ETC")) { infoLabel.Content += fn + " loaded!\r\n"; } else { infoLabel.Content += fn + " loaded!\t"; } } else { senderscript.Post(makeJSONmessageString(null)); loadcounter++; if (message.Contains("_ETC")) { infoLabel.Content += fn + " not loaded.\r\n"; } else { infoLabel.Content += fn + " not loaded.\t"; } } }
private void script_Message(object sender, Frida.ScriptMessageEventArgs e) { if (sender == script) { //debugConsole.Items.Add(String.Format("Message from Script: {0}", )); //debugConsole.Items.Add(String.Format(" Data: {0}", e.Data == null ? "null" : String.Join(", ", e.Data))); try { var msg = JsonConvert.DeserializeObject <MessageItem>(e.Message); if (String.IsNullOrEmpty(msg.payload)) { Module.Output.AppendLine(e.Message); return; } Module.Output.AppendLine(msg.payload); } catch (Exception) { Module.Output.AppendLine(e.Message); } } }