hello, having a c# question again. i am trying to build a list inside the plugin and want to output the list via pin.
really not understanding the error i am getting:
“Index was out of range. Must be non-negative and less than the size of the collection.”
https://vvvv.org/sites/default/files/imagecache/large/images/Capture.GIF
the output is 2 slices but identical (the first aaa)
when i search for bbb, i am getting just one empty slice.
can anyone help me out?
- region usings
using System;
using System.ComponentModel.Composition;
using System.Collections.Generic;
using VVVV.PluginInterfaces.V1;
using VVVV.PluginInterfaces.V2;
using VVVV.Utils.VColor;
using VVVV.Utils.VMath;
- endregion usings
namespace VVVV.Nodes
{
#region PluginInfo
[PluginInfo(Name = "Template", Category = "String", Version = "1", Help = "Basic template with one string in/out", Tags = "")](PluginInfo(Name = "Template", Category = "String", Version = "1", Help = "Basic template with one string in/out", Tags = ""))
#endregion PluginInfo
public class C1StringTemplateNode : IPluginEvaluate
{
#region fields & pins
[Output("Output")](Output("Output"))
ISpread<string> FOutput;
[Output("Errors")](Output("Errors"))
ISpread<string> FErrors;
#endregion fields & pins
public void Evaluate(int SpreadMax)
{
try {
string theString = "aaa 1XXX,bbb XXX,ccc XXX,aaa 2XXX";
List<string> listFromTheString = new List<string>(theString.Split(','));
List<string> listOfFoundItems = new List<string>();
for (int i = 0; i < (listFromTheString.Count); i++)
{
if(listFromTheString[i](i).Contains("aaa"))
{
listOfFoundItems.Add(listFromTheString[i](i));
FOutput.SliceCount = listOfFoundItems.Count;
FOutput[i](i) = listOfFoundItems[i](i);
}
}
} catch (Exception error) {FErrors[0](0) = error.Message;}
}
}
}