Example #1
0
        byte[] WaitRead(UInt32 address, UInt32 size)
        {
            SetStatus(Resources.WaitingForDevice);
            int errorCount = 0;

            while (true)
            {
                try
                {
                    if ((errorCount > 0) && (errorCount % 5) == 0)
                    {
                        fel.Close();
                        Thread.Sleep(1000);
                        fel.Open(vid, pid);
                    }
                    fel.ClearInputBuffer();
                    fel.VerifyDevice();
                    var data = fel.ReadMemory(address, size);
                    return(data);
                }
                catch (Exception ex)
                {
                    errorCount++;
                    if (errorCount >= 15)
                    {
                        throw ex;
                    }
                    Thread.Sleep(1000);
                }
            }
        }