// Token: 0x06000629 RID: 1577 RVA: 0x000252A7 File Offset: 0x000234A7
 public DiscoveryResultsCompletedEventArgs(OrionDiscoveryJobResult completeResult, SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins, Guid scheduledJobId, JobState jobState, int?profileId)
 {
     this.CompleteResult = completeResult;
     this.OrderedPlugins = orderedPlugins;
     this.ScheduledJobId = scheduledJobId;
     this.JobState       = jobState;
     this.ProfileId      = profileId;
 }
Exemplo n.º 2
0
 private void OnDiscoveryResultsComplete(
     List <PartialDiscoveryResultsContainer.PartialResult> results)
 {
     if (results == null || results.Count == 0)
     {
         PartialDiscoveryResultsContainer._log.WarnFormat("Attempt to report partial discovery results completion with empty results.", Array.Empty <object>());
     }
     else
     {
         OrionDiscoveryJobResult completeResult = this.MergePartialResults(results);
         lock (this._syncRoot)
             this.RemovePartialResults(results[0].MainJobId, (IEnumerable <PartialDiscoveryResultsContainer.PartialResult>)results);
         this.DiscoveryResultsComplete((object)this, new DiscoveryResultsCompletedEventArgs(completeResult, results[0].OrderedPlugins, results[0].MainJobId, results[0].JobState, results[0].ProfileId));
     }
 }
Exemplo n.º 3
0
 public void CreatePartialResult(
     Guid scheduledJobId,
     OrionDiscoveryJobResult result,
     SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins,
     JobState jobState)
 {
     if (result == null)
     {
         throw new ArgumentNullException(nameof(result));
     }
     PartialDiscoveryResultsContainer.PartialResult partialResult = new PartialDiscoveryResultsContainer.PartialResult(scheduledJobId, scheduledJobId, orderedPlugins, jobState, result.get_ProfileId(), this._persistenceStore, DateTime.MaxValue)
     {
         Result = result
     };
     lock (this._syncRoot)
     {
         this._resultsByMainJobId[partialResult.JobId] = new List <PartialDiscoveryResultsContainer.PartialResult>();
         this._resultsByMainJobId[partialResult.JobId].Add(partialResult);
         this._resultsByOwnJobId[partialResult.JobId] = partialResult;
     }
 }
Exemplo n.º 4
0
        private OrionDiscoveryJobResult MergePartialResults(
            List <PartialDiscoveryResultsContainer.PartialResult> results)
        {
            if (results.Count == 0)
            {
                throw new ArgumentException("Results for merge can't be empty.", nameof(results));
            }
            OrionDiscoveryJobResult result = results[0].Result;

            if (result == null)
            {
                throw new ArgumentException("Main results for merge were not loaded.", nameof(results));
            }
            OrionDiscoveryJobResult discoveryJobResult = (OrionDiscoveryJobResult)((DiscoveryResultBase)result).Copy();

            foreach (PartialDiscoveryResultsContainer.PartialResult partialResult in results.Skip <PartialDiscoveryResultsContainer.PartialResult>(1))
            {
                this.MergePluginResults(discoveryJobResult.get_ProfileId(), ((DiscoveryResultBase)discoveryJobResult).get_PluginResults(), ((DiscoveryResultBase)partialResult.Result).get_PluginResults());
            }
            return(discoveryJobResult);
        }
Exemplo n.º 5
0
        // Token: 0x06000651 RID: 1617 RVA: 0x00025D38 File Offset: 0x00023F38
        public bool SaveResult(Guid jobId, OrionDiscoveryJobResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            string text = null;

            try
            {
                text = this.GetResultsTempFileName(jobId);
                DataContractSerializer dataContractSerializer = new DataContractSerializer(typeof(OrionDiscoveryJobResult));
                using (AesCryptoServiceProvider aesCryptoServiceProvider = new AesCryptoServiceProvider())
                {
                    aesCryptoServiceProvider.Key     = this.GetEncryptionKey(jobId);
                    aesCryptoServiceProvider.IV      = this.GetEncryptionIV(aesCryptoServiceProvider, jobId);
                    aesCryptoServiceProvider.Mode    = CipherMode.CBC;
                    aesCryptoServiceProvider.Padding = PaddingMode.PKCS7;
                    using (ICryptoTransform cryptoTransform = aesCryptoServiceProvider.CreateEncryptor(aesCryptoServiceProvider.Key, aesCryptoServiceProvider.IV))
                    {
                        using (FileStream fileStream = new FileStream(text, FileMode.Create, FileAccess.Write))
                        {
                            using (CryptoStream cryptoStream = new CryptoStream(fileStream, cryptoTransform, CryptoStreamMode.Write))
                            {
                                using (GZipStream gzipStream = new GZipStream(cryptoStream, CompressionMode.Compress))
                                {
                                    dataContractSerializer.WriteObject(gzipStream, result);
                                }
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                PartialDiscoveryResultsFilePersistence._log.ErrorFormat("Error saving partial discovery result for job {0} to temporary file {1}. {2}", jobId, text ?? "<unable to get filename>", ex);
            }
            return(false);
        }
Exemplo n.º 6
0
        public void AddExpectedPartialResult(Guid scheduledJobId, OrionDiscoveryJobResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }
            List <PartialDiscoveryResultsContainer.PartialResult> completeResults;

            lock (this._syncRoot)
            {
                PartialDiscoveryResultsContainer.PartialResult partialResult;
                if (!this._resultsByOwnJobId.TryGetValue(scheduledJobId, out partialResult))
                {
                    throw new ArgumentException("Results with given job ID are not expected.", nameof(scheduledJobId));
                }
                partialResult.Result = result;
                completeResults      = this.TryGetCompleteResults(partialResult.MainJobId);
            }
            if (completeResults == null)
            {
                return;
            }
            this.OnDiscoveryResultsComplete(completeResults);
        }