Esempio n. 1
0
        //返回值的是CommandCallResult的指针
        public IntPtr OnCommandCall(ref PlistPackageArgs args)
        {
            CommandCallResult rs = default(CommandCallResult);

            rs.FreeCommandCallResult = FreeCommandCallResult;
            rs.type = ResultType.RESULT_TEXT;//告诉SiriProxy,返回的是文本,不带任何plist xml标记的文本
            string text = null;

            if (CommandCallEvent != null)
            {
                EventArgs <CommandCallArgs> arg = new EventArgs <CommandCallArgs>((CommandCallArgs)args);
                CommandCallEvent(this, arg);
                if (!string.IsNullOrEmpty(arg.Data.ResultText))
                {
                    text = arg.Data.ResultText;
                }
                rs.type = arg.Data.Type;
            }
            if (null == text)
            {
                text = StringHelper.PtrToStringAnsi(args.responseText);//Marshal.PtrToStringAnsi(args.responseText);
            }
            rs.result_text = Marshal.StringToHGlobalAnsi(text);

            IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(rs));

            Marshal.StructureToPtr(rs, p, true);
            return(p);
        }
Esempio n. 2
0
 //返回值的是CommandCallResult的指针
 public static IntPtr OnCommandCall(ref PlistPackageArgs args)
 {
     CommandCallResult rs = default(CommandCallResult);
     rs.FreeCommandCallResult = FreeCommandCallResult;
     rs.type = ResultType.RESULT_TEXT;//告诉SiriProxy,返回的是文本,不带任何plist xml标记的文本
     string text = "caught the command text:";
     text += args.sendText;
     rs.result_text = Marshal.StringToHGlobalAnsi(text);
     IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(rs));
     Marshal.StructureToPtr(rs, p, true);
     return p;
 }
Esempio n. 3
0
        //返回值的是CommandCallResult的指针
        public IntPtr OnCommandCall(ref PlistPackageArgs args)
        {
            CommandCallResult rs = default(CommandCallResult);
            rs.FreeCommandCallResult = FreeCommandCallResult;
            rs.type = ResultType.RESULT_TEXT;//告诉SiriProxy,返回的是文本,不带任何plist xml标记的文本
            string text = null;
            if (CommandCallEvent != null)
            {
                EventArgs<CommandCallArgs> arg = new EventArgs<CommandCallArgs>((CommandCallArgs)args);
                CommandCallEvent(this, arg);
                if (!string.IsNullOrEmpty(arg.Data.ResultText))
                {
                    text = arg.Data.ResultText;
                }
                rs.type = arg.Data.Type;
            }
            if (null == text)
            {
                text = StringHelper.PtrToStringAnsi(args.responseText);//Marshal.PtrToStringAnsi(args.responseText);
            }
            rs.result_text = Marshal.StringToHGlobalAnsi(text);

            IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(rs));
            Marshal.StructureToPtr(rs, p, true);
            return p;
        }