Changeset 1783


Ignore:
Timestamp:
Aug 9, 2010, 3:10:10 PM (11 years ago)
Author:
Sven Rech
Message:

Changed input and output of PrimesGenerator and PrimeTest to BigInteger instead of String

Location:
trunk/CrypPlugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PrimeTest/PrimeTest.cs

    r809 r1783  
    77using Cryptool.PluginBase.IO;
    88using Primes.Bignum;
     9using System.Numerics;
    910
    1011namespace PrimeTest
     
    9899
    99100    #region Properties
    100     private string m_InputString;
     101    private BigInteger m_InputNumber;
    101102    PrimesBigInteger m_Value = null;
    102     [PropertyInfo(Direction.InputData, "Text input", "Input a string that represent a natural number", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text,null)]
    103     public string InputString
     103    [PropertyInfo(Direction.InputData, "Text input", "Input a BigInteger", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text,null)]
     104    public BigInteger InputNumber
    104105    {
    105       get { return this.m_InputString; }
     106      get { return this.m_InputNumber; }
    106107      set
    107108      {
    108         if (value != m_InputString)
     109        if (value != m_InputNumber)
    109110        {
    110111          try
    111112          {
    112             if (!string.IsNullOrEmpty(value))
    113             {
    114               this.m_InputString = value;
    115               m_Value = new PrimesBigInteger(m_InputString.Trim());
    116               FirePropertyChangeEvent("InputString");
    117             }
    118             else
    119             {
    120               throw new Exception();
    121             }
    122 
     113            this.m_InputNumber = value;
     114            m_Value = new PrimesBigInteger(m_InputNumber.ToString());
     115            FirePropertyChangeEvent("InputString");
    123116          }
    124117          catch
  • trunk/CrypPlugins/PrimeTest/PrimeTest.csproj

    r1487 r1783  
    8585      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    8686    </Reference>
     87    <Reference Include="System.Numerics" />
    8788    <Reference Include="System.Xaml" />
    8889    <Reference Include="System.Xml.Linq">
  • trunk/CrypPlugins/PrimesGenerator/PrimesGenerator.cs

    r809 r1783  
    99using Cryptool.PluginBase.Tool;
    1010using Primes.Bignum;
     11using System.Numerics;
    1112
    1213namespace Cryptool.PrimesGenerator
     
    5253
    5354
    54     private string m_OutputString;
    55     [PropertyInfo(Direction.OutputData, "Text output", "A primenumber", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
    56     public string OutputString
     55    private BigInteger m_OutputString;
     56    [PropertyInfo(Direction.OutputData, "BigInteger output", "A primenumber", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
     57    public BigInteger OutputString
    5758    {
    5859      get { return this.m_OutputString; }
     
    135136        {
    136137          case 0:
    137             OutputString = PrimesBigInteger.Random(m_Input).NextProbablePrime().ToString();
     138            OutputString = BigInteger.Parse(PrimesBigInteger.Random(m_Input).NextProbablePrime().ToString());
    138139            break;
    139140          case 1:
     
    143144              result = PrimesBigInteger.RandomM(m_Input).NextProbablePrime();
    144145            }
    145             OutputString = result.ToString();
     146            OutputString = BigInteger.Parse(result.ToString());
    146147            break;
    147148        }
  • trunk/CrypPlugins/PrimesGenerator/PrimesGenerator.csproj

    r1487 r1783  
    8888      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    8989    </Reference>
     90    <Reference Include="System.Numerics" />
    9091    <Reference Include="System.Xaml" />
    9192    <Reference Include="System.Xml.Linq">
Note: See TracChangeset for help on using the changeset viewer.