Esempio n. 1
0
        public void Stop()
        {
            float      processedFilesValueInFloat = 0.0F;
            RedisValue processedFilesSizeValue    = keyValueCache.StringGet("Enqueue-Producer");

            if (processedFilesSizeValue.HasValue)
            {
                processedFilesValueInFloat = Convert.ToSingle(processedFilesSizeValue);
            }
            else
            {
                processedFilesValueInFloat = 0.0F;
            }
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("The % data migrated is {0} %", ((processedFilesValueInFloat / (1024 * 1024)) / (RecursiveFileProcessor.CalculateFolderSize(_path, _shutdownEvent, _pauseEvent) / (1024 * 1024))) * 100);
            Console.WriteLine("Application, now stopping.");
            Console.ResetColor();

            // Signal the shutdown event
            _shutdownEvent.Set();

            // Make sure to resume any paused threads
            _pauseEvent.Set();

            // Wait for the thread to exit
            _thread.Join();
        }
Esempio n. 2
0
        public void Pause()
        {
            float      processedFilesValueInFloat = 0.0F;
            RedisValue processedFilesSizeValue    = keyValueCache.StringGet("Enqueue-Producer");

            if (processedFilesSizeValue.HasValue)
            {
                processedFilesValueInFloat = Convert.ToSingle(processedFilesSizeValue);
            }
            else
            {
                processedFilesValueInFloat = 0.0F;
            }
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("The % data migrated is {0} %", ((processedFilesValueInFloat / (1024 * 1024)) / (RecursiveFileProcessor.CalculateFolderSize(_path, _shutdownEvent, _pauseEvent) / (1024 * 1024))) * 100);
            Console.WriteLine("Application, now paused.");
            Console.ResetColor();

            _pauseEvent.Reset();
        }