本文整理汇总了C#中ClearCanvas.Dicom.Utilities.Command.CommandProcessor.ExecuteSubCommand方法的典型用法代码示例。如果您正苦于以下问题:C# CommandProcessor.ExecuteSubCommand方法的具体用法?C# CommandProcessor.ExecuteSubCommand怎么用?C# CommandProcessor.ExecuteSubCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClearCanvas.Dicom.Utilities.Command.CommandProcessor
的用法示例。
在下文中一共展示了CommandProcessor.ExecuteSubCommand方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExecute
protected override void OnExecute(CommandProcessor theProcessor)
{
StudyXml currentXml = LoadStudyXml();
_newXml = new StudyXml(_studyInstanceUid);
foreach (SeriesXml series in currentXml)
{
string seriesPath = Path.Combine(_rootPath, series.SeriesInstanceUid);
if (!Directory.Exists(seriesPath))
{
Platform.Log(LogLevel.Info, "RebuildXML: series folder {0} is missing", seriesPath);
continue;
}
foreach (InstanceXml instance in series)
{
string instancePath = Path.Combine(seriesPath, instance.SopInstanceUid + ServerPlatform.DicomFileExtension);
if (!File.Exists(instancePath))
{
Platform.Log(LogLevel.Info, "RebuildXML: file {0} is missing", instancePath);
}
else
{
if (!theProcessor.ExecuteSubCommand(this, new InsertInstanceXmlCommand(_newXml, instancePath)))
throw new ApplicationException(theProcessor.FailureReason);
}
}
}
if (!theProcessor.ExecuteSubCommand(this, new SaveXmlCommand(_newXml, _rootPath, _studyInstanceUid)))
throw new ApplicationException(theProcessor.FailureReason);
}
示例2: OnExecute
protected override void OnExecute(CommandProcessor theProcessor)
{
while (_subCommands.Count > 0)
{
if (!theProcessor.ExecuteSubCommand(this, _subCommands.Dequeue()))
throw new ApplicationException(theProcessor.FailureReason);
}
}
示例3: OnExecute
protected override void OnExecute(CommandProcessor commandProcessor)
{
_instanceXml = _studyXml.FindInstanceXml(_seriesInstanceUid, _sopInstanceUid);
_studyXml.RemoveInstance(_seriesInstanceUid, _sopInstanceUid);
// flush it into disk
// Write it back out. We flush it out with every added image so that if a failure happens,
// we can recover properly.
if (!commandProcessor.ExecuteSubCommand(this, new SaveXmlCommand(_studyXml, _studyLocation)))
throw new ApplicationException(commandProcessor.FailureReason);
}
示例4: OnExecute
protected override void OnExecute(CommandProcessor theProcessor)
{
if (_path == null)
{
String seriesUid = _file.DataSet[DicomTags.SeriesInstanceUid].GetString(0, String.Empty);
String sopUid = _file.DataSet[DicomTags.SopInstanceUid].GetString(0, String.Empty);
_path = _storageLocation.GetSopInstancePath(seriesUid, sopUid);
}
// Make sure the directory exists where we're storing the file.
var p = Path.GetDirectoryName(_path);
if (string.IsNullOrEmpty(p) || !Directory.Exists(p))
{
if (!theProcessor.ExecuteSubCommand(this, new CreateDirectoryCommand(Path.GetDirectoryName(_path))))
throw new ApplicationException(theProcessor.FailureReason);
}
if (RequiresRollback)
Backup();
string path = GetTempPath();
using (FileStream stream = FileStreamOpener.OpenForSoleUpdate(path, FileMode.Create))
{
// Set _fileCreated here, because the file has been opened.
_saveSpeed.Start();
_file.Save(stream, DicomWriteOptions.Default);
stream.Flush();
stream.Close();
_saveSpeed.End();
var fi = new FileInfo(path);
_saveSpeed.SetData(fi.Length);
}
if (File.Exists(_path))
{
if (_failOnExists)
{
try
{
FileUtils.Delete(path);
}
catch (Exception x)
{
throw new ApplicationException(
String.Format("DICOM File unexpectedly already exists: {0}", _path), x);
}
throw new ApplicationException(String.Format("DICOM File unexpectedly already exists: {0}", _path));
}
}
FileUtils.Copy(path, _path, true);
_fileCreated = true;
FileUtils.Delete(path);
}
示例5: OnExecute
protected override void OnExecute(CommandProcessor theProcessor)
{
// Make sure the directory exists where we're storing the file.
var p = Path.GetDirectoryName(_path);
if (string.IsNullOrEmpty(p) || !Directory.Exists(p))
{
if (!theProcessor.ExecuteSubCommand(this, new CreateDirectoryCommand(Path.GetDirectoryName(_path))))
throw new ApplicationException(theProcessor.FailureReason);
}
if (RequiresRollback)
Backup();
string path = GetTempPath();
using (FileStream stream = FileStreamOpener.OpenForSoleUpdate(path,
_failOnExists
? FileMode.CreateNew
: FileMode.Create))
{
_file.Save(stream, DicomWriteOptions.Default);
stream.Flush();
stream.Close();
}
if (_failOnExists && File.Exists(_path))
{
// Do this test after creating the temp folder in case another thread is receiving the file at the same
// time.
try
{
// Delete the temp file we saved
FileUtils.Delete(path);
}
catch (Exception x)
{
throw new ApplicationException(String.Format("DICOM File unexpectedly already exists: {0}", _path),
x);
}
throw new ApplicationException(String.Format("DICOM File unexpectedly already exists: {0}", _path));
}
FileUtils.Copy(path, _path, true);
_fileCreated = true;
FileUtils.Delete(path);
}
示例6: OnExecute
protected override void OnExecute(CommandProcessor theProcessor)
{
// Make sure the directory exists where we're storing the file.
var p = Path.GetDirectoryName(_path);
if (string.IsNullOrEmpty(p) || !Directory.Exists(p))
{
if (!theProcessor.ExecuteSubCommand(this, new CreateDirectoryCommand(Path.GetDirectoryName(_path))))
throw new ApplicationException(theProcessor.FailureReason);
}
string path = GetTempPath();
var fileMode = _failOnExists ? FileMode.CreateNew : FileMode.Create;
using (var stream = new FileStream(path, fileMode, FileAccess.Write, FileShare.None, 65536, FileOptions.SequentialScan))
{
_file.Save(stream, DicomWriteOptions.Default);
stream.Flush();
stream.Close();
}
if (_failOnExists && File.Exists(_path))
{
// Do check *after* creating the temp file in case another thread received file at the same time (and finished before us!)
try
{
// Delete the temp file we saved
FileUtils.Delete(path);
}
catch (Exception x)
{
throw new ApplicationException(String.Format("DICOM File unexpectedly already exists: {0}", _path), x);
}
throw new ApplicationException(String.Format("DICOM File unexpectedly already exists: {0}", _path));
}
_backupPath = RequiresRollback ? GetBackupPath() : null;
FileUtils.TrySetFileReadOnly(path, false);
FileUtils.TrySetFileReadOnly(_path, false);
FileUtils.TrySetFileReadOnly(_backupPath, false);
FileUtils.Replace(path, _path, _backupPath);
_fileCreated = true;
}