Пример #1
0
        private void CreateSubCommands()
        {
            _archiveXml = new XmlDocument();
            _studyXml   = _storageLocation.LoadStudyXml();
            string studyFolder = _storageLocation.GetStudyPath();

            // Create the study date folder
            _zipFilename = Path.Combine(_hsmPath, _storageLocation.StudyFolder);
            AddSubCommand(new CreateDirectoryCommand(_zipFilename));

            // Create a folder for the study
            _zipFilename = Path.Combine(_zipFilename, _storageLocation.StudyInstanceUid);
            AddSubCommand(new CreateDirectoryCommand(_zipFilename));

            // Save the archive data in the study folder, based on a filename with a date / time stamp
            string filename = String.Format("{0}.zip", Platform.Time.ToString("yyyy-MM-dd-HHmm"));

            _zipFilename = Path.Combine(_zipFilename, filename);


            // Create the Xml data to store in the ArchiveStudyStorage table telling
            // where the archived study is located.
            XmlElement hsmArchiveElement = _archiveXml.CreateElement("HsmArchive");

            _archiveXml.AppendChild(hsmArchiveElement);
            XmlElement studyFolderElement = _archiveXml.CreateElement("StudyFolder");

            hsmArchiveElement.AppendChild(studyFolderElement);
            studyFolderElement.InnerText = _storageLocation.StudyFolder;
            XmlElement filenameElement = _archiveXml.CreateElement("Filename");

            hsmArchiveElement.AppendChild(filenameElement);
            filenameElement.InnerText = filename;
            XmlElement studyInstanceUidElement = _archiveXml.CreateElement("Uid");

            hsmArchiveElement.AppendChild(studyInstanceUidElement);
            studyInstanceUidElement.InnerText = _storageLocation.StudyInstanceUid;

            // Create the Zip file
            var zipStudyCommand = new CreateStudyZipCommand(_zipFilename, _studyXml, studyFolder, _tempPath)
            {
                ForceCompress = this.ForceCompress
            };

            zipStudyCommand.ProgressUpdated += (s, e) => EventsHelper.Fire(this.ProgressUpdated, this, e);
            AddSubCommand(zipStudyCommand);

            // Update the database.
            AddSubCommand(new InsertArchiveStudyStorageCommand(_storageLocation.GetKey(), _archive.GetKey(), _storageLocation.ServerTransferSyntaxKey, _archiveXml));
        }
Пример #2
0
		private void CreateSubCommands()
		{
			_archiveXml = new XmlDocument();
			_studyXml = _storageLocation.LoadStudyXml();
			string studyFolder = _storageLocation.GetStudyPath();

			// Create the study date folder
			_zipFilename = Path.Combine(_hsmPath, _storageLocation.StudyFolder);
			AddSubCommand(new CreateDirectoryCommand(_zipFilename));

			// Create a folder for the study
			_zipFilename = Path.Combine(_zipFilename, _storageLocation.StudyInstanceUid);
			AddSubCommand(new CreateDirectoryCommand(_zipFilename));

			// Save the archive data in the study folder, based on a filename with a date / time stamp
			string filename = String.Format("{0}.zip", Platform.Time.ToString("yyyy-MM-dd-HHmm"));
			_zipFilename = Path.Combine(_zipFilename, filename);


			// Create the Xml data to store in the ArchiveStudyStorage table telling
			// where the archived study is located.
			XmlElement hsmArchiveElement = _archiveXml.CreateElement("HsmArchive");
			_archiveXml.AppendChild(hsmArchiveElement);
			XmlElement studyFolderElement = _archiveXml.CreateElement("StudyFolder");
			hsmArchiveElement.AppendChild(studyFolderElement);
			studyFolderElement.InnerText = _storageLocation.StudyFolder;
			XmlElement filenameElement = _archiveXml.CreateElement("Filename");
			hsmArchiveElement.AppendChild(filenameElement);
			filenameElement.InnerText = filename;
			XmlElement studyInstanceUidElement = _archiveXml.CreateElement("Uid");
			hsmArchiveElement.AppendChild(studyInstanceUidElement);
			studyInstanceUidElement.InnerText = _storageLocation.StudyInstanceUid;

			// Create the Zip file
			var zipStudyCommand = new CreateStudyZipCommand(_zipFilename, _studyXml, studyFolder, _tempPath)
			{
				ForceCompress = this.ForceCompress
			};
			zipStudyCommand.ProgressUpdated += (s, e) => EventsHelper.Fire(this.ProgressUpdated, this, e);
			AddSubCommand(zipStudyCommand);

			// Update the database.
			AddSubCommand(new InsertArchiveStudyStorageCommand(_storageLocation.GetKey(), _archive.GetKey(), _storageLocation.ServerTransferSyntaxKey, _archiveXml));
		}