just wanted to share a quick C# script for HG that sends the shutdown command to the XBMC api. This way, the device running XBMC will perform a clean shutdown
just fill in the data in the top variables (same data that you'd put into a remote control app for XBMC)
//switch off XBMC
//xbmc settings
string xbmcJsonPath = "http://yourXBMCServer/jsonrpc";
string xbmcUser = "username";
string xbmcPass = "password";
//prepare xbmc request
var request = System.Net.WebRequest.Create(new Uri(xbmcJsonPath));
request.Credentials = new System.Net.NetworkCredential(xbmcUser, xbmcPass);
request.ContentType = "application/json";
request.Method = "POST";
var postStream = request.GetRequestStream();
var jsonRequest = @"{""jsonrpc"": ""2.0"", ""method"": ""System.Shutdown"", ""params"": {}, ""id"": 8}";
byte[] postData = System.Text.Encoding.UTF8.GetBytes(jsonRequest);
// post request
postStream.Write(postData, 0, postData.Length);
postStream.Dispose();
// request result, this is required to execute the lazy method
request.GetResponse();