Ignore:
Timestamp:
Sep 16, 2009, 11:51:47 AM (12 years ago)
Author:
Matthäus Wander
Message:

AnotherEditor:

  • fixed bug in recent "QuickWatch of any Array" method
  • minor change for default QuickWatch

DataManager:

  • replaced Encoding (Cryptool.PluginBase.EncodingTypes) property with TextEncoding (System.Text.Encoding)

Dictionary:

  • enabled changing dict file during play mode (using PropertyChanged event and allowReexecution flag)
  • fixed recently introduced NullReferenceException
  • added support to above TextEncoding Property

MonoalphabeticAnalysis:

  • fixed erroneous file reference in .csproj

TextOutput:

  • fixed recently introduced NullReferenceException

WordPatterns:

  • added metainfo to german dictionary
  • improvements handling empty input and empty result set
File:
1 edited

Legend:

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

    r487 r520  
    407407            OnPropertyChanged(propertyKey);
    408408        }
    409 
    410         // check type explicitly, if connector type is set to anything else than object
    411         if (getCurrentType() != typeof(object) && !getCurrentType().Equals(value.GetType()))
    412         {
    413             GuiLogMessage(String.Format("Input data type does not match setting. Expected: {0}, Found: {1}", getCurrentType(), value.GetType()),
    414                 NotificationLevel.Error);
    415             return;
    416         }
    417 
    418         if (value is bool)
    419         {
    420             if (settings.BooleanAsNumeric)
    421             {
    422                 fillValue = Convert.ToInt32(value).ToString();
     409        else
     410        {
     411            // check type explicitly, if connector type is set to anything else than object
     412            if (getCurrentType() != typeof(object) && !getCurrentType().Equals(value.GetType()))
     413            {
     414                GuiLogMessage(String.Format("Input data type does not match setting. Expected: {0}, Found: {1}", getCurrentType(), value.GetType()),
     415                    NotificationLevel.Error);
     416                return;
     417            }
     418
     419            if (value is bool)
     420            {
     421                if (settings.BooleanAsNumeric)
     422                {
     423                    fillValue = Convert.ToInt32(value).ToString();
     424                }
     425                else
     426                {
     427                    fillValue = ((bool)value).ToString();
     428                }
     429            }
     430            else if (value is CryptoolStream)
     431            {
     432                listCryptoolStreamsOut.Add((CryptoolStream)value);
     433                CryptoolStream stream = value as CryptoolStream;
     434                // GuiLogMessage("Stream: Filling TextBoxes now...", NotificationLevel.Debug);
     435                if (stream.Length > settings.MaxLength)
     436                    AddMessage("WARNING - Stream is too large (" + (stream.Length / 1024).ToString("0.00") + " kB), output will be truncated to " + (settings.MaxLength / 1024).ToString("0.00") + "kB", NotificationLevel.Warning);
     437                byte[] byteValues = new byte[Math.Min(settings.MaxLength, stream.Length)];
     438                int bytesRead;
     439                stream.Seek(0, SeekOrigin.Begin);
     440                bytesRead = stream.Read(byteValues, 0, byteValues.Length);
     441                fillValue = GetStringForSelectedEncoding(byteValues);
     442            }
     443            else if (value is byte[])
     444            {
     445                byte[] byteArray = value as byte[];
     446                // GuiLogMessage("Byte array: Filling textbox now...", NotificationLevel.Debug);
     447                if (byteArray.Length > settings.MaxLength)
     448                {
     449                    AddMessage("WARNING - byte array is too large (" + (byteArray.Length / 1024).ToString("0.00") + " kB), output will be truncated to " + (settings.MaxLength / 1024).ToString("0.00") + "kB", NotificationLevel.Warning);
     450                }
     451
     452                long size = byteArray.Length;
     453                if (size > settings.MaxLength)
     454                {
     455                    size = settings.MaxLength;
     456                }
     457                byte[] sizedArray = new byte[size];
     458                for (int i = 0; i < size; i++)
     459                {
     460                    sizedArray[i] = byteArray[i];
     461                }
     462                fillValue = GetStringForSelectedEncoding(sizedArray);
    423463            }
    424464            else
    425465            {
    426                 fillValue = ((bool)value).ToString();
    427             }
    428         }
    429         else if (value is CryptoolStream)
    430         {
    431           listCryptoolStreamsOut.Add((CryptoolStream)value);
    432           CryptoolStream stream = value as CryptoolStream;
    433           // GuiLogMessage("Stream: Filling TextBoxes now...", NotificationLevel.Debug);
    434           if (stream.Length > settings.MaxLength)
    435             AddMessage("WARNING - Stream is too large (" + (stream.Length / 1024).ToString("0.00") + " kB), output will be truncated to " + (settings.MaxLength / 1024).ToString("0.00") + "kB", NotificationLevel.Warning);
    436           byte[] byteValues = new byte[Math.Min(settings.MaxLength, stream.Length)];
    437           int bytesRead;
    438           stream.Seek(0, SeekOrigin.Begin);
    439           bytesRead = stream.Read(byteValues, 0, byteValues.Length);
    440           fillValue = GetStringForSelectedEncoding(byteValues);
    441         }
    442         else if (value is byte[])
    443         {
    444           byte[] byteArray = value as byte[];
    445           // GuiLogMessage("Byte array: Filling textbox now...", NotificationLevel.Debug);
    446           if (byteArray.Length > settings.MaxLength)
    447           {
    448             AddMessage("WARNING - byte array is too large (" + (byteArray.Length / 1024).ToString("0.00") + " kB), output will be truncated to " + (settings.MaxLength / 1024).ToString("0.00") + "kB", NotificationLevel.Warning);
    449           }
    450 
    451           long size = byteArray.Length;
    452           if (size > settings.MaxLength)
    453           {
    454             size = settings.MaxLength;
    455           }
    456           byte[] sizedArray = new byte[size];
    457           for (int i = 0; i < size; i++)
    458           {
    459             sizedArray[i] = byteArray[i];
    460           }
    461           fillValue = GetStringForSelectedEncoding(sizedArray);
    462         }
    463         else
    464         {
    465             fillValue = value.ToString();
     466                fillValue = value.ToString();
     467            }
    466468        }
    467469
Note: See TracChangeset for help on using the changeset viewer.