Esempio n. 1
0
        /// <summary>
        /// Revert this object to a previous one.
        /// </summary>
        /// <param name="checkpointName">Name of checkpoint</param>
        /// <returns>A new simulations object that represents the file on disk</returns>
        public Simulations RevertCheckpoint(string checkpointName)
        {
            IDataStore storage = Apsim.Find(this, typeof(DataStore)) as DataStore;

            if (storage != null)
            {
                storage.Writer.RevertCheckpoint(checkpointName);
            }
            List <Exception> creationExceptions = new List <Exception>();

            return(FileFormat.ReadFromFile <Simulations>(FileName, out creationExceptions));
        }
Esempio n. 2
0
        /// <summary>
        /// Revert this object to a previous one.
        /// </summary>
        /// <param name="checkpointName">Name of checkpoint</param>
        /// <returns>A new simulations object that represents the file on disk</returns>
        public Simulations RevertCheckpoint(string checkpointName)
        {
            IDataStore storage = this.FindInScope <DataStore>();

            if (storage != null)
            {
                storage.Writer.RevertCheckpoint(checkpointName);
                storage.Reader.Refresh();
            }
            List <Exception> creationExceptions = new List <Exception>();

            return(FileFormat.ReadFromFile <Simulations>(FileName, e => throw e, false));
        }