45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using Microsoft.VisualBasic;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace wakka
|
|
{
|
|
public class BinkPost
|
|
{
|
|
[JsonPropertyName("user")]
|
|
public string? User { get; set; }
|
|
[JsonPropertyName("body")]
|
|
public string? Body { get; set; }
|
|
[JsonPropertyName("time")]
|
|
public long Time { get; set; }
|
|
public string TimeString { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class Bink
|
|
{
|
|
private static SshConnection Ssh { get; set; } = new SshConnection();
|
|
|
|
public string RunBinkCommand(string command)
|
|
{
|
|
return Ssh.RunCommand($"town bink --{command}");
|
|
}
|
|
|
|
public List<BinkPost>? AllBinks()
|
|
{
|
|
return JsonSerializer.Deserialize<List<BinkPost>>(RunBinkCommand("dump"));
|
|
}
|
|
|
|
public List<BinkPost>? BinksBefore(long TimeStamp)
|
|
{
|
|
return JsonSerializer.Deserialize<List<BinkPost>>(RunBinkCommand("dump-before"));
|
|
}
|
|
|
|
public List<BinkPost>? BinksAfter(long TimeStamp)
|
|
{
|
|
return JsonSerializer.Deserialize<List<BinkPost>>(RunBinkCommand("dump-after"));
|
|
}
|
|
}
|
|
}
|