public void StartDebugLog(object target) { string result = ""; try { uint num = 0u; result = Simulator.CreateScriptErrorFile(ref num); if (num != 0u) { mLogXmlWriter = new CustomXmlWriter(num); mLogXmlWriter.WriteStartDocument(); mLogXmlWriter.WriteElementString("VirtualArtisanDebugger", target.GetType().ToString()); string[] data = GameUtils.GetGenericString(GenericStringID.VersionData).Split(new char[] { '\n' }); string[] labels = GameUtils.GetGenericString(GenericStringID.VersionLabels).Split(new char[] { '\n' }); int count = (labels.Length > data.Length) ? data.Length : labels.Length; for (int i = 0; i < count; i++) { if (labels[i] == "Game Version:") { mLogXmlWriter.WriteElementString("GameVersion", data[i]); } else if (labels[i] == "Build Version:") { mLogXmlWriter.WriteElementString("BuildVersion", data[i]); } } IGameUtils gameUtils = (IGameUtils)AppDomain.CurrentDomain.GetData("GameUtils"); if (gameUtils != null) { ProductVersion productFlags = (ProductVersion)gameUtils.GetProductFlags(); mLogXmlWriter.WriteElementString("Installed", productFlags.ToString()); } mLogXmlWriter.WriteStartElement("Assemblies"); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string shortName = assembly.FullName.Replace(", Culture=neutral", ""); mLogXmlWriter.WriteElementString("Assembly", shortName); } mLogXmlWriter.WriteEndElement(); mLogXmlWriter.FlushBufferToFile(); NotifyUserOfDebugging(result); } } catch (Exception ex) { EndDebugLog(); string title = I18n.Localize(CommonTexts.DEBUG_CANNOT_START_LOGGER, "Virtual Artisan Debugger CANNOT be started"); string text = I18n.Localize(CommonTexts.DEBUG_CANNOT_CREATE_LOG_FILE, "Cannot create debug log"); Message.Sender.ShowError(title, text, false, ex); } }
private void StartDebugLog(object target) { string result = ""; try { uint num = 0u; result = Simulator.CreateScriptErrorFile(ref num); if (num != 0u) { mLogXmlWriter = new CustomXmlWriter(num); mLogXmlWriter.WriteStartDocument(); mLogXmlWriter.WriteElementString("VirtualArtisanDebugger", target.GetType().ToString()); string[] data = GameUtils.GetGenericString(GenericStringID.VersionData).Split(new char[] { '\n' }); string[] labels = GameUtils.GetGenericString(GenericStringID.VersionLabels).Split(new char[] { '\n' }); int count = (labels.Length > data.Length) ? data.Length : labels.Length; for (int i = 0; i < count; i++) { if (labels[i] == "Game Version:") { mLogXmlWriter.WriteElementString("GameVersion", data[i]); } else if (labels[i] == "Build Version:") { mLogXmlWriter.WriteElementString("BuildVersion", data[i]); } } IGameUtils gameUtils = (IGameUtils)AppDomain.CurrentDomain.GetData("GameUtils"); if (gameUtils != null) { ProductVersion productFlags = (ProductVersion)gameUtils.GetProductFlags(); mLogXmlWriter.WriteElementString("Installed", productFlags.ToString()); } mLogXmlWriter.WriteStartElement("Assemblies"); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string shortName = assembly.FullName.Replace(", Culture=neutral", ""); mLogXmlWriter.WriteElementString("Assembly", shortName); } mLogXmlWriter.WriteEndElement(); mLogXmlWriter.FlushBufferToFile(); } } catch (Exception ex) { EndDebugLog(); } }
private static void Save() { PrintLine("Atempting Save of leaderboards"); FileStream fs = UFile.Create(_savePath); CustomXmlWriter cxw = CustomXmlWriter.Create(fs); cxw.WriteStartDocument(); cxw.WriteStartElement("LocalScores"); foreach (QueuededScore qs in _scoresToSend) { cxw.WriteStartElement("ScoresToSend"); cxw.WriteAttributeString("Leaderboard", qs.Leaderboard); cxw.WriteAttributeULong("Id", qs.Score.Principal_ID); cxw.WriteAttributeULong("Nex_Id", qs.Score.Nex_Unique_ID); cxw.WriteAttributeULong("Misc", qs.Score.Misc); cxw.WriteAttributeUInt("Score", qs.Score.Score); cxw.WriteAttributeArray <byte>("Cud", qs.Score.CommonDataBinary); cxw.WriteAttributeString("UserName", qs.Score.CommonDataUserName); cxw.WriteAttributeInt("Type", (int)qs.Type); cxw.WriteEndElement(); } foreach (KeyValuePair <string, List <HighScore> > kvp in _localLeaderboards) { cxw.WriteStartElement("Leaderboard"); cxw.WriteAttributeString("Name", kvp.Key); foreach (HighScore hs in kvp.Value) { cxw.WriteStartElement("Score"); cxw.WriteAttributeULong("Id", hs.Principal_ID); cxw.WriteAttributeULong("Nex_Id", hs.Nex_Unique_ID); cxw.WriteAttributeUInt("Score", hs.Score); cxw.WriteAttributeULong("Misc", hs.Misc); cxw.WriteAttributeString("UserName", hs.CommonDataUserName); cxw.WriteAttributeArray <byte>("Cud", hs.CommonDataBinary); cxw.WriteEndElement(); } cxw.WriteEndElement(); } cxw.WriteEndElement(); cxw.WriteEndDocument(); cxw.Close(); fs.Close(); UFile.Commit(); PrintLine("Save Compleate"); }