This commit is contained in:
Nitload
2025-08-25 09:50:30 +08:00
parent bd0e31e922
commit 1359ff4ecc
1630 changed files with 738486 additions and 2399 deletions
@@ -38,44 +38,44 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
namespace StgSharp.Modeling.Step
{
public class StepDataSectionTransmitter : IScriptSourceProvider
{
private const string EndDataText = "ENDSEC;";
//private bool _isEmpty;
private bool _isEmpty;
private ConcurrentQueue<string> _cache = new ConcurrentQueue<string>();
private int _line = 0;
public StepDataSectionTransmitter() { }
public StepDataSectionTransmitter( int begins )
{
Begin = begins;
_line = Begin;
}
public bool IsEmpty => _cache.IsEmpty && !IsWriting;
public bool IsEmpty => _isEmpty;
public bool IsWriting { get; private set; } = true;
public int Begin { get; internal set; }
public int Location => _line;
public void EndWriting()
{
_cache.Enqueue( EndDataText );
IsWriting = false;
}
public string ReadLine()
{
if( _cache.TryDequeue( out string? line ) )
_cache.TryDequeue( out string? line );
while( !IsEmpty )
{
_line++;
return line;
if( _cache.TryDequeue( out line ) )
{
if( line == EndDataText )
{
_isEmpty = true;
return string.Empty;
}
_line++;
return line;
}
}
return string.Empty;
}
@@ -89,17 +89,10 @@ namespace StgSharp.Model.Step
public void WriteLine( string line )
{
if( line == "DATA;" ) {
return;
}
if( line == EndDataText )
{
if( line == EndDataText ) {
EndWriting();
return;
}
if( IsWriting ) {
_cache.Enqueue( line );
}
_cache.Enqueue( line );
}
IScriptSourceProvider IScriptSourceProvider.Slice( int location, int count )