Ignore:
Timestamp:
Sep 9, 2009, 4:33:44 PM (12 years ago)
Author:
Matthäus Wander
Message:
  • enabled object-to-object connections
    • removed check which prohibited object to object
    • see ticket #79 for more information
  • changed color of object connections from magenta to cornsilk
  • minor change to NumberGenerator
  • changed TextOutput:
    • default type is now object
    • object takes any type and calls corresponding ToString()
    • if type is set anything else than object, the type of the value is checked explicitly if it matches
Location:
trunk/CrypPlugins/TextOutput
Files:
2 edited

Legend:

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

    r419 r487  
    402402        }
    403403
    404         fillValue = null;
    405 
    406         if (value is String || value is string)
    407         {
    408           fillValue = value as string;
    409         }
    410         else if (value is int)
    411         {
    412           fillValue = ((int)value).ToString();
    413         }
    414         else if (value is double)
    415         {
    416             fillValue = ((double)value).ToString();
    417         }
    418         else if (value is bool)
     404        if (value == null)
     405        {
     406            fillValue = "null";
     407            OnPropertyChanged(propertyKey);
     408        }
     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)
    419419        {
    420420            if (settings.BooleanAsNumeric)
     
    461461          fillValue = GetStringForSelectedEncoding(sizedArray);
    462462        }
    463         else if (value is object || value is Object)
    464         {
    465           fillValue = value.ToString();
    466           if (fillValue != null && fillValue.Length > settings.MaxLength)
    467           {
    468             fillValue = fillValue.Substring(0, settings.MaxLength);
    469           }
     463        else
     464        {
     465            fillValue = value.ToString();
    470466        }
    471467
    472468        if (fillValue != null)
    473469        {
    474           setText(fillValue);
    475           OnPropertyChanged("StringInput");
    476         }
    477 
    478         OnPropertyChanged(propertyKey);
     470            if (fillValue.Length > settings.MaxLength)
     471            {
     472                fillValue = fillValue.Substring(0, settings.MaxLength);
     473            }
     474
     475            setText(fillValue);
     476            OnPropertyChanged(propertyKey);
     477        }
    479478      }
    480479      catch (Exception ex)
  • trunk/CrypPlugins/TextOutput/TextOutputSettings.cs

    r312 r487  
    244244      set
    245245      {
    246         if (this.Encoding != value) hasChanges = true;
     246        if (this.encoding != value) hasChanges = true;
    247247        this.encoding = value;
    248248        OnPropertyChanged("EncodingSetting");
     
    355355    }
    356356
    357     private DynamicDataTypes currentDataType;
     357    private DynamicDataTypes currentDataType = DynamicDataTypes.Object;
    358358    public DynamicDataTypes CurrentDataType
    359359    {
Note: See TracChangeset for help on using the changeset viewer.