Ignore:
Timestamp:
May 20, 2010, 12:35:16 PM (12 years ago)
Author:
Sven Rech
Message:

replaced all BigInteger stuff with the new BigInteger class from .net 4.0

But there are still problems with some plugins (Keysearcher, BigInteger Operations...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerJobs/JobMessages.cs

    r1348 r1448  
    1919using System.Text;
    2020using Cryptool.PluginBase.Miscellaneous;
     21using System.Numerics;
    2122
    2223namespace Cryptool.Plugins.PeerToPeer.Jobs
     
    122123        {
    123124            byte[] serializedJobPart = null;
    124             jobId = null;
     125            jobId = -1;
    125126            if ((MessageJobType)data[0] == MessageJobType.JobPart)
    126127            {
     
    173174        {
    174175            byte[] serializedJobResult = null;
    175             jobId = null;
     176            jobId = -1;
    176177            if ((MessageJobType)data[0] == MessageJobType.JobResult)
    177178            {
     
    318319                // Note, there is a Bug in BigInt: BigInt b = 256; => b.dataLength = 1 -- it should be 2!
    319320                // As a workarround rely on getBytes().Length (the null bytes for the BigInt 0 should be fixed now)
    320                 byte[] jobIdBytes = jobId.getBytes();
     321                byte[] jobIdBytes = jobId.ToByteArray();
    321322                byte[] jobIdBytesLen = BitConverter.GetBytes(jobIdBytes.Length);
    322323             
     
    346347            int iInt32 = 4;
    347348
    348             BigInteger result = null;
     349            BigInteger result = -1;
    349350            bytesLeft = serializedJobId.Length;
    350351            if (serializedJobId != null && serializedJobId.Length > iInt32)
     
    355356                byte[] bigIntByte = new byte[bigIntLen];
    356357                Buffer.BlockCopy(serializedJobId, bigIntByteLen.Length, bigIntByte, 0, bigIntByte.Length);
    357                 result = new BigInteger(bigIntByte, bigIntByte.Length);
     358                result = new BigInteger(bigIntByte);
    358359                bytesLeft = serializedJobId.Length - iInt32 - bigIntByte.Length;
    359360            }
Note: See TracChangeset for help on using the changeset viewer.