예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
            }
        }