public static void SerializeObject(IVirtualFile file, object o) { StringWriter sw = new StringWriter(); XmlTextWriter fw = new XmlTextWriter(sw); SerializeObject(fw, o); file.SaveText(sw.ToString()); }
public void Save(IVirtualFile file) { XmlDocument doc = XmlTool.CreateDocument("Variant"); SaveToXml(doc.DocumentElement); using (var sw = new StringWriter()) { doc.Save(sw); file.SaveText(sw.ToString()); } }
private void DoSave() { var doc = XmlTool.CreateDocument("Chart"); var root = doc.DocumentElement; m_data.SaveToXml(root.AddChild("Data")); Style.SaveToXml(root.AddChild("Style")); Configurator.GetProcessor().SaveToXml(root.AddChild("Processor")); m_file.SaveText(doc.OuterXml); m_modified = false; }
public void Save(IVirtualFile file) { XmlDocument doc = XmlTool.CreateDocument("Diagram"); foreach (DiagramTableItem item in Tables) { item.Save(XmlTool.AddChild(doc.DocumentElement, "Table")); } //XmlElement stx = XmlTool.AddChild(doc.DocumentElement, "Style"); //ObjectDiff.SaveDiff(Style, new DiagramStyle(), stx); Style.SaveToXml(doc.DocumentElement.AddChild("Style")); using (StringWriter sw = new StringWriter()) { doc.Save(sw); file.SaveText(sw.ToString()); } }
public static void CopyFileTo(this IVirtualFile srcfile, IVirtualFile dstfile, CopyFileMode mode) { if (srcfile.DiskPath != null && dstfile.DiskPath != null && IOTool.FileIsLink(srcfile.DiskPath)) { IOTool.CopyFile(srcfile.DiskPath, dstfile.DiskPath, mode); return; } if (srcfile.DataDiskPath != null && dstfile.DataDiskPath != null) { IOTool.CopyFile(srcfile.DataDiskPath, dstfile.DataDiskPath, mode); return; } string text = null; byte[] data = null; try { text = srcfile.GetText(); } catch (Exception) { data = srcfile.GetBinary(); } if (text != null) { dstfile.SaveText(text); } else { dstfile.SaveBinary(data); } if (mode == CopyFileMode.Move) { srcfile.Remove(); } }