История страницы
...
Блок кода | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
using System;
using System.Collections.Generic;
using Robin.ActionSDK;
using Robin.Engine.Services.Interfaces;
using Robin.Types;
namespace Robin.SdkExamples
{
public class OpenFile : BaseRobinAction
{
private readonly IDisposeService _disposeService;
public OpenFile(IActionLogger logger, IDisposeService disposeService) : base(logger)
{
_disposeService = disposeService;
}
public override IDictionary<string, object> Execute(IDictionary<string, object> parameters)
{
var filePath = ((RobinFilePath)parameters["filePath"]).Value;
var file = new File(filePath);
file.Open();
_disposeService.RegisterResource(file);
return new Dictionary<string, object> { { "file", file } };
}
}
internal class File : IDisposable
{
private readonly string _filePath;
private bool _isDisposed;
public File(string filePath)
{
_filePath = filePath;
}
public void Open() { }
public bool TryReadNextLine(out string line) { }
public void Close() { }
public void Dispose()
{
if (_isDisposed) return;
Close();
_isDisposed = true;
}
}
} |
ResourceService
ArtifactsFolderService
...
Обзор
Инструменты контента