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...)

Location:
trunk/CrypPlugins/PeerToPeerManager_NEW
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManagerBase_NEW.cs

    r1433 r1448  
    2323using Cryptool.PluginBase.Miscellaneous;
    2424using Cryptool.Plugins.PeerToPeer.Internal;
     25using System.Numerics;
    2526
    2627/* TODO:
     
    282283        private void HandleJobAcceptanceMessage(PeerId sender, byte[] data)
    283284        {
    284             BigInteger jobId = null;
     285            BigInteger jobId = 0;
    285286            if (JobMessages.GetJobAcceptanceMessage(data, out jobId))
    286287            {
     
    455456        {
    456457            int i = 0;
    457             BigInteger temp_jobId = null;
     458            BigInteger temp_jobId = 0;
    458459            List<PeerId> freePeers = ((WorkersManagement)this.peerManagement).GetFreeWorkers();
    459460
     
    506507        {
    507508            double jobProgressInPercent;
    508             double lFinishedAmount = (double)this.distributableJobControl.FinishedAmount.LongValue();
    509             double lAllocatedAmount = (double)this.distributableJobControl.AllocatedAmount.LongValue();
    510             double lTotalAmount = (double)this.distributableJobControl.TotalAmount.LongValue();
     509            double lFinishedAmount = (double)(long)this.distributableJobControl.FinishedAmount;
     510            double lAllocatedAmount = (double)(long)this.distributableJobControl.AllocatedAmount;
     511            double lTotalAmount = (double)(long)this.distributableJobControl.TotalAmount;
    511512
    512513            if (lFinishedAmount > 0 && lAllocatedAmount > 0)
     
    541542        {
    542543            DateTime retTime = DateTime.MaxValue;
    543             if (this.distributableJobControl.FinishedAmount.LongValue() > 0)
     544            if ((long)this.distributableJobControl.FinishedAmount > 0)
    544545            {
    545546                TimeSpan bruteforcingTime = DateTime.Now.Subtract(this.StartWorkingTime);
    546                 double jobsPerSecond = bruteforcingTime.TotalSeconds / this.distributableJobControl.FinishedAmount.LongValue();
     547                double jobsPerSecond = bruteforcingTime.TotalSeconds / (long)this.distributableJobControl.FinishedAmount;
    547548                double restSeconds = jobsPerSecond *
    548                     (this.distributableJobControl.TotalAmount - this.distributableJobControl.FinishedAmount).LongValue();
     549                    (long)(this.distributableJobControl.TotalAmount - this.distributableJobControl.FinishedAmount);
    549550                //retTime.TotalSeconds = jobsPerSecond * (2 - (progressInPercent / 100));
    550551                retTime = DateTime.Now.AddSeconds(restSeconds);
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManager_KeyPattern.cs

    r1434 r1448  
    3131using System.Windows.Media;
    3232using Cryptool.Plugins.PeerToPeer.Internal;
     33using System.Numerics;
    3334
    3435/*TODO:
     
    306307                    ((P2PManagerPresentation)QuickWatchPresentation).txtTotal.Text = "" + jobsTotalAmount.ToString();
    307308                    ((P2PManagerPresentation)QuickWatchPresentation).txtInProgress.Text = "" + jobsInProgress.ToString();
    308                     ((P2PManagerPresentation)QuickWatchPresentation).txtLeft.Text = "" + new BigInteger((jobsTotalAmount - jobsInProgress - jobsFinished)).ToString();
     309                    ((P2PManagerPresentation)QuickWatchPresentation).txtLeft.Text = "" + (jobsTotalAmount - jobsInProgress - jobsFinished).ToString();
    309310                    ((P2PManagerPresentation)QuickWatchPresentation).txtFinished.Text = "" + jobsFinished.ToString();
    310311
     
    353354        {
    354355            // new Progress Chunk - Arnold 2010.02.23
    355             if (jobId.LongValue() <= Int32.MaxValue)
    356             {
    357                 int iJobId = (int)jobId.LongValue();
     356            if ((long)jobId <= Int32.MaxValue)
     357            {
     358                int iJobId = (int)jobId;
    358359                if (QuickWatchPresentation.IsVisible)
    359360                {
     
    377378        private void SetProgressChunkJobCount(BigInteger bigInteger)
    378379        {
    379             if (bigInteger.LongValue() <= Int32.MaxValue)
    380             {
    381                 int count = (int)bigInteger.LongValue();
     380            if ((long)bigInteger <= Int32.MaxValue)
     381            {
     382                int count = (int)bigInteger;
    382383                if (QuickWatchPresentation.IsVisible)
    383384                {
  • trunk/CrypPlugins/PeerToPeerManager_NEW/PeerToPeerManager_NEW.csproj

    r1433 r1448  
    104104      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    105105    </Reference>
     106    <Reference Include="System.Numerics" />
    106107    <Reference Include="System.Xaml" />
    107108    <Reference Include="System.Xml.Linq">
Note: See TracChangeset for help on using the changeset viewer.