private void EndEdit(Dictionary <string, string> dct) { XmlDocument doc = XmlTool.CreateDocument("Settings"); SaveSettings(doc.DocumentElement, m_basePages); if (dct != null) { // modify settings before save foreach (var tuple in dct) { string name = tuple.Key; XmlElement node = doc.DocumentElement.SelectSingleNode("Param[@name='" + name + "']") as XmlElement; if (node != null) { node.SetAttribute("value", tuple.Value); } else { var p = doc.DocumentElement.AddChild("Param"); p.SetAttribute("name", name); p.SetAttribute("value", tuple.Value); } } } string dir = Path.GetDirectoryName(Filename); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } doc.Save(Filename); Unload(); }
public static IFavorite Clone(this IFavorite fav) { var doc = XmlTool.CreateDocument("Favorite"); fav.SaveToXml(doc.DocumentElement); return((IFavorite)FavoriteAddonType.Instance.LoadAddon(doc.DocumentElement)); }
public static void SaveToFile(this IAddonInstance addon, string file) { XmlDocument doc = XmlTool.CreateDocument("Addon"); addon.SaveToXml(doc.DocumentElement); doc.Save(file); }
public void Save() { var xml = XmlTool.CreateDocument("ServiceInfo"); this.SavePropertiesCore(xml.DocumentElement); xml.Save(Path.Combine(Core.ProgramDirectory, "ServiceInfo.xml")); }
public void Save(string file) { var doc = XmlTool.CreateDocument("QueryDesign"); Save(doc.DocumentElement); doc.Save(file); }
public void Save() { var doc = XmlTool.CreateDocument("InstallationInfo"); this.SaveProperties(doc.DocumentElement); doc.Save(Framework.InstallInfoFile); }
public void SaveToFile() { var doc = XmlTool.CreateDocument("TablePerspective"); SaveToXml(doc.DocumentElement); doc.Save(FileName); }
public void SaveToFile(string file) { var doc = XmlTool.CreateDocument("DockingLayout"); SaveToXml(doc.DocumentElement); doc.Save(file); }
public static string GetAndClear() { if (!Framework.Instance.AllowSendUsageStats()) { return(""); } var send = new List <UsageRecord>(); lock (m_usages) { send.AddRange(m_usages); m_usages.Clear(); } if (send.Count == 0) { return(""); } XmlDocument doc = XmlTool.CreateDocument("Statistic"); XmlElement xml = doc.DocumentElement; foreach (var item in send) { item.Save(xml.AddChild("Usage")); } return(doc.GetPackedDocumentXml()); }
public DmlfRelation Clone() { var doc = XmlTool.CreateDocument("Relation"); SaveToXml(doc.DocumentElement); return(new DmlfRelation(doc.DocumentElement)); }
public void LoadParts(TablePerspective per, bool select, bool conditions, bool dockpanel) { var doc = XmlTool.CreateDocument("Perspective"); per.SaveToXml(doc.DocumentElement); LoadParts(doc.DocumentElement, select, conditions, dockpanel); }
public void Save() { XmlDocument doc = XmlTool.CreateDocument("Connection"); SaveToXml(doc.DocumentElement); doc.Save(FileName); }
public void Save() { XmlDocument doc = XmlTool.CreateDocument("Backup"); this.SavePropertiesCore(doc.DocumentElement); Format.SaveToXml(doc.DocumentElement.AddChild("Format")); doc.Save(m_filename); }
public void Save(Stream fw) { XmlDocument doc = XmlTool.CreateDocument("Database"); XmlElement root = doc.DocumentElement; Save(root); doc.Save(fw); }
public void SaveToFile(string file) { XmlDocument doc = XmlTool.CreateDocument("Job"); m_rootCommand.SaveToXml(doc.DocumentElement); //doc.DocumentElement.SetAttribute("title", m_title); doc.Save(file); }
public static T CloneUsingXml <T>(this T obj) where T : IAddonInstance { var doc = XmlTool.CreateDocument("Addon"); obj.SaveToXml(doc.DocumentElement); return((T)obj.AddonType.LoadAddon(doc.DocumentElement)); }
public static void SerializeDiff(IVirtualFile file, object target) { XmlDocument doc = XmlTool.CreateDocument(target.GetType().Name); ObjectDiff.SaveDiff(target, target.GetType().CreateNewInstance(), doc.DocumentElement); MemoryStream ms = new MemoryStream(); doc.Save(ms); file.SaveBinary(ms.ToArray()); }
public virtual JobCommand Clone(bool newGroupId) { JobCommand res = (JobCommand)this.GetType().GetConstructor(new Type[] { }).Invoke(new object[] { }); XmlDocument doc = XmlTool.CreateDocument("Command"); SaveToXml(doc.DocumentElement); res.LoadFromXml(doc.DocumentElement); if (newGroupId) { res.GroupId = Guid.NewGuid().ToString(); } return(res); }
public void Save() { string dir = Path.GetDirectoryName(File); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var doc = XmlTool.CreateDocument("Favorite"); this.SavePropertiesCore(doc.DocumentElement); Favorite.SaveToXml(doc.DocumentElement); doc.Save(File); }
public static T CloneUsingXml <T>(T obj) where T : new() { if (obj == null) { return((T)(object)null); } var doc = XmlTool.CreateDocument("Object"); obj.SaveProperties(doc.DocumentElement); var res = new T(); res.LoadProperties(doc.DocumentElement); return(res); }
public static string GetFeedbackLicenseInfo() { if (m_licensesSent) { return(null); } var doc = XmlTool.CreateDocument("Licenses"); foreach (var lic in ValidLicenses) { doc.DocumentElement.AppendChild(doc.ImportNode(lic.SourceXml, true)); } m_licensesSent = true; return(doc.GetPackedDocumentXml()); }
public ProcessFailedError GetFailError() { var res = new ProcessFailedError(this); res.Data["process_name"] = ToString(); try { XmlDocument doc = XmlTool.CreateDocument("Job"); m_job.Root.SaveToXml(doc.DocumentElement); XmlTool.RemovePasswords(doc.DocumentElement); res.Data["job_definition"] = doc.OuterXml; } catch { } return(res); }
private void UpdateFavorite() { if (rbtDesign.Checked) { var des = XmlTool.CreateDocument("Design"); m_designFrame.Save(des.DocumentElement); addToFavoritesFrame1.Favorite = new OpenQueryDesignFavorite { Design = des, Context = m_context }; } else { if (rbtExecute.Checked) { if (rbtQueryText.Checked) { addToFavoritesFrame1.Favorite = new ExecuteQueryCodeFavorite { Query = m_queryCode, Context = m_context }; } if (rbtLinkToFile.Checked) { addToFavoritesFrame1.Favorite = new ExecuteQueryFileFavorite { QueryFile = m_file.DiskPath, Context = m_context }; } } if (rbtOpen.Checked) { if (rbtQueryText.Checked) { addToFavoritesFrame1.Favorite = new OpenQueryCodeFavorite { Query = m_queryCode, Context = m_context }; } if (rbtLinkToFile.Checked) { addToFavoritesFrame1.Favorite = new OpenQueryFileFavorite { QueryFile = m_file.DiskPath, Context = m_context }; } } } }
private static void DoSendError(Exception error, List <LogMessageRecord> logHistory, Bitmap screenshot) { try { var desc = ApiDescriptor.GetInstance(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(desc.SendError); req.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; req.Method = "POST"; XmlDocument doc = XmlTool.CreateDocument("Error"); XmlElement xml = doc.DocumentElement; xml.SetAttribute("version", VersionInfo.VERSION); xml.AddChild("Message").InnerText = error.Message; xml.AddChild("Type").InnerText = error.GetType().FullName; xml.AddChild("StackTrace").InnerText = error.StackTrace; //xml.AddChild("DataTree").InnerText = GetDataTree(); Exception se = error; while (se != null) { XmlTool.SaveParameters(xml, se.Data); se = se.InnerException; } xml.AddChild("Text").InnerText = error.ToString(); //if (logHistory != null && CheckAutoUpdate.SendErrorLogs) Logging.SaveLogs(logHistory, xml.AddChild("LogHistory")); Dictionary <string, string> pars = new Dictionary <string, string>(); StringWriter sw = new StringWriter(); doc.Save(sw); pars["DATA"] = sw.ToString(); //if (screenshot != null && CheckAutoUpdate.SendErrorScreenshots) pars["SCREENSHOT"] = SerializeScreenshot(screenshot); //if (CheckAutoUpdate.UpdateID != null) pars["PROGRAMUPDATE"] = CheckAutoUpdate.UpdateID.ToString(); FeedbackTool.FillStdParams(pars, true); string pars_enc = StringTool.UrlEncode(pars, Encoding.UTF8); byte[] data = Encoding.UTF8.GetBytes(pars_enc); req.ContentLength = data.Length; using (Stream fw = req.GetRequestStream()) { fw.Write(data, 0, data.Length); } using (var resp = req.GetResponse()) { using (Stream fr = resp.GetResponseStream()) { using (StreamReader reader = new StreamReader(fr)) { string line = reader.ReadToEnd(); Logging.Debug("Read result from datadmin feedback:" + line); } } } } catch (Exception err) { Errors.ReportSilent(err, false); } }
internal void LoadLayoutFromPanel(DockPanelContentFrame frame) { m_layout = XmlTool.CreateDocument("Layout"); frame.SaveLayout(m_layout.DocumentElement); }
public void Clear() { m_doc = XmlTool.CreateDocument("Design"); }