예제 #1
0
        public static XElement GetJobsDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            int    num      = arguments.GetArgumentOrDefault <int>("maxsize", int.MaxValue);
            Guid   empty    = Guid.Empty;
            string text     = null;
            string argument = arguments.GetArgument <string>("job");

            if (!string.IsNullOrEmpty(argument) && !Guid.TryParse(argument, out empty))
            {
                text = argument;
            }
            MRSRequestType?argumentOrDefault = arguments.GetArgumentOrDefault <MRSRequestType?>("requesttype", null);
            XElement       xelement          = new XElement("Jobs");

            lock (MailboxSyncerJobs.syncRoot)
            {
                using (Dictionary <Guid, BaseJob> .ValueCollection.Enumerator enumerator = MailboxSyncerJobs.activeJobs.Values.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        BaseJob baseJob = enumerator.Current;
                        if (num == 0)
                        {
                            break;
                        }
                        if ((empty == Guid.Empty || empty == baseJob.RequestJobGuid) && (argumentOrDefault == null || argumentOrDefault == baseJob.CachedRequestJob.RequestType) && (string.IsNullOrEmpty(text) || CommonUtils.IsValueInWildcardedList(baseJob.RequestJobStoringMDB.ToString(), text)))
                        {
                            xelement.Add(arguments.RunDiagnosticOperation(() => baseJob.GetJobDiagnosticInfo(arguments)));
                            num--;
                        }
                    }
                }
            }
            return(xelement);
        }