Beispiel #1
0
        public static object DeserializeObject(IVirtualFile file)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(file.GetText());
            return(DeserializeObject(doc));
        }
Beispiel #2
0
        public void Load(IVirtualFile file)
        {
            var doc = new XmlDocument();

            doc.LoadXml(file.GetText());
            LoadFromXml(doc.DocumentElement);
        }
Beispiel #3
0
        private void LoadFromFile(IVirtualFile file)
        {
            m_file = file;
            ChangedWinId();
            var doc = new XmlDocument();

            doc.LoadXml(m_file.GetText());
            var root   = doc.DocumentElement;
            var loader = (ITabularDataViewLoader)TabularDataViewLoaderAddonType.Instance.LoadAddon(root.FindElement("Data"));

            m_data = loader.CreateTabularDataView();
            var style = ChartStyle.LoadFromXml(root.FindElement("Style"));

            for (int i = 0; i < lbxStyle.Items.Count; i++)
            {
                if (style.GetType() == lbxStyle.Items[i].Tag.GetType())
                {
                    lbxStyle.Items[i].Tag = style;
                    lbxStyle.SelectOneItem(lbxStyle.Items[i], true);
                    break;
                }
            }

            m_loadProcessor = (IChartDataProcessor)ChartDataProcessorAddonType.Instance.LoadAddon(root.FindElement("Processor"));

            m_modified = false;
        }
Beispiel #4
0
        public static Diagram Load(IVirtualFile file)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(file.GetText());
            Diagram res = new Diagram();

            foreach (XmlElement child in doc.DocumentElement.SelectNodes("Table"))
            {
                res.Tables.Add(new DiagramTableItem(res, child));
            }
            XmlElement stx = (XmlElement)doc.DocumentElement.SelectSingleNode("Style");

            if (stx != null)
            {
                res.m_style = (DiagramStyle)DiagramStyleAddonType.Instance.LoadAddon(stx);
                //ObjectDiff.LoadDiff(res.Style, stx);
            }
            return(res);
        }
        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();
            }
        }