public RPMSync(string apiUrl, string apiKey) { this.rpmApiUrl = apiUrl; this.rpmApiKey = apiKey; this.syncDataWorker.WorkerReportsProgress = true; this.syncDataWorker.DoWork += syncData; this.syncDataWorker.RunWorkerCompleted += syncingComplete; this.syncDataWorker.ProgressChanged += syncingProgressChanged; this.checkRPMAccess(); if (this.infoSuccessful()) { ProcsResult procs = this.getAllProcs(); this.jobProcess = this.getProc("External-JobInformation", procs); if (this.jobProcess == null) { throw new ProcessNotFoundException("The RPM Process \"External-JobInformation\" was not Found."); } if (!this.jobProcess.Enabled) { RPMApiError error = new RPMApiError(); error.Error = new Dictionary <string, string> { { "Message", "The RPM Process \"External-JobInformation\" is not enabled." } }; throw error; } } }
private ProcsResult getAllProcs() { RPMApi rpm = new RPMApi(this.rpmApiUrl, this.rpmApiKey); ProcsResult p = rpm.Procs(); return(p); }
private ProcResult getProc(string procName, ProcsResult procs) { foreach (ProcResult proc in procs.Procs) { if (proc.Process == procName) { return(proc); } } return(null); }