OpenHome.Net.Device.Providers.DvProviderUpnpOrgConnectionManager1.DoGetProtocolInfo C# (CSharp) Method

DoGetProtocolInfo() private static method

private static DoGetProtocolInfo ( IntPtr aPtr, IntPtr aInvocation ) : int
aPtr System.IntPtr
aInvocation System.IntPtr
return int
        private static int DoGetProtocolInfo(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target;
            DvInvocation invocation = new DvInvocation(aInvocation);
            string source;
            string sink;
            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.GetProtocolInfo(invocation, out source, out sink);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "GetProtocolInfo");
                return -1;
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetProtocolInfo" }));
                return -1;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetProtocolInfo" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return -1;
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteString("Source", source);
                invocation.WriteString("Sink", sink);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return -1;
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetProtocolInfo" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return 0;
        }