Example #1
0
        private bool ProbeDevice()
        {
            this.BeginAtomic();
            try
            {
                IntPtr Handle = this.AcquireHandle();

                try
                {
                    // Handle could be acquired. try to read out version string
                    this.FriendlyName = $"{ScpCommands.GetVersionString(Handle)} on COM{this.port}";
                }
                catch
                {
                    //Do nothing in case of error
                    return(false);
                }
                finally
                {
                    this.ReleaseHandle();
                }
            }
            catch
            {
                //Do nothing in case of error
                return(false);
            }
            finally
            {
                this.EndAtomic();
            }
            return(true);
        }