本文整理汇总了C#中IByteSource.GetBufferAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IByteSource.GetBufferAsync方法的具体用法?C# IByteSource.GetBufferAsync怎么用?C# IByteSource.GetBufferAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IByteSource
的用法示例。
在下文中一共展示了IByteSource.GetBufferAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseFragmentSequenceValueAsync
private async Task<bool> ParseFragmentSequenceValueAsync(IByteSource source)
{
if (this.parseStage == ParseStage.Value)
{
if (!source.Require(this.length))
{
this.result = DicomReaderResult.Suspended;
return false;
}
var buffer = await source.GetBufferAsync(this.length).ConfigureAwait(false);
buffer = EndianByteBuffer.Create(buffer, source.Endian, this.fragmentItem == 1 ? 4 : this._vr.UnitSize);
this.observer.OnFragmentSequenceItem(source, buffer);
this.parseStage = ParseStage.Tag;
}
return true;
}
示例2: ParseValueAsync
//.........这里部分代码省略.........
if (!IsPrivateSequence(source))
{
this._vr = DicomVR.UN;
break;
}
if (IsPrivateSequenceBad(source, this.isExplicitVR))
{
this.badPrivateSequence = true;
this.isExplicitVR = !this.isExplicitVR;
}
break;
}
if (this._vr == DicomVR.SQ)
{
// start of sequence
this.observer.OnBeginSequence(source, this._tag, this.length);
this.parseStage = ParseStage.Tag;
if (this.length != UndefinedLength)
{
this._implicit = false;
source.PushMilestone(this.length);
}
else
{
this._implicit = true;
}
var last = source.Position;
// Conformance with CP-246 (#177)
var needtoChangeEndian = false;
if (parsedVR == DicomVR.UN && !this._tag.IsPrivate)
{
this._implicit = true;
needtoChangeEndian = source.Endian == Endian.Big;
}
if (needtoChangeEndian)
{
source.Endian = Endian.Little;
}
await this.ParseItemSequenceAsync(source).ConfigureAwait(false);
if (needtoChangeEndian)
{
source.Endian = Endian.Big;
}
// Aeric Sylvan - https://github.com/rcd/fo-dicom/issues/62#issuecomment-46248073
// Fix reading of SQ with parsed VR of UN
if (source.Position > last || this.length == 0)
{
return true;
}
this.parseStage = ParseStage.Value;
this._vr = parsedVR;
}
if (this.length == UndefinedLength)
{
this.observer.OnBeginFragmentSequence(source, this._tag, this._vr);
this.parseStage = ParseStage.Tag;
await this.ParseFragmentSequenceAsync(source).ConfigureAwait(false);
return true;
}
if (!source.Require(this.length))
{
this.result = DicomReaderResult.Suspended;
return false;
}
var buffer = await source.GetBufferAsync(this.length).ConfigureAwait(false);
if (!this._vr.IsString)
{
buffer = EndianByteBuffer.Create(buffer, source.Endian, this._vr.UnitSize);
}
this.observer.OnElement(source, this._tag, this._vr, buffer);
// parse private creator value and add to lookup table
if (this._tag.IsPrivate && this._tag.Element != 0x0000 && this._tag.Element <= 0x00ff)
{
var creator =
DicomEncoding.Default.GetString(buffer.Data, 0, buffer.Data.Length)
.TrimEnd((char)DicomVR.LO.PaddingValue);
var card = (uint)(this._tag.Group << 16) + this._tag.Element;
lock (this.locker)
{
this._private[card] = creator;
}
}
this.ResetState();
}
return true;
}