public static void ProcessErrorReport(string content, string user, bool send) { try { using (System.IO.MemoryStream report = new System.IO.MemoryStream(10000)) using (DataWriter writer = new DataWriter(report, FileMarkers.ErrorReport)) { if (Globals.Root.CurrentDocument != null) { try { writer.Write(Globals.Root.CurrentDocument); } catch (Exception e2) { Utilities.LogSubError("Document could not be written to error report", true); Utilities.LogSubError(e2, true); // If there was an exception then usually nothing could have been written to the stream, because the output for each object is typically buffered // by the DataWriter writer.Write(new Document(true)); } } else { writer.Write(new Document(true)); } // And now use the standard binary writer methods to write the rest of the data writer.Write(content); writer.Write(user); writer.Write(SubErrors); writer.WriteByte((byte)Globals.Root.User); writer.Write(Activities.ActivityID); writer.Write(Config.UserUser); writer.Write((Datum)null); // in Splash this is the teacher user writer.Write("N/A"); writer.Write(Globals.Root.Log.GetEntireContent()); writer.Write(Globals.Root.LogPermanent.GetEntireContent()); Globals.WriteDiagnosticEvents(writer); writer.Write(false); // for compatibility with splash if (!send) { // just writes it to disk DoSaveData(report.ToArray()); } else if (DoSendData(report.ToArray())) { MessageBox.Show(Strings.Item("Error_Sent")); } else { // calls here tried to send, but failed DoSaveData(report.ToArray()); MessageBox.Show(Strings.Item("Error_Failed")); } } } catch (Exception exInternal) when(!Globals.Root.IsDebug) { if (send) { MessageBox.Show(Strings.Item("Error_Failed") + "\r\n" + "(" + exInternal + ")"); } try { Globals.Root.LogPermanent.WriteLine("Failed to send error report: " + exInternal); } catch { } } }
public virtual void Save(DataWriter writer) { writer.Write(ID); }
public override void Save(DataWriter writer) { base.Save(writer); writer.Write(m_Bounds); }
public override void Save(DataWriter writer) { base.Save(writer); writer.Write(Image); writer.Write(MaskShape); }
public override void Save(DataWriter writer) { base.Save(writer); writer.Write(Element); writer.Write(SAWID); writer.Write(Popup); writer.Write(Shown); writer.Write(AutoRepeat); writer.Write(NotVisited); if (writer.Version >= 123) { writer.Write(RepeatTimeout); } // for each script a boolean is written first to indicate if it exists (true), or is null (false) for (int i = 0; i < Scripts.Length; i++) { writer.Write(Scripts[i] != null); Scripts[i]?.Write(writer); } if (writer.Version >= 129) { HighlightStyle.Save(writer); writer.Write(Sound?.ID ?? Guid.Empty); writer.WriteBufferedString(OutputText ?? ""); writer.Write(OutputAsDisplay); writer.Write(SpeechText ?? ""); writer.Write(SpeechAsDisplay); writer.Write(PromptText ?? ""); } }
public override void Write(DataWriter writer) { base.Write(writer); writer.Write(SingleParam); }
public override void Save(DataWriter writer) { base.Save(writer); writer.Write(m_Offset); }
public override void Save(DataWriter writer) { writer.Write(m_Closed); base.Save(writer); }