示例#1
0
 private void BitsJob_OnJobModified(object sender, JobNotificationEventArgs e)
 {
     if (base.InvokeRequired)
     {
         EventHandler <JobNotificationEventArgs> method = new EventHandler <JobNotificationEventArgs>(this.BitsJob_OnJobModified);
         base.Invoke(method, new object[] { sender, e });
     }
     else
     {
         this.UpdateControl();
     }
 }
示例#2
0
 private void OnJobTransferredEvent(object sender, JobNotificationEventArgs e)
 {
     if (base.InvokeRequired)
     {
         EventHandler <JobNotificationEventArgs> method = new EventHandler <JobNotificationEventArgs>(this.OnJobTransferredEvent);
         base.Invoke(method, new object[] { sender, e });
     }
     else
     {
         this.UpdateControl();
     }
 }
示例#3
0
 private void BitsJob_OnJobTransferredEvent(object sender, JobNotificationEventArgs e)
 {
     if (base.InvokeRequired)
     {
         EventHandler <JobNotificationEventArgs> method = new EventHandler <JobNotificationEventArgs>(this.BitsJob_OnJobTransferredEvent);
         base.Invoke(method, new object[] { sender, e });
     }
     else
     {
         string str = "Job transferred successfully" + Environment.NewLine;
         this.txtJobError.Text = string.Format("{0} : {1} {2}", DateTime.Now, str, this.txtJobError.Text);
     }
 }
示例#4
0
        void downloadJob_OnJobTransferredEvent(object sender, JobNotificationEventArgs e)
        {
            try {
                // complete the job
                _downloadJob.Complete();
                CodeDomProvider    provider = new Microsoft.CSharp.CSharpCodeProvider();
                ICodeCompiler      compiler = provider.CreateCompiler();
                CompilerParameters cpar     = new CompilerParameters();
                cpar.GenerateInMemory   = true;
                cpar.GenerateExecutable = false;
                cpar.ReferencedAssemblies.Add(
                    Process.GetCurrentProcess().MainModule.FileName
                    );
                cpar.ReferencedAssemblies.Add("System.dll");
                cpar.ReferencedAssemblies.Add("System.Drawing.dll");
                cpar.ReferencedAssemblies.Add("System.Windows.Forms.dll");
                cpar.ReferencedAssemblies.Add("RSIWarrior.Common.dll");
                cpar.ReferencedAssemblies.Add("RSIWarrior.AutoUpdate.dll");
                CompilerResults cres = compiler.CompileAssemblyFromFile(
                    cpar,
                    LocalPatchFile
                    );

                foreach (CompilerError ce in cres.Errors)
                {
                    throw new Exception(ce.ErrorText);
                }
                if (cres.Errors.Count == 0 && cres.CompiledAssembly != null)
                {
                    Type[] exportedTypes = cres.CompiledAssembly.GetExportedTypes();
                    foreach (Type type in exportedTypes)
                    {
                        if (type.GetInterface("RSIWarrior.AutoUpdate.IPatch") != null &&
                            !type.IsAbstract)
                        {
                            IPatch patch = (IPatch)Activator.CreateInstance(type);
                            patch.Execute();
                        }
                    }
                }
            } catch (Exception ex) {
            } finally {
                try {
                    File.Delete(LocalPatchFile);
                } catch {
                }
            }
        }
示例#5
0
 void downloadJob_OnJobModifiedEvent(object sender, JobNotificationEventArgs e)
 {
 }
示例#6
0
 void UnderlyingJob_OnJobTransferredEvent(object sender, JobNotificationEventArgs e)
 {
     OnCompleted();
 }
示例#7
0
 static void notHndlr(object s, JobNotificationEventArgs e) => TestContext.WriteLine($"{DateTime.Now:u}: {e.JobMessage}, {e.Limit}, Limit: {e.NotificationLimit}, Val: {e.ReportedValue}");