Example #1
0
        public override void Clear(ExecutionResult executionResult)
        {
            paths.HashFile.SoftDelete("hashfile");

            if (!executionResult.IsSuccessful)
            {
                paths.OutputFile.SoftDelete("outfile");
                paths.PotFile.SoftDelete("potfile");
                return;
            }

            var err = executionResult.Errors.FirstOrDefault(e => e.Contains("No hashes loaded") || e.Contains("Unhandled Exception"));

            if (err != null)
            {
                ClientProxyProvider.Client.SendJobEnd(new { error = err }, job.JobId).ConfigureAwait(false);
                paths.OutputFile.SoftDelete("outfile");
                paths.PotFile.SoftDelete("potfile");
                return;
            }

            var speed = SpeedCalculator.CalculateFact(executionResult.Output);

            if (File.Exists(paths.OutputFile))
            {
                var outfile = Convert.ToBase64String(File.ReadAllBytes(paths.OutputFile));
                var potfile = Convert.ToBase64String(File.ReadAllBytes(paths.PotFile));

                ClientProxyProvider.Client.SendJobEnd(new { outfile, potfile, speed }, job.JobId).ConfigureAwait(false);
                paths.OutputFile.SoftDelete("outfile");
                paths.PotFile.SoftDelete("potfile");
            }
            else
            {
                Logging.Log.Message("Output file не существует, сорян.");
                ClientProxyProvider.Client.SendJobEnd(new { potfile = string.Empty, speed }, job.JobId).ConfigureAwait(false);
            }
        }