本文整理汇总了C#中CookComputing.XmlRpc.XmlRpcStruct.Add方法的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcStruct.Add方法的具体用法?C# XmlRpcStruct.Add怎么用?C# XmlRpcStruct.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CookComputing.XmlRpc.XmlRpcStruct
的用法示例。
在下文中一共展示了XmlRpcStruct.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
// Datos de conexión
String Url = "http://localhost:8069";
String Dbname = "test_db";
String Login = "admin";
String Password = "admin";
// Login
OpenERPConnect connection = new OpenERPConnect(Url, Dbname, Login, Password);
connection.Login();
Console.WriteLine(connection.UserId);
Object[] domain = new Object[3]; // Albaranes de salida ya asignados y sin incidencias
domain[0] = new Object[3] {"picking_type_id.code", "=", "outgoing"};
domain[1] = new Object[3] {"state", "=", "assigned"};
domain[2] = new Object[3] {"with_incidences", "=", false};
long[] picking_ids = connection.Search("stock.picking", domain);
Console.WriteLine("Albaranes encontrados: {0}", picking_ids.Length);
//Los recorremos y les escribimos a todos la misma incidencia
foreach(long picking_id in picking_ids)
{
XmlRpcStruct vals = new XmlRpcStruct();
vals.Add("with_incidences", true); //Lo marcamos como bajo incidencia
connection.Write("stock.picking", new long[] {picking_id}, vals);
//Escribimos el motivo de la incidencia
connection.MessagePost("stock.picking", new long[] {picking_id}, "Stock Incorrecto");
}
Console.ReadLine();
}
示例2: DoubleAdd
public void DoubleAdd()
{
XmlRpcStruct xps = new XmlRpcStruct();
xps.Add("foo", "123456");
xps.Add("foo", "abcdef");
Assert.Fail("Test should throw ArgumentException");
}
示例3: OrderingEnumerator
public void OrderingEnumerator()
{
var xps = new XmlRpcStruct();
xps.Add("1", "a");
xps.Add("3", "c");
xps.Add("2", "b");
IDictionaryEnumerator enumerator = xps.GetEnumerator();
enumerator.MoveNext();
Assert.AreEqual("1", enumerator.Key);
Assert.AreEqual("a", enumerator.Value);
Assert.IsInstanceOfType(typeof(DictionaryEntry), enumerator.Current);
DictionaryEntry de = (DictionaryEntry)enumerator.Current;
Assert.AreEqual("1", de.Key);
Assert.AreEqual("a", de.Value);
enumerator.MoveNext();
Assert.AreEqual("3", enumerator.Key);
Assert.AreEqual("c", enumerator.Value);
Assert.IsInstanceOfType(typeof(DictionaryEntry), enumerator.Current);
de = (DictionaryEntry)enumerator.Current;
Assert.AreEqual("3", de.Key);
Assert.AreEqual("c", de.Value);
enumerator.MoveNext();
Assert.AreEqual("2", enumerator.Key);
Assert.AreEqual("b", enumerator.Value);
Assert.IsInstanceOfType(typeof(DictionaryEntry), enumerator.Current);
de = (DictionaryEntry)enumerator.Current;
Assert.AreEqual("2", de.Key);
Assert.AreEqual("b", de.Value);
}
示例4: GetSubtitleByHash
public Subtitle GetSubtitleByHash(string fileName, string languageCode)
{
Subtitle retValue = new Subtitle();
XmlRpcStruct searchParams = new XmlRpcStruct();
List<SubtitleSearchItem> subtitles = null;
var fileInfo = new FileInfo(fileName);
searchParams.Add(SEARCH_PARAM_LANGUAGE_ID, languageCode);
searchParams.Add(SEARCH_PARAM_MOVIE_HASH, GetMovieHash(fileName));
searchParams.Add(SEARCH_PARAM_MOVIE_SIZE, fileInfo.Length);
XmlRpcStruct response = RpcProxy.SearchSubtitles(AuthToken, new object[1] { new XmlRpcStruct[1] { searchParams } });
if ((string)response[RESPONSE_STATUS_FIELD] == RESPONSE_RESULT_OK)
{
subtitles = SearchReponse2List(response);
}
//Take one with best rating
if (subtitles.Count > 0)
{
var subtitle = subtitles.OrderByDescending(item => item.SubRating).FirstOrDefault();
var subtitleStream = DownloadSubtitles(subtitle.IDSubtitleFile);
retValue = new Subtitle(subtitleStream, subtitle.SubFormat);
}
return retValue;
}
示例5: RunKeyword
public XmlRpcStruct RunKeyword(string keywordName, string[] arguments)
{
var result = new XmlRpcStruct();
Keyword keyword;
if(!keywordManager.TryGetKeyword(keywordName, out keyword))
{
throw new XmlRpcFaultException(1, string.Format("Keyword \"{0}\" not found", keywordName));
}
try
{
var keywordResult = keyword.Execute(arguments);
if(keywordResult != null)
{
result.Add(KeywordResultValue, keywordResult.ToString());
}
result.Add(KeywordResultStatus, KeywordResultPass);
}
catch(Exception e)
{
result.Clear();
result.Add(KeywordResultStatus, KeywordResultFail);
result.Add(KeywordResultError, BuildRecursiveErrorMessage(e));
result.Add(KeywordResultTraceback, e.StackTrace);
}
return result;
}
示例6: run_keyword
/// <summary>
/// Run specified Robot Framework keyword from remote server.
/// </summary>
public XmlRpcStruct run_keyword(string keyword, object[] args)
{
log.Debug(String.Format("XmlRpc Method call - run_keyword {0}",keyword));
XmlRpcStruct kr = new XmlRpcStruct();
//check for stop remote server
if (String.Equals(keyword,CStopRemoteServer,StringComparison.CurrentCultureIgnoreCase))
{
//start background thread to raise event
Thread stopthread = new Thread(delayed_stop_remote_server);
stopthread.IsBackground = true;
stopthread.Start();
log.Debug("Stop remote server thread started");
//return success
kr.Add("return",String.Empty);
kr.Add("status","PASS");
kr.Add("error",String.Empty);
kr.Add("traceback",String.Empty);
kr.Add("output",String.Empty);
}
else
{
try
{
var result = _map.ExecuteKeyword(keyword,args);
log.Debug(result.ToString());
kr = XmlRpcResultBuilder.ToXmlRpcResult(result);
}
catch (Exception e)
{
log.Error(String.Format("Exception in method - run_keyword : {0}",e.Message));
throw new XmlRpcFaultException(1,e.Message);
}
}
return kr;
}
示例7: toStruct
public XmlRpcStruct toStruct()
{
XmlRpcStruct exchange = new XmlRpcStruct();
exchange.Add("SYMBOl", symbol);
exchange.Add("NAME", name);
exchange.Add("LOCATION", location);
return exchange;
}
示例8: toStruct
public XmlRpcStruct toStruct()
{
XmlRpcStruct security = new XmlRpcStruct();
security.Add("ISIN", isin);
security.Add("SYMBOL", symbol);
security.Add("NAME", name);
security.Add("EXCHANGE", exchange.Name);
return security;
}
示例9: CreateSearchStructure
private XmlRpcStruct CreateSearchStructure(List<string> languages, string hashString, long videoSize)
{
var searchStructure = new XmlRpcStruct();
var preferredLanguages = this.GetSubtitleString(languages);
searchStructure.Add("sublanguageid", preferredLanguages);
searchStructure.Add("moviehash", hashString);
searchStructure.Add("moviebytesize", videoSize.ToString());
searchStructure.Add("imdbid", "");
return searchStructure;
}
示例10: toStruct
public XmlRpcStruct toStruct()
{
XmlRpcStruct pointsTransaction = new XmlRpcStruct();
pointsTransaction.Add("USER", userId);
pointsTransaction.Add("TIMESTAMP", timestamp);
pointsTransaction.Add("TYPE", type.ToString());
pointsTransaction.Add("DELTA", delta);
pointsTransaction.Add("COMMENTS", comments);
return pointsTransaction;
}
示例11: ToXmlRpcResult
/// <summary>
/// Converts keyword result to RF XmlRpc Structure
/// </summary>
public static XmlRpcStruct ToXmlRpcResult(KeywordResult kwresult)
{
var result = new XmlRpcStruct();
//add status
result.Add("status",kwresult.status.ToString());
//add error, traceback, output
result.Add("error",kwresult.error);
result.Add("traceback",kwresult.traceback);
result.Add("output",kwresult.output);
//add return
if ([email protected]().Equals(typeof(System.Int64)))
{
//64bit int has to be returned as string
result.Add("return",[email protected]());
}
else
{
result.Add("return",[email protected]);
}
//check error type
if (kwresult.status==KeywordStatus.FAIL)
{
if (kwresult.errortype==KeywordErrorTypes.Continuable)
{
//continuable error
result.Add("continuable",true);
}
if (kwresult.errortype==KeywordErrorTypes.Fatal)
{
//fatal error
result.Add("fatal",true);
}
}
return result;
}
示例12: DeletePost_ExistingEntry
public void DeletePost_ExistingEntry()
{
// Create entry
var entryContent = new XmlRpcStruct();
entryContent.Add("title", "the title");
entryContent.Add("description", "the description");
var newId = m_api.newPost(m_blog1.ID.ToString(), m_userAuthor.Name, PASSWORD, entryContent, false);
Assert.IsNotNullOrEmpty(newId);
// Delete the entry
var result = m_api.deletePost("test", newId, m_userAuthor.Name, PASSWORD, false);
Assert.IsTrue(result);
}
示例13: CreateTicket
public void CreateTicket(TicketInfo ticket)
{
if (string.IsNullOrEmpty(ticket.Summary)) throw new ArgumentNullException("ticket.Summary");
if (string.IsNullOrEmpty(ticket.Description)) throw new ArgumentNullException("ticket.Description");
if (string.IsNullOrEmpty(ticket.Type)) throw new ArgumentNullException("ticket.Type");
if (string.IsNullOrEmpty(ticket.Priority)) throw new ArgumentNullException("ticket.Priority");
if (string.IsNullOrEmpty(ticket.Component)) throw new ArgumentNullException("ticket.Component");
XmlRpcStruct tempAttributes = new XmlRpcStruct();
foreach (object key in ticket.Attributes.Keys)
{
if ((((string)key) != TicketAttributes.Description) && (((string)key) != TicketAttributes.Summary))
{
tempAttributes.Add(key, ticket.Attributes[key]);
}
}
int id = _ticket.Create(ticket.Summary, ticket.Description, ticket.Attributes);
ticket.TicketId = id;
}
示例14: dictionaryToXmlRpcStruct
public static XmlRpcStruct dictionaryToXmlRpcStruct(IDictionary<string, object> idic)
{
XmlRpcStruct s = new XmlRpcStruct();
foreach (string key in idic.Keys) {
s.Add(key, idic[key]);
}
return s;
}
示例15: admin_restore_oar
public static bool admin_restore_oar(string password, string nomeRegiao, string oarfile)
{
XmlRpcStruct saveAccept = new XmlRpcStruct();
XmlRpcStruct saveParms = new XmlRpcStruct();
saveParms.Add("password", password);
saveParms.Add("region_name", nomeRegiao);
saveParms.Add("filename", oarfile);
RemoteOpensim admin = XmlRpcProxyGen.Create<RemoteOpensim>();
try
{
saveAccept = admin.admin_load_oar(saveParms);
}
catch
{
return false;
}
return true;
}