本文整理汇总了C#中Nwc.XmlRpc.XmlRpcRequest.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcRequest.ToString方法的具体用法?C# XmlRpcRequest.ToString怎么用?C# XmlRpcRequest.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nwc.XmlRpc.XmlRpcRequest
的用法示例。
在下文中一共展示了XmlRpcRequest.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlRpcLoadHeightmapMethod
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Load height maps request started");
try
{
Hashtable requestData = (Hashtable) request.Params[0];
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
// foreach (string k in requestData.Keys)
// {
// m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
// k, (string)requestData[k], ((string)requestData[k]).Length);
// }
CheckStringParameters(request, new string[] {"password", "filename", "regionid"});
if (m_requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword))
throw new Exception("wrong password");
string file = (string) requestData["filename"];
UUID regionID = (UUID) (string) requestData["regionid"];
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
responseData["accepted"] = true;
IScene region = null;
if (!manager.TryGetScene(regionID, out region))
throw new Exception("1: unable to get a scene with that name");
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
if (null == terrainModule) throw new Exception("terrain module not available");
if (Uri.IsWellFormedUriString(file, UriKind.Absolute))
{
m_log.Info("[RADMIN]: Terrain path is URL");
Uri result;
if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result))
{
// the url is valid
string fileType = file.Substring(file.LastIndexOf('/') + 1);
terrainModule.LoadFromStream(fileType, result);
}
}
else
{
terrainModule.LoadFromFile(file, 0, 0);
}
responseData["success"] = false;
response.Value = responseData;
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString());
responseData["success"] = false;
responseData["error"] = e.Message;
}
m_log.Info("[RADMIN]: Load height maps request complete");
return response;
}
示例2: XmlRpcSaveHeightmapMethod
public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Save height maps request started");
try
{
Hashtable requestData = (Hashtable)request.Params[0];
m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
CheckStringParameters(request, new string[] { "password", "filename", "regionid" });
if (m_requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
throw new Exception("wrong password");
string file = (string)requestData["filename"];
UUID regionID = (UUID)(string)requestData["regionid"];
m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
responseData["accepted"] = true;
Scene region = null;
if (!m_application.SceneManager.TryGetScene(regionID, out region))
throw new Exception("1: unable to get a scene with that name");
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
if (null == terrainModule) throw new Exception("terrain module not available");
terrainModule.SaveToFile(file);
responseData["success"] = false;
response.Value = responseData;
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString());
responseData["success"] = false;
responseData["error"] = e.Message;
}
m_log.Info("[RADMIN]: Save height maps request complete");
return response;
}
示例3: Execute
public override object Execute(out Hashtable outputParams)
{
// assign output params
outputParams = null;
Hashtable outputPlaceholder = null;
// create new XmlRpcRequest object
XmlRpcRequest client = new XmlRpcRequest();
// fill in the concrete method name
client.MethodName = Call.Renderer.Voc.GetMethodCmp(Call.MethodName, Call.ObjectName);
// provide the input parameters
Uiml.Param[] parameters = Call.Renderer.Voc.GetMethodParams(Call.ObjectName, Call.MethodName);
Type[] tparamTypes = null;
try
{
tparamTypes = CreateInOutParamTypes(parameters, out outputPlaceholder);
}
catch(ArgumentOutOfRangeException)
{
return null;
}
for (int k = 0; k < parameters.Length; k++)
{
string propValue = (string) ((Uiml.Executing.Param) Call.Params[k]).Value(Call.Renderer);
client.Params.Add(Call.Renderer.Decoder.GetArg(propValue, tparamTypes[k]));
}
if (m_request == null || !client.ToString().Equals(m_request.ToString()))
{
XmlRpcResponse response = client.Send(m_url);
// cache response and request
m_request = client;
m_response = response;
}
if (m_response.IsFault)
{
Console.WriteLine("Fault {0}: {1}", m_response.FaultCode, m_response.FaultString);
return null;
}
else
{
return m_response.Value;
}
}