Exemplo n.º 1
0
        public void MakeSnapshot()
        {
            Guid snapshotId = LastSnapshotId;

            var  tree = ExperimentsTree.Load(SnapshotTreeFileName);
            var  node = tree.root.FindNode(snapshotId);
            Guid id   = node.AddNewChild();

            tree.Save(SnapshotTreeFileName);

            experiment.Id = id;
            experiment.Save(Path.Combine(projectDir, project.Files.ExperimentFileName));
            if (Settings.Default.ResetNewExperiment)
            {
                experiment.Reset();
            }

            DirectoryPacker.Pack(ModelDir, SnapshotDataFileName, id);

            //SQLAdmin.MakeBackup(null, id, experiment.Number, @"TRANQUILLITY-PC\SQLEXPRESS",
            //    "VISSIM", @"\\tranquillity-pc\Temp\", "sa", "Macciato777");

            LastSnapshotId = id;
            SaveProject();
        }
Exemplo n.º 2
0
        public void Initialize(string projectFileName)
        {
            ThreadPool.QueueUserWorkItem(o =>
            {
                OnInitialization();

                projectDir = Path.GetDirectoryName(projectFileName);

                Project = Project.Load(projectFileName);
                Experiment.Load(ExperimentFileName, LastSnapshotId);
                tree = ExperimentsTree.Load(SnapshotTreeFileName);

                LoadModel();

                if (Experiment.GetInstance(LastSnapshotId).HasBackup)
                {
                    TakeBackup(LastSnapshotId);
                }

                OnInitialized();
            });
        }
Exemplo n.º 3
0
        public void TakeSnapshot(ExperimentsTree.ExperimentsTreeNode node)
        {
            node.Open();
            node.Load();
            Tree.Save(TreeFileName);

            if (Experiment.GetInstance(node.Id).HasSnapshot) Experiment.GetInstance(node.Id).HasSnapshot = DirectoryPacker.UnPack(ModelDir, SnapshotDataFileName, node.Id);
            if (Experiment.GetInstance(node.Id).HasBackup) TakeBackup(node.Id);

            LastSnapshotId = node.Id;
            SaveProject();

            //string modelName = vissim.Instance.GetInputFileName();
            //string modelDir = vissim.Instance.GetWorkingDirectory();

            LoadModel();
        }