To Speed up the Digital signing process in multithread appliaction in WPF c# -


here code:

            int threadcount = filteredviewtable.count;             int chunksize = threadcount + 1;             int lastbatch = 0;             int batchcount = 0;             if (threadcount > chunksize)             {                 batchcount = threadcount / chunksize;                 lastbatch = threadcount % chunksize;             }             else                 lastbatch = threadcount;              if (lastbatch > 0)                 batchcount++;              int endthread = 0;             int counter = 0;             while (counter < batchcount)             {                 int startpos = counter == 0 ? 0 : (endthread * counter);                 counter++;                  if (counter == batchcount && lastbatch != 0)                     endthread = lastbatch;                 else                     endthread = chunksize;                  int endpos = endthread;                  observablecollection<manualsendingdata> dttempfiltereddata = new observablecollection<manualsendingdata>();                 mnthreadcount = 1;                 int32 lnrowcount = 0;                 decimal rowsperthread = 0;                 array.resize(ref moprocessfilesthreads, mnthreadcount);                  array.resize(ref modatatables, mnthreadcount);                 array.resize(ref moemailthreadserrors, mnthreadcount);                 array.resize(ref mcthreadserrors, mnthreadcount);                 array.resize(ref mnmailcount, mnthreadcount);                  rowsperthread = math.round(convert.todecimal(endthread / globalstatic.gcthreads), 0);                 list<manualsendingdata> lo = filteredviewtable.skip(startpos).take(endthread).tolist();                   foreach (manualsendingdata drrow in lo)                 {                     lnrowcount += 1;                     momaindatatable.where(item => item.clientcode == drrow.clientcode).tolist().foreach((dataitem) =>                     {                         dttempfiltereddata.add(dataitem);                     });                     if (lnrowcount == rowsperthread)                     {                         array.resize(ref moprocessfilesthreads, mnthreadcount);                         array.resize(ref modatatables, mnthreadcount);                         array.resize(ref moemailthreadserrors, mnthreadcount);                         array.resize(ref mcthreadserrors, mnthreadcount);                         array.resize(ref mnmailcount, mnthreadcount);                         modatatables[mnthreadcount - 1] = new observablecollection<manualsendingdata>();                         modatatables[mnthreadcount - 1] = new observablecollection<manualsendingdata>(dttempfiltereddata);                         mnmailcount[mnthreadcount - 1] = convert.toint32(dttempfiltereddata.count);                         moprocessfilesthreads[mnthreadcount - 1] = new thread(new parameterizedthreadstart(processfiles));                         moprocessfilesthreads[mnthreadcount - 1].name = (mnthreadcount - 1).tostring();                         moprocessfilesthreads[mnthreadcount - 1].start((object)dttempfiltereddata);                         lnrowcount = 0;                         mnthreadcount += 1;                         dttempfiltereddata = new observablecollection<manualsendingdata>();                     }                 }                 list<int> completedthreads = new list<int>();                 int intablecount = 0;                 int inrowcount = 0;              } 

here carrying out signing process in "processfiles" method

previously used use ".pfx" file sign pdf/html files in 30 minutes. forced use certificate located on e-token (attached usb port), same process takes approx. 6 hours.

i working on wpf/c# application

for html signing have used chilkat. pdf signing have used itextsharp

any suggestion speed process?


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -