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


C# Udbus.SetSignature方法代码示例

本文整理汇总了C#中Udbus.SetSignature方法的典型用法代码示例。如果您正苦于以下问题:C# Udbus.SetSignature方法的具体用法?C# Udbus.SetSignature怎么用?C# Udbus.SetSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Udbus的用法示例。


在下文中一共展示了Udbus.SetSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestDbusGetPropertyImpl

        static void TestDbusGetPropertyImpl(Udbus.Serialization.UdbusMessageBuilderTracker builder, Udbus.Core.IUdbusMessageVisitor visitor, Udbus.Serialization.UdbusConnector connector,
            System.Threading.ManualResetEvent stop, PreNextActionDelegate preNextAction)
        {
            preNextAction("GetProperty");
            int result;
            Udbus.Serialization.NMessageStruct.UdbusMessageHandle recv;

            using (var msg = builder.UdbusMethodMessage(
                "com.citrix.xenclient.xenmgr", "/",
                "org.freedesktop.DBus.Properties", "Get").Message)
            {
                Udbus.Types.dbus_sig signature = Udbus.Types.dbus_sig.Initialiser;
                signature.a[0] = Udbus.Types.dbus_type.DBUS_STRING;
                signature.a[1] = Udbus.Types.dbus_type.DBUS_STRING;
                signature.a[2] = Udbus.Types.dbus_type.DBUS_INVALID;
                builder.SetSignature(ref signature)
                    .BodyAdd(4096)
                    .BodyAdd_String("com.citrix.xenclient.xenmgr.config")
                    .BodyAdd_String("iso-path")
                ;
                result = connector.Send(msg);
                Console.WriteLine("GetProperty send result: {0}", result);
                Udbus.Core.UdbusVisitorFunctions.Visit(result, msg, new Udbus.Core.UdbusMessageVisitorDumpConsole());
            }
            try
            {
                Udbus.Core.UdbusMessagePair recvData = Udbus.Core.UdbusVisitorFunctions.LoopUdbusFind(connector, visitor, Console.Out, stop);
                if (!recvData.QuEmpty)
                {
                    recv = recvData.Data;
                    if (recv.typefield.type != Udbus.Types.dbus_msg_type.DBUS_TYPE_ERROR)
                    {
                        Udbus.Serialization.UdbusMessageReader reader = new Udbus.Serialization.UdbusMessageReader(recvData.Handle);
                        do
                        {
            #if !READASVARIANT
                            var variant = reader.ReadVariantValue(out result);
                            Console.WriteLine("iso_path: {0}", variant.ToString());
                            //Udbus.Parsing.BuildContext context = new Udbus.Parsing.BuildContext(new Udbus.Parsing.CodeTypeNoOpHolder());
                            //Udbus.Serialization.Variant.UdbusVariantIn variantIn = new Udbus.Serialization.Variant.UdbusVariantIn(reader);
                            //Udbus.Parsing.IDLArgumentTypeNameBuilderBase nameBuilder = new Udbus.Parsing.IDLArgumentTypeNameBuilderNoOp();
                            //Udbus.Types.dbus_sig sig = Udbus.Types.dbus_sig.Initialiser;
                            //result = reader.ReadSignature(ref sig);
                            //Udbus.Parsing.CodeBuilderHelper.BuildCodeParamType(variantIn, nameBuilder, sig.a, context);
                            //Console.WriteLine("iso_path: {0}", variantIn.Variant.ToString());

            #else // !READASVARIANT
                        Udbus.Types.dbus_sig sig = Udbus.Types.dbus_sig.Initialiser;
                        result = reader.ReadSignature(ref sig);
                        if (result != 0)
                        {
                            Console.WriteLine("Error reading property variant signature: {0}", result);
                            break;
                        }
                        string isopath;
                        result = reader.ReadString(out isopath);
                        if (result != 0)
                        {
                            Console.WriteLine("Error reading property variant string: {0}", result);
                            break;
                        }

                        Console.WriteLine("iso_path: {0}", isopath);
            #endif // READASVARIANT
                        } while (false);
                    }
                }
                else
                {
                    Console.WriteLine("Getting the property failed. Boooooo ");
                }
            }
            catch (System.Runtime.InteropServices.SEHException seh)
            {
                Console.WriteLine("Error: " + seh.ToString());
            }
        }
开发者ID:jean-edouard,项目名称:win-tools,代码行数:77,代码来源:UdbusCSharpConsole.cs


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