示例#1
0
        /// <summary>
        /// Creates a new experiment folder,
        /// copy files to it from model dir.
        /// and marks it as loaded and selected in the project file
        /// </summary>
        public void CreateExperiment(Experiment.ExperimentData expData)
        {
            // get max experiment number
            int max = SysAdmin.GetMaxDirNumber(manager.GetRootExperimentPath(modelName));

            ++max;
            // create new experiment folder
            string s = manager.GetLoadedExperimentAbsolutePath(modelName);

            string experimentPath = string.Format("{0}#{1}", s, max);

            if (max == 0)
            {
                experimentPath = string.Format("{0}{1}#{2}", s, modelName, max);
            }

            var di = Directory.CreateDirectory(string.Format("{0}\\{1}{2}", experimentPath, modelName, Model.MODEL_DIR_POSTFIX));

            // copy main model folder to the new model folder
            s = manager.GetModelDir(modelName);
            SysAdmin.CopyDirectory(s, di.FullName);

            // create experiment data file in the experiment folder
            s = string.Format("{0}\\{1}{2}", experimentPath, modelName, Experiment.ExperimentData.EXPERIMENT_DATA_POSTFIX);
            expData.Save(s);
            // mark experiment as loaded
            manager.MarkExperimentAsLoaded(modelName, experimentPath);
            manager.MarkExperimentAsSelected(modelName, experimentPath);
        }
示例#2
0
        public void CreateRootExperiment()
        {
            // create new experiment folder
            var di = Directory.CreateDirectory(manager.GetLoadedExperimentModelDir(modelName));

            // copy main model folder to new model folder
            string s = manager.GetModelDir(modelName);

            SysAdmin.CopyDirectory(s, di.FullName);

            // create experiment data file in the experiment folder
            var expData = new Experiment.ExperimentData()
            {
                //Alanyze = false,
                CreatedOn   = DateTime.Now,
                Description = "Zero Experiment (created automatically)",
                //Duration = new TimeSpan(0),
                //DurationTicks = 0
            };

            expData.Save(manager.GetLoadedExperimentDataFileName(modelName));
        }