Esempio n. 1
0
        private static int DoDetails(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target;
            DvInvocation invocation           = new DvInvocation(aInvocation);
            uint         duration;
            uint         bitRate;
            uint         bitDepth;
            uint         sampleRate;
            bool         lossless;
            string       codecName;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.Details(invocation, out duration, out bitRate, out bitDepth, out sampleRate, out lossless, out codecName);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "Details");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", "Details"));
                return(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Details", e.TargetSite.Name);
                Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteUint("Duration", duration);
                invocation.WriteUint("BitRate", bitRate);
                invocation.WriteUint("BitDepth", bitDepth);
                invocation.WriteUint("SampleRate", sampleRate);
                invocation.WriteBool("Lossless", lossless);
                invocation.WriteString("CodecName", codecName);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Details", e.TargetSite.Name);
                Console.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
Esempio n. 2
0
        private static int DoCounters(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target;
            DvInvocation invocation           = new DvInvocation(aInvocation);
            uint         trackCount;
            uint         detailsCount;
            uint         metatextCount;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.Counters(invocation, out trackCount, out detailsCount, out metatextCount);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "Counters");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", "Counters"));
                return(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Counters", e.TargetSite.Name);
                Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteUint("TrackCount", trackCount);
                invocation.WriteUint("DetailsCount", detailsCount);
                invocation.WriteUint("MetatextCount", metatextCount);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Counters", e.TargetSite.Name);
                Console.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
Esempio n. 3
0
        private static int DoCounters(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target;
            DvInvocation invocation           = new DvInvocation(aInvocation);
            uint         trackCount;
            uint         detailsCount;
            uint         metatextCount;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.Counters(invocation, out trackCount, out detailsCount, out metatextCount);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "Counters");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Counters" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Counters" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteUint("TrackCount", trackCount);
                invocation.WriteUint("DetailsCount", detailsCount);
                invocation.WriteUint("MetatextCount", metatextCount);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Counters" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }