当前位置: 首页>>代码示例>>C#>>正文


C# XmlRpc.XmlRpcStruct类代码示例

本文整理汇总了C#中CookComputing.XmlRpc.XmlRpcStruct的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcStruct类的具体用法?C# XmlRpcStruct怎么用?C# XmlRpcStruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlRpcStruct类属于CookComputing.XmlRpc命名空间,在下文中一共展示了XmlRpcStruct类的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();
        }
开发者ID:gitlabuser,项目名称:CMNT_004_15,代码行数:33,代码来源:Main.cs

示例2: DoubleSet

 public void DoubleSet()
 {
     XmlRpcStruct xps = new XmlRpcStruct();
       xps["foo"] = "12345";
       xps["foo"] = "abcdef";
       Assert.AreEqual("abcdef", xps["foo"]);
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:7,代码来源:XmlRpcStructTest.cs

示例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);
 }
开发者ID:sgh1986915,项目名称:vfos-scraper-c-,代码行数:29,代码来源:XmlRpcStructTest.cs

示例4: Retrieve

        public object Retrieve(string serviceName, XmlRpcStruct args)
        {
            Console.WriteLine("Service \"{0}\"", serviceName);
            ProvidersManager providers = new ProvidersManager();
            Extractable service = null;
            try {
                service = providers.FindService(serviceName);
            }
            catch (InvalidNameException) {
                string msg = "The name of the service should be in the format NameSpace.ServiceName";
                throw new XmlRpcFaultException(32602, msg);
            }
            catch (ServiceNotFoundException) {
                string msg = String.Format("The service \"{0}\" does not exist on this server.", serviceName);
                throw new XmlRpcFaultException(32602, msg);
            }

            Console.WriteLine("Arguments (as strings):");
            StringDict arguments = new StringDict();
            foreach (DictionaryEntry keyval in args) {
                arguments.Add((string)keyval.Key, keyval.Value.ToString());
                Console.WriteLine("{0}=>{1}", keyval.Key, keyval.Value);
            }

            service.Extract(arguments);

            Console.WriteLine("Result: {0}", service.ToString());
            return service;
        }
开发者ID:nerochiaro,项目名称:webcontent-cs,代码行数:29,代码来源:XMLRPC.cs

示例5: DoubleAdd

 public void DoubleAdd()
 {
     XmlRpcStruct xps = new XmlRpcStruct();
       xps.Add("foo", "123456");
       xps.Add("foo", "abcdef");
       Assert.Fail("Test should throw ArgumentException");
 }
开发者ID:molotovbliss,项目名称:csharlibformagexmlrpcapi,代码行数:7,代码来源:XmlRpcStructTest.cs

示例6: Table

        public Table(XmlRpcStruct rpcStruct)
        {
            HeaderRow = new List<string>();
            DataRows = new List<DataRow>();

            foreach (string key in rpcStruct.Keys)
            {
                if (key.StartsWith("Name"))
                    Name = rpcStruct[key] as string;

                else if(!key.StartsWith("Type"))
                {
                    if (HeaderRow.Count == 0)
                        foreach (string s in (rpcStruct[key] as XmlRpcStruct).Keys)
                            AddColumn(s);

                    DataRows.Add(new DataRow(HeaderRow.Count));

                    var dataStruct = rpcStruct[key] as XmlRpcStruct;

                    foreach (string s in dataStruct.Keys)
                    {
                        var row = 0;

                        Int32.TryParse(key, out row);

                        SetCellValue(s, row, dataStruct[s] as string);
                    }
                }
            }
        }
开发者ID:ihenehan,项目名称:Behavior,代码行数:31,代码来源:Table.cs

示例7: 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;
        }
开发者ID:rte-se,项目名称:emul8,代码行数:30,代码来源:XmlRpcServer.cs

示例8: 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;
        }
开发者ID:VladimirZD,项目名称:SubtitlesMule,代码行数:25,代码来源:OpenSubtitlesClient.cs

示例9: 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;
		}
开发者ID:gitter-badger,项目名称:nrobotremote,代码行数:38,代码来源:XmlRpcService.cs

示例10: 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;
 }
开发者ID:gitter-badger,项目名称:nrobotremote,代码行数:38,代码来源:XmlRpcResultBuilder.cs

示例11: 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;
        }
开发者ID:1508,项目名称:upac-for-umbraco,代码行数:30,代码来源:TicketManager.cs

示例12: Exchange

        public Exchange(XmlRpcStruct exchange)
        {
            IDataAccess data = DataAccessFactory.GetDataAccess();

            this.symbol = (string)exchange["SYMBOL"];
            this.name = (string)exchange["NAME"];
            this.location = (string)exchange["LOCATION"];
        }
开发者ID:maleadt,项目名称:stockplay,代码行数:8,代码来源:Exchange.cs

示例13: Result

 public Result(XmlRpcStruct xmlRpcStruct)
 {
     status = (string)xmlRpcStruct["status"];
     retrn = (string)xmlRpcStruct["retrn"];
     xml = (string)xmlRpcStruct["xml"];
     error = (string)xmlRpcStruct["error"];
     traceback = (string)xmlRpcStruct["traceback"];
 }
开发者ID:ihenehan,项目名称:Behavior,代码行数:8,代码来源:Result.cs

示例14: Security

 public Security(XmlRpcStruct security, XmlRpcStruct quote)
     : this(security)
 {
     if (quote == null)
         this.latestQuote = null;
     else
         this.latestQuote = new Quote(quote);
 }
开发者ID:maleadt,项目名称:stockplay,代码行数:8,代码来源:Security.cs

示例15: GetSubLanguagesOutput

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="output">The output from the server.</param>
        public GetSubLanguagesOutput( XmlRpcStruct output ) : base( output )
        {
            XmlRpcStruct[ ] data = output.GetXmlRpcStructArray( "data" );
            Languages = new SubtitleLanguage[ data.Length ];

            for ( int Index = 0; Index < data.Length; Index++ )
                Languages[ Index ] = new SubtitleLanguage( data[ Index ] );
        }
开发者ID:Wolf-Code,项目名称:Videre,代码行数:12,代码来源:GetSubLanguagesOutput.cs


注:本文中的CookComputing.XmlRpc.XmlRpcStruct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。