15 lines
958 B
C#
15 lines
958 B
C#
using PlotDirector.Companion.Protocol;
|
|
namespace PlotDirector.Companion.Client;
|
|
|
|
public static class ConnectionPresentation
|
|
{
|
|
public static string Describe(string ipc,ConnectionHealth? health,int book,string workspace)
|
|
{
|
|
if(ipc!="connected")return "Word loaded · Local agent/IPC: "+ipc+" · Server/authentication: unverified";
|
|
if(health==null)return "Word loaded · Agent/IPC connected · Server/authentication: checking";
|
|
var server=health.VerifiedUtc==default||DateTime.UtcNow-health.VerifiedUtc>TimeSpan.FromSeconds(90)?(health.Server=="offline"?"offline":"unverified"):health.Server;
|
|
var authentication=server!="online"&&health.Authentication=="verified"?"cached grant; check connection":health.Authentication;
|
|
return "Agent/IPC connected · Server: "+server+" · Sign-in: "+authentication+" · Book: "+(book<=0?"not selected":server=="online"?workspace:"cached/unverified")+" · AI: "+health.Ai;
|
|
}
|
|
}
|