Ejemplo n.º 1
0
        } /* ReBootBattery */

        private void  Preview()
        {
            sipperBuff.PerformStatusCommandAndUpdateSipperDiskStats();

            if (blocksToRead < 1)
            {
                blocksToRead = 100;
            }

            long startBlockAddr = sipperBuff.StartBlockAddr();
            long curBlockAddr   = Math.Max(sipperBuff.CurBlockAddr(), startBlockAddr);
            long endBlockAddr   = sipperBuff.EndBlockAddr();

            //checking hex values to decimal ones to be used
            previewBlock = curBlockAddr - blocksToRead; //starting block to read from

            //making sure starting block is legit
            if (previewBlock <= startBlockAddr)
            {
                try { blocksToRead = (int)(curBlockAddr - startBlockAddr); }
                catch (Exception)
                { blocksToRead = 100; }

                previewBlock = curBlockAddr - blocksToRead;
            }

            if (blocksToRead <= 0)
            {
                lock (logFile)
                {
                    logFile.WriteLine("//");
                    logFile.WriteLine("// As per status command there is no data to preview.");
                    logFile.WriteLine("//");
                    logFile.Flush();
                }
                result     = "Error! There is no data to be previewed.  Please record for longer.";
                executedOk = false;
                return;
            }

            previewData = sipperBuff.ReadHardDrive(previewBlock, blocksToRead);
            if (previewData == null)
            {
                result     = "Error reading hard drive.";
                executedOk = false;
                return;
            }

            executedOk = true;
        } /* Preview */