示例#1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Saves the dataset to a file, and associates that file with the
        /// dataset.
        /// </summary>
        public void SaveAs(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException();
            }
            if (path.Trim(null) == "")
            {
                throw new ArgumentException();
            }

            PersistentDataset persistentDataset = new PersistentDataset();

            foreach (ExtensionInfo extensionInfo in extensions)
            {
                persistentDataset.Extensions.Add(extensionInfo.PersistentInfo);
            }
            persistentDataset.Save(path);

            this.path = path;

            if (SavedEvent != null)
            {
                SavedEvent(this);
            }
        }
示例#2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance by loading the dataset from a file.
        /// </summary>
        /// <param name="path">
        /// Path to the file where the dataset is stored
        /// </param>
        public Dataset(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException();
            }
            if (path.Trim(null) == "")
            {
                throw new ArgumentException("path is empty or just whitespace.");
            }

            this.path = path;
            PersistentDataset dataset = PersistentDataset.Load(path);

            extensions = new List <ExtensionInfo>();
            foreach (PersistentDataset.ExtensionInfo info in dataset.Extensions)
            {
                extensions.Add(new ExtensionInfo(info));
            }
        }
        //---------------------------------------------------------------------
        /// <summary>
        /// Saves the dataset to a file, and associates that file with the
        /// dataset.
        /// </summary>
        public void SaveAs(string path)
        {
            if (path == null)
                throw new ArgumentNullException();
            if (path.Trim(null) == "")
                throw new ArgumentException();

            PersistentDataset persistentDataset = new PersistentDataset();
            foreach (ExtensionInfo extensionInfo in extensions)
                persistentDataset.Extensions.Add(extensionInfo.PersistentInfo);
            persistentDataset.Save(path);

            this.path = path;

            if (SavedEvent != null)
                SavedEvent(this);
        }
 //---------------------------------------------------------------------
 public ExtensionInfo(PersistentDataset.ExtensionInfo info)
 {
     persistentInfo = info;
 }