Exemplo n.º 1
0
        /// <summary>
        /// LoadProject
        /// </summary>
        /// <param name="info">the load project information.</param>
        public void LoadProject(ProjectInfo info)
        {
            List<EcellObject> passList = new List<EcellObject>();
            string message = "";
            string projectID = "";
            Project project = null;

            try
            {
                // Check Current.
                if (info == null)
                    throw new EcellException(MessageResources.ErrLoadPrj);
                if (m_currentProject != null)
                    CloseProject();

                // Create project.
                projectID = info.Name;
                message = "[" + projectID + "]";
                // Confirm Locked file.
                ConfirmLock(info);

                project = new Project(info, m_env);
                // Set current project.
                m_currentProject = project;
                m_env.PluginManager.ChangeStatus(ProjectStatus.Loading);

                // Load DMs.
                project.UnloadSimulator();
                m_env.DMDescriptorKeeper.Load(project.GetDMDirs());
                project.ReloadSimulator();

                // Create EcellProject.
                List<EcellData> ecellDataList = new List<EcellData>();
                ecellDataList.Add(new EcellData(Constants.textComment, new EcellValue(project.Info.Comment), null));
                passList.Add(EcellObject.CreateObject(projectID, "", Constants.xpathProject, "", ecellDataList));

                // Prepare datas.
                project.LoadModel();
                foreach (EcellObject model in project.ModelList)
                {
                    Trace.WriteLine(string.Format(MessageResources.InfoLoadModel, model.ModelID));
                    m_env.Console.WriteLine(string.Format(MessageResources.InfoLoadModel, model.ModelID));
                    m_env.Console.Flush();
                    passList.Add(model);
                }
                foreach (string storedModelID in project.SystemDic.Keys)
                {
                    passList.AddRange(project.StepperDic[storedModelID]);
                    passList.AddRange(project.SystemDic[storedModelID]);
                }

                // Set current project.
                m_currentProject = project;

                // Load analysis directory.
                LoadAnalysisDirectory(project);

                // Load SimulationParameters.
                LoadSimulationParameters(project);
                m_env.PluginManager.ParameterSet(projectID, project.Info.SimulationParam);
                m_editCount = 0;
                ClearSteppingModel();
            }
            catch (Exception ex)
            {
                passList = null;
                CloseProject();
                throw new EcellException(string.Format(MessageResources.ErrLoadPrj, projectID)+ "\n" + ex.Message, ex);
            }
            finally
            {
                if (m_currentProject != null)
                {
                    if (passList != null && passList.Count > 0)
                    {
                        this.m_env.PluginManager.DataAdd(passList);
                    }
                    foreach (string paramID in this.GetSimulationParameterIDs())
                    {
                        this.m_env.PluginManager.ParameterAdd(projectID, paramID);
                    }

                    m_env.ActionManager.AddAction(new LoadProjectAction(projectID, project.Info.Filename));

                    // Send Message.
                    m_env.Console.WriteLine(string.Format(MessageResources.InfoLoadPrj, projectID));
                    m_env.Console.Flush();

                    m_env.PluginManager.ChangeStatus(ProjectStatus.Loaded);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Save Project
 /// </summary>
 private void SaveProject(ProjectInfo info)
 {
     try
     {
         m_env.DataManager.SaveProject();
         CheckAndReplaceRecentProject(info);
     }
     catch (Util.CancelException)
     {
         return;
     }
     catch (EcellException e)
     {
         if(e.InnerException is UnauthorizedAccessException)
             Util.ShowErrorDialog(string.Format(MessageResources.ErrUnauthorizedAccess, Util.GetBaseDir()));
         else
             Util.ShowErrorDialog(e.Message);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Replace the recent project,
 /// </summary>
 /// <param name="info">the recent project.</param>
 private void CheckAndReplaceRecentProject(ProjectInfo info)
 {
     if (info.Type == ProjectType.Template)
         return;
     KeyValuePair<string, string> oldProject = new KeyValuePair<string,string>();
     foreach (KeyValuePair<string, string> project in m_recentProjects)
     {
         if (project.Key.Equals(info.Name))
             oldProject = project;
     }
     if (oldProject.Key != null)
         m_recentProjects.Remove(oldProject);
     if (File.Exists(info.Filename))
         m_recentProjects.Add(new KeyValuePair<string, string>(info.Name, info.Filename));
     ResetRecentProjectMenu();
 }
Exemplo n.º 4
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }
Exemplo n.º 5
0
        public void TestProjectInfoAccessors()
        {
            // Check Default Parameter.
            try
            {
                ProjectInfo info = new ProjectInfo();
                Assert.IsNotNull(info, "Constructor of type, ProjectInfo failed to create instance.");
                Assert.AreEqual(Constants.defaultPrjID, info.Name, "Name is unexpected value.");
                Assert.AreEqual(Constants.defaultComment, info.Comment, "Comment is unexpected value.");
                Assert.AreEqual(Constants.defaultSimParam, info.SimulationParam, "SimulationParam is unexpected value.");
                Assert.AreEqual(ProjectType.NewProject, info.Type, "ProjectType is unexpected value.");
                Assert.IsNotNull(info.UpdateTime, "UpdateTime is unexpected value.");
                Assert.IsNull(info.ProjectPath, "ProjectPath is unexpected value.");
                Assert.IsNull(info.Filename, "ProjectFile is unexpected value.");
                Assert.IsEmpty(info.DMDirList, "DMDirList is unexpected value.");
                Assert.IsEmpty(info.Models, "Models is unexpected value.");

            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
                Assert.Fail("Error on Default Parameter.");
            }
            // Check Default Parameter.
            try
            {
                ProjectInfo info = new ProjectInfo(Name, Comment, Time, SimParam);
                Assert.IsNotNull(info, "Constructor of type, ProjectInfo failed to create instance.");
                Assert.AreEqual(Name, info.Name, "Name is unexpected value.");
                Assert.AreEqual(Comment, info.Comment, "Comment is unexpected value.");
                Assert.AreEqual(SimParam, info.SimulationParam, "SimulationParam is unexpected value.");
                Assert.AreEqual(Time, info.UpdateTime, "UpdateTime is unexpected value.");
                Assert.AreEqual(ProjectType.NewProject, info.Type, "ProjectType is unexpected value.");
                Assert.IsNull(info.ProjectPath, "ProjectPath is unexpected value.");
                Assert.IsNull(info.Filename, "ProjectFile is unexpected value.");
                Assert.IsEmpty(info.DMDirList, "DMDirList is unexpected value.");
                Assert.IsEmpty(info.Models, "Models is unexpected value.");

            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
                Assert.Fail("Error on Default Parameter.");
            }

            // Check Accessor's Setter.
            try
            {
                ProjectInfo info = new ProjectInfo();
                Assert.IsNotNull(info, "Constructor of type, ProjectInfo failed to create instance.");

                info.Name = Name;
                info.Comment = Comment;
                info.UpdateTime = Time;
                info.SimulationParam = SimParam;
                info.ProjectPath = "";
                info.Filename = "";
                info.DMDirList.Add("");
                info.Models.Add("");

                info.Comment = null;
                info.UpdateTime = null;
                info.ProjectPath = null;
                info.Filename = null;
                info.DMDirList.Clear();
                info.Models.Clear();

                Assert.AreEqual(Name, info.Name, "Name is unexpected value.");
                Assert.AreEqual(null, info.Comment, "Comment is unexpected value.");
                Assert.AreEqual(SimParam, info.SimulationParam, "SimulationParam is unexpected value.");
                Assert.AreNotEqual(null, info.UpdateTime, "UpdateTime is unexpected value.");
                Assert.AreEqual(ProjectType.NewProject, info.Type, "ProjectType is unexpected value.");
                Assert.IsNull(info.ProjectPath, "ProjectPath is unexpected value.");
                Assert.IsNull(info.Filename, "ProjectFile is unexpected value.");
                Assert.IsEmpty(info.DMDirList, "DMDirList is unexpected value.");
                Assert.IsEmpty(info.Models, "Models is unexpected value.");

            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
                Assert.Fail("Error on Default Parameter.");
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public void ConfirmLock(ProjectInfo info)
 {
     if (info.Type != ProjectType.Project)
         return;
     string filename = info.Filename;
     FileStream stream = null;
     try
     {
         stream = File.Open(filename, FileMode.Open, FileAccess.ReadWrite);
     }
     catch (Exception e)
     {
         throw new EcellException(string.Format(MessageResources.ErrLockedFile, filename), e);
     }
     finally
     {
         if (stream != null)
             stream.Close();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Get Project from Info file.
        /// </summary>
        /// <param name="filepath">the project information file path.</param>
        /// <param name="access">Access Mode.</param>
        /// <returns>the project information object.</returns>
        private static ProjectInfo LoadProjectFromInfo(string filepath, FileAccess access)
        {
            ProjectInfo project = null;
            string line = "";
            string comment = "";
            string simParam = Constants.defaultSimParam;
            string time = File.GetLastWriteTime(filepath).ToString();

            string dirPathName = Path.GetDirectoryName(filepath);
            string prjName = Path.GetFileName(dirPathName);
            FileStream stream = new FileStream(filepath, FileMode.Open, access, FileShare.Read);
            TextReader reader = new StreamReader(stream);
            while ((line = reader.ReadLine()) != null)
            {
                if (line.IndexOf(Constants.textComment) == 0)
                {
                    if (line.IndexOf(Constants.delimiterEqual) != -1)
                    {
                        comment = line.Split(Constants.delimiterEqual.ToCharArray())[1].Trim();
                    }
                    else
                    {
                        comment = line.Substring(line.IndexOf(Constants.textComment));
                    }
                }
                else if (line.IndexOf(Constants.textParameter) == 0)
                {
                    simParam = line;
                }
                else if (!comment.Equals(""))
                {
                    comment = comment + "\n" + line;
                }
                else if (line.IndexOf(Constants.xpathProject) == 0)
                {
                    if (line.IndexOf(Constants.delimiterEqual) != -1)
                    {
                        prjName = line.Split(Constants.delimiterEqual.ToCharArray())[1].Trim();
                    }
                    else
                    {
                        prjName = line.Substring(line.IndexOf(Constants.textComment));
                    }
                }
            }
            stream.Close();
            reader.Close();
            project = new ProjectInfo(prjName, comment, time, simParam);
            project.Type = ProjectType.Project;
            project.ProjectPath = dirPathName;

            return project;
        }
Exemplo n.º 8
0
 public void TestProjectInfoConstructors()
 {
     // Correct Check
     try
     {
         ProjectInfo info;
         info = new ProjectInfo();
         //
         info = new ProjectInfo(Name, Comment, Time, SimParam);
         info = new ProjectInfo(Name, "", Time, SimParam);
         info = new ProjectInfo(Name, null, Time, SimParam);
         info = new ProjectInfo(Name, Comment, "", SimParam);
         info = new ProjectInfo(Name, Comment, null, SimParam);
         info = new ProjectInfo(Name, null, null, SimParam);
     }
     catch (Exception e)
     {
         Trace.WriteLine(e.StackTrace);
         Assert.Fail("Error on Constructor.");
     }
 }
Exemplo n.º 9
0
        public void TestProjectInfoConstructorsErrorCase()
        {
            // Error Check
            try
            {
                ProjectInfo info = new ProjectInfo("", Comment, Time, SimParam);
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }

            // Error Check
            try
            {
                ProjectInfo info = new ProjectInfo(null, Comment, Time, SimParam);
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }

            // Error Check
            try
            {
                ProjectInfo info = new ProjectInfo(Name, "", "", "");
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }

            // Error Check
            try
            {
                ProjectInfo info = new ProjectInfo(Name, "", "", null);
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// GetSaveDir
        /// </summary>
        /// <param name="info">project information object.</param>
        /// <param name="filepath">the project information file path.</param>
        /// <returns>the save directory.</returns>
        private static string GetSaveDir( ProjectInfo info, string filepath)
        {
            // If filepath is empty, create new path.
            if (string.IsNullOrEmpty(filepath))
                return Path.Combine(Util.GetBaseDir(), info.Name);
            // if filepath is directory. return directory path.
            if (Directory.Exists(filepath))
                return filepath;

            string ext = Path.GetExtension(filepath);
            if (ext.Equals(Constants.FileExtINFO) || ext.Equals(Constants.FileExtXML))
                return Path.GetDirectoryName(filepath);
            else if (ext.Equals(Constants.FileExtEML))
                return Path.Combine(Util.GetBaseDir(), Path.GetFileNameWithoutExtension(filepath));
            else
                return filepath;
        }
Exemplo n.º 11
0
 public void TestProjectInfoAccessorsErrorCase()
 {
     // Check Accessor error.
     try
     {
         ProjectInfo info = new ProjectInfo();
         info.Name = null;
         Assert.Fail("Incorrect null check.");
     }
     catch (Exception e)
     {
         Trace.WriteLine(e.StackTrace);
     }
     try
     {
         ProjectInfo info = new ProjectInfo();
         info.SimulationParam = null;
         Assert.Fail("Incorrect null check.");
     }
     catch (Exception e)
     {
         Trace.WriteLine(e.StackTrace);
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// SaveProjectXML
        /// </summary>
        /// <param name="project">the project information object.</param>
        /// <param name="saveDir">the save directory.</param>
        public static void SaveProjectXML(ProjectInfo project, string saveDir)
        {
            XmlTextWriter xmlOut = null;
            string projectXML = Path.Combine(saveDir, Constants.fileProjectXML);
            try
            {
                project.Type = ProjectType.Project;

                // Create xml file
                xmlOut = new XmlTextWriter(projectXML, Encoding.UTF8);

                // Use indenting for readability
                xmlOut.Formatting = Formatting.Indented;
                xmlOut.WriteStartDocument();

                // Always begin file with identification and warning
                xmlOut.WriteComment(Constants.xPathFileHeader1);
                xmlOut.WriteComment(Constants.xPathFileHeader2);

                project.EditCount++;
                // Save settings.
                xmlOut.WriteStartElement(Constants.xPathEcellProject);
                xmlOut.WriteElementString(Constants.xpathProject, project.Name);
                xmlOut.WriteElementString(Constants.textDate, project.CreationTime);
                xmlOut.WriteElementString(Constants.textCreator, project.Creator);
                xmlOut.WriteElementString(Constants.textEditCount, project.EditCount.ToString());
                xmlOut.WriteElementString(Constants.textComment, project.Comment);
                xmlOut.WriteElementString(Constants.textParameter, project.SimulationParam);
                xmlOut.WriteElementString(Constants.xpathType, ((Int32)project.Type).ToString());
                xmlOut.WriteEndElement();
                xmlOut.WriteEndDocument();

                project.ProjectPath = saveDir;
                project.UpdateTime = DateTime.Now.ToString();
                project.Filename = projectXML;
            }
            finally
            {
                if (xmlOut != null)
                {
                    xmlOut.Close();
                }
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Save the project information.
 /// </summary>
 /// <param name="project">target project</param>
 /// <param name="filepath">the project information file path.</param>
 public static void Save(ProjectInfo project, string filepath)
 {
     try
     {
         // Get Saving Directory.
         string saveDir = GetSaveDir(project, filepath);
         if (!Directory.Exists(saveDir))
             Directory.CreateDirectory(saveDir);
         // Save XML setting file.
         SaveProjectXML(project, saveDir);
     }
     catch (Exception ex)
     {
         throw new EcellException(ex.Message, ex);
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// Get Project from XML file.
        /// </summary>
        /// <param name="filepath">the xml file path.</param>
        /// <param name="access">Access Mode.</param>
        /// <returns>the project information object.</returns>
        private static ProjectInfo LoadProjectFromXML(string filepath, FileAccess access)
        {
            ProjectInfo project = null;
            string dirPath = Path.GetDirectoryName(filepath);
            string prjName = Path.GetFileName(dirPath);
            string comment = "";
            string createTime = "";
            string param = Constants.defaultSimParam;
            string creator = "";
            int editCount = 0;
            ProjectType type = ProjectType.Project;
            try
            {
                // Load XML file
                FileStream stream = new FileStream(filepath, FileMode.Open, access, FileShare.Read);
                XmlDocument xmlD = new XmlDocument();
                xmlD.Load(stream);

                XmlNode settings = null;
                foreach (XmlNode node in xmlD.ChildNodes)
                {
                    if (node.Name.Equals(Constants.xPathEcellProject))
                        settings = node;
                }
                if (settings == null)
                    throw new EcellException("No Project Settings.");

                // Load settings.
                foreach (XmlNode setting in settings.ChildNodes)
                {
                    switch (setting.Name)
                    {
                        // Project
                        case Constants.xpathProject:
                            prjName = setting.InnerText;
                            break;
                        // Date
                        case Constants.textDate:
                            createTime = setting.InnerText;
                            break;
                        // Comment
                        case Constants.textComment:
                            comment = setting.InnerText;
                            break;
                        // Creator
                        case Constants.textCreator:
                            creator = setting.InnerText;
                            break;
                        // EditCount
                        case Constants.textEditCount:
                            int.TryParse(setting.InnerText, out editCount);
                            break;
                        // SimulationParameter
                        //case Constants.textParameter:
                        //    param = setting.InnerText;
                        //    break;
                        case Constants.xpathType:
                            type = (ProjectType)Convert.ToInt32(setting.InnerText);
                            break;
                    }
                }
                // File close
                stream.Close();

                // Setup
                project = new ProjectInfo(prjName, comment, createTime, param);
                if (!(type == ProjectType.Project || type == ProjectType.Template || type == ProjectType.Revision))
                    type = ProjectType.Project;
                project.Type = type;
                project.ProjectPath = dirPath;
                project.CreationTime = createTime;
                project.Creator = creator;
                project.EditCount = editCount;
                project.UpdateTime = File.GetLastWriteTime(filepath).ToString();

                // Set DM Path.
                string dmPath = Path.Combine(dirPath, Constants.DMDirName);
                if(Directory.Exists(dmPath))
                    project.DMDirList.Add(dmPath);
            }
            catch (Exception ex)
            {
                throw new EcellException("Failed to load Project XML", ex);
            }
            return project;
        }
Exemplo n.º 15
0
        /// <summary>
        /// LoadSBML
        /// </summary>
        /// <param name="filename">the SBML file name.</param>
        public void LoadSBML(string filename)
        {
            WrappedSimulator sim = null;
            try
            {
                CloseProject();
                m_env.PluginManager.ChangeStatus(ProjectStatus.Loading);

                // Load model
                EcellModel model = SBML2EML.Convert(filename);

                // Initialize
                try
                {
                    sim = new WrappedSimulator(Util.GetDMDirs());
                    EmlReader.InitializeModel(model, sim);
                    sim.Initialize();
                }
                catch (Exception e)
                {
                    if (m_env.PluginManager.DockPanel != null)
                        Util.ShowWarningDialog(MessageResources.WarnInvalidData + "\n" + e.Message);
                    Trace.WriteLine(e.ToString());
                }

                // Create Project
                string projectID = model.ModelID;
                string comment = "Convert from SBML: " + Path.GetFileName(filename);
                ProjectInfo info = new ProjectInfo(projectID, comment, DateTime.Now.ToString(), Constants.defaultSimParam);
                info.Type = ProjectType.SBML;
                Project project = new Project(info, m_env);
                project.LoggerPolicyDic[Constants.defaultSimParam] = new LoggerPolicy();
                m_currentProject = project;
                project.Simulator = sim;
                project.InitializeModel(model, sim);

                // Load model
                List<EcellObject> passList = new List<EcellObject>();
                List<EcellData> ecellDataList = new List<EcellData>();
                ecellDataList.Add(new EcellData(Constants.textComment, new EcellValue(comment), null));
                passList.Add(EcellObject.CreateObject(projectID, "", Constants.xpathProject, "", ecellDataList));
                passList.Add(model);
                passList.AddRange(model.Children);
                m_env.PluginManager.DataAdd(passList);
                m_env.PluginManager.ParameterSet(projectID, Constants.defaultSimParam);
                m_env.PluginManager.ChangeStatus(ProjectStatus.Loaded);

            }
            catch (Exception e)
            {
                CloseProject();
                m_env.Console.WriteLine("Failed to convert SBML: " + filename);
                m_env.Console.WriteLine(e.ToString());
                throw new EcellException("Failed to convert SBML. " + filename, e);
            }
        }
Exemplo n.º 16
0
        public void TestProjectInfoSaverErrorCase()
        {
            try
            {
                ProjectInfo info = new ProjectInfo();
                info.Save();
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }

            try
            {
                ProjectInfo info = new ProjectInfo();
                info.Save();
                Assert.Fail("Incorrect null check.");
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.StackTrace);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Creates the new "Project" object.
        /// </summary>
        /// <param name="projectID">The "Project" ID</param>
        /// <param name="comment">The comment</param>
        private void CreateProject(string projectID, string comment)
        {
            Project prj = null;
            try
            {
                //
                // Closes the current project.
                //
                if (m_currentProject != null)
                {
                    this.CloseProject();
                }
                //
                // Initialize
                //
                ProjectInfo info = new ProjectInfo(projectID, comment, DateTime.Now.ToString(), Constants.defaultSimParam);
                prj = new Project(info, m_env);
                m_currentProject = prj;

                //
                // 4 PluginManager
                //
                List<EcellData> ecellDataList = new List<EcellData>();
                ecellDataList.Add(new EcellData(Constants.textComment, new EcellValue(comment), null));
                EcellObject ecellObject
                        = EcellObject.CreateObject(projectID, "", Constants.xpathProject, "", ecellDataList);
                List<EcellObject> ecellObjectList = new List<EcellObject>();
                ecellObjectList.Add(ecellObject);
                m_env.PluginManager.DataAdd(ecellObjectList);
                m_env.ActionManager.AddAction(new NewProjectAction(projectID, comment));
                m_env.PluginManager.ChangeStatus(ProjectStatus.Loaded);

                m_env.Console.WriteLine(string.Format(MessageResources.InfoCrePrj, projectID));
                m_env.Console.Flush();
                Trace.WriteLine(string.Format(MessageResources.InfoCrePrj, projectID));
            }
            catch (Exception ex)
            {
                if (m_currentProject != null)
                    m_currentProject.Close();
                m_currentProject = null;
                string message = string.Format(
                        MessageResources.ErrCrePrj,
                        projectID);
                Trace.WriteLine(message);
                throw new EcellException(message, ex);
            }
        }
Exemplo n.º 18
0
 public void SetUp()
 {
     _unitUnderTest = new ProjectInfo();
 }
Exemplo n.º 19
0
        /// <summary>
        /// Creates the new "Project" instance with ProjectInfo.
        /// </summary>
        /// <param name="info">the project information object.</param>
        /// <param name="env">ApplicationEnvironment</param>
        public Project(ProjectInfo info, ApplicationEnvironment env)
        {
            if (info == null)
                throw new EcellException(string.Format(MessageResources.ErrInvalidParam, "ProjectInfo"));
            if (env == null)
                throw new EcellException(string.Format(MessageResources.ErrInvalidParam, "ApplicationEnvironment"));

            m_info = info;
            m_env = env;
            m_stepperDic = new Dictionary<string, List<EcellObject>>();
            m_modelList = new List<EcellModel>();
            m_systemDic = new Dictionary<string, List<EcellObject>>();
            m_logableEntityPathDic = new Dictionary<string, string>();
            m_loggerPolicyDic = new Dictionary<string, LoggerPolicy>();

            // Loads the model.
            if (info.Type != ProjectType.Model)
                info.FindModels();

            SetDMList();
            m_simulator = CreateSimulatorInstance();
            //
            Lock();
        }
Exemplo n.º 20
0
 /// <summary>
 /// Get Project from Eml file.
 /// </summary>
 /// <param name="filepath">the eml file path.</param>
 /// <returns>the project information object.</returns>
 private static ProjectInfo LoadProjectFromEml(string filepath)
 {
     ProjectInfo project = null;
     string name = Path.GetFileNameWithoutExtension(filepath);
     string comment = "";
     string time = File.GetLastWriteTime(filepath).ToString();
     project = new ProjectInfo(name, comment, time, Constants.defaultSimParam);
     project.Models.Add(filepath);
     project.Type = ProjectType.Model;
     return project;
 }