mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-04 04:18:22 +00:00
Layout
This commit is contained in:
49
Libraries/Esiur/Core/InvocationContext.cs
Normal file
49
Libraries/Esiur/Core/InvocationContext.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Esiur.Protocol;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Esiur.Core
|
||||
{
|
||||
public class InvocationContext
|
||||
{
|
||||
private uint CallbackId;
|
||||
|
||||
internal bool Ended;
|
||||
|
||||
public void Chunk(object value)
|
||||
{
|
||||
if (Ended)
|
||||
throw new Exception("Execution has ended.");
|
||||
|
||||
Connection.SendChunk(CallbackId, value);
|
||||
}
|
||||
|
||||
public void Progress(uint value, uint max) {
|
||||
|
||||
if (Ended)
|
||||
throw new Exception("Execution has ended.");
|
||||
|
||||
Connection.SendProgress(CallbackId, value, max);
|
||||
}
|
||||
|
||||
public void Warning(byte level, string message)
|
||||
{
|
||||
|
||||
if (Ended)
|
||||
throw new Exception("Execution has ended.");
|
||||
|
||||
Connection.SendWarning(CallbackId, level, message);
|
||||
}
|
||||
|
||||
public EpConnection Connection { get; internal set; }
|
||||
|
||||
|
||||
internal InvocationContext(EpConnection connection, uint callbackId)
|
||||
{
|
||||
Connection = connection;
|
||||
CallbackId = callbackId;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user