예제 #1
0
        private static Udbus.v4v.v4vConnection TryV4VConnection(Udbus.Serialization.UdbusDelegates.D_io_debug io_debug, Udbus.Core.Logging.ILog log)
        {
            Udbus.v4v.v4vConnection result = null;

            try
            {
                Udbus.v4v.v4vConnection create = new Udbus.v4v.v4vConnection(io_debug);
                result = create;
            }
            catch (Udbus.Serialization.Exceptions.TransportFailureException transportEx)
            {
                log.Exception("Failed to create V4V transport. {0}", transportEx);
            }
            catch (Exception ex)
            {
                log.Exception("Error creating V4V transport. {0}", ex);
            }

            return result;
        }
        private static bool SetRegistryValue(Microsoft.Win32.RegistryKey key, string name, string value, Udbus.Core.Logging.ILog log)
        {
            bool result = false;

            try
            {
                key.SetValue(name, value);
                result = true;
            }
            catch (System.ArgumentNullException argnullEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (argument null) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, argnullEx);
                }
            }
            catch (System.ArgumentException argEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (argument exception) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, argEx);
                }
            }
            catch (System.ObjectDisposedException objdispEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (object disposed) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, objdispEx);
                }
            }
            catch (System.UnauthorizedAccessException unauthEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (unauthorised) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, unauthEx);
                }
            }
            catch (System.Security.SecurityException secEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (security exception) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, secEx);
                }
            }
            catch (System.IO.IOException ioEx)
            {
                if (log != null)
                {
                    log.Exception("Failed to set registry key (io exception) \"{0}\\{1}\" to \"{2}\". {3}", key.Name, name, value, ioEx);
                }
            }

            return result;
        }
예제 #3
0
        private static Udbus.Core.ServiceConnectionParams TryServiceConnectionParams(Udbus.v4v.v4vConnection connection, Udbus.Core.Logging.ILog log)
        {
            Udbus.Core.ServiceConnectionParams result = null;

            try
            {
                Udbus.Core.ServiceConnectionParams create = new Udbus.Core.ServiceConnectionParams(connection);
                result = create;
            }
            catch (Udbus.Serialization.Exceptions.UdbusAuthorisationException authex)
            {
                log.Exception("Authorisation Error creating ServiceConnectionParams. {0}", authex);
            }
            catch (Exception ex)
            {
                log.Exception("Error creating ServiceConnectionParams. {0}", ex);
            }
            return result;
        }