public override Task OnAfterLoad() { var driveInfo = new DriveInfo(_name); CachedData.SetData("DriveName", driveInfo.Name); CachedData.SetData("TotalSpace", driveInfo.TotalSize); CachedData.SetData("SpaceUsed", driveInfo.TotalSize - driveInfo.TotalFreeSpace); return(Task.CompletedTask); }
public override Task <PluginData> OnUpdateDataRequest() { var driveInfo = new DriveInfo(_name); CachedData.SetData("DriveName", driveInfo.Name); CachedData.SetData("TotalSpace", driveInfo.TotalSize); CachedData.SetData("SpaceUsed", driveInfo.TotalSize - driveInfo.TotalFreeSpace); return(Task.FromResult(CachedData)); }
private void PingServer() { string host = PluginSettings.GetData <string>("Host"); int port = PluginSettings.GetData <int>("Port"); if (string.IsNullOrEmpty(host) || port == 0) { CachedData.RemoveKey("ServerStatus"); } else if (Uri.CheckHostName(host) == UriHostNameType.Unknown) { CachedData.RemoveKey("ServerStatus"); } else { CachedData.SetData("ServerStatus", new MinecraftServerHelper().PingServer(host, port)); } }